Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3580524pxf; Mon, 22 Mar 2021 09:41:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2X1GyrD//0y9PXPmycKkbcB43EEo5MoTBZziWHVl3p9xOOBFwJXnivG1IedUIGPtL2/Kn X-Received: by 2002:a17:906:33d9:: with SMTP id w25mr673192eja.413.1616431271209; Mon, 22 Mar 2021 09:41:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616431271; cv=none; d=google.com; s=arc-20160816; b=mCaIcuxVDDDt4neWvyfv08pOH7FJlArJjXD8bjqibbri8DE4xfQ8UTNRJ4I7dzhMJ7 6MV2iqXuCbYBv2+ibETK6AusCjc1C2ms0JTtwfSEWipgD5Pd3eN14tU8gZ7GDCPRl8yL 5gmY8jPQlxl1sko7Q9uNnLCDArUtrLZqMV22jxpiLztPHRhF8zXRn6nIuoBf8nPqa4Vz U4HbEjFr/vSRF5C79c8DIvMqIOGQD2ty3CHK+dLtQBLjwy2kH1QjUYOh4uShy8k4Diq9 yLAQT0EbzNboMdMKdQG7NXILWzwf0V8Vc21TRSlJTL+l9dxcEFJNRHDInaM5RPmF6gVq U4+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=cstLSlg64cVRGYycloccCUIALExFv74RGkKqVQbwqU8=; b=L3rg6vC0bc17MxQKJlI3rj210jLMGNIqXk2t9Eqg8LX8Gcu6O3Q9NkEaKgYeWbessE hALw9oU3snX3LFwwScKMj7HvEw8z9XOWPwnknCfllsA/1AaarUH9SFpBin0MxZRP8xZa wbwRmyqmA1UWLGncM2XLBeRAECRjmpOitTrQesjPjT5TIlL+3VA9zL1QL6LHBT0zBMrX oZe0yi49LoF1q8ikdZ6K0dfKCawYogg6UxF6ZcSXdSOpSdpj9OSEjAlM/u8T2mfRR4mi WmElP+tLZzQ79TJH3FZDUrSFCuVaLQOca/mD+EAkIw5lP7Ra4KStN/SO6SMolirE0Ivy 1Izg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=F2EFDZH9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g17si11656559eds.403.2021.03.22.09.40.49; Mon, 22 Mar 2021 09:41:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=F2EFDZH9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230140AbhCVQhd (ORCPT + 99 others); Mon, 22 Mar 2021 12:37:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:29109 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231955AbhCVQhR (ORCPT ); Mon, 22 Mar 2021 12:37:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616431036; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=cstLSlg64cVRGYycloccCUIALExFv74RGkKqVQbwqU8=; b=F2EFDZH9sBeXQyVi/px55cCKMeKuCM4c09y1yYY0oJQDM/bzaoc4JHfwG9J8+5UmjPXyTS Awc/N9FkmVaBbtopoN3JPMkM8945wZmsTRQFmHgQSnIT4eH93CqVlBleQDRkV0lbGzrIlg pJS5eyWiuCe8y/Pma4wdGEC3g29sSEg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-15-GEowI-v_PEGGjh93T-c8qQ-1; Mon, 22 Mar 2021 12:37:12 -0400 X-MC-Unique: GEowI-v_PEGGjh93T-c8qQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 83BBF1085937; Mon, 22 Mar 2021 16:37:09 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.40.194.114]) by smtp.corp.redhat.com (Postfix) with SMTP id 3FB9E5C1A3; Mon, 22 Mar 2021 16:37:07 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Mon, 22 Mar 2021 17:37:09 +0100 (CET) Date: Mon, 22 Mar 2021 17:37:05 +0100 From: Oleg Nesterov To: qianli zhao Cc: christian@brauner.io, axboe@kernel.dk, "Eric W. Biederman" , Thomas Gleixner , Peter Collingbourne , linux-kernel@vger.kernel.org, Qianli Zhao Subject: Re: [PATCH V3] exit: trigger panic when global init has exited Message-ID: <20210322163705.GD20390@redhat.com> References: <1615985460-112867-1-git-send-email-zhaoqianligood@gmail.com> <20210317143805.GA5610@redhat.com> <20210318180450.GA9977@redhat.com> <20210319163225.GB19971@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, It seems that we don't understand each other. If we move atomic_dec_and_test(signal->live) and do if (group_dead && is_global_init) panic(...); before setting PF_EXITING like your patch does, then zap_pid_ns_processes() simply won't be called. Because: On 03/21, qianli zhao wrote: > > Hi,Oleg > > > How? Perhaps I missed something again, but I don't think this is possible. > > > zap_pid_ns_processes() simply won't be called, find_child_reaper() will > > see the !PF_EXITING thread which calls panic(). > > > So I think this should be documented somehow, at least in the changelog. > > This problem occurs when both two init threads enter the do_exit, > One of the init thread is syscall sys_exit_group,and set SIGNAL_GROUP_EXIT > The other init thread perform ret_to_user()->get_signal() and found > SIGNAL_GROUP_EXIT is set,then do_group_exit()->do_exit(),since there > are no alive init threads it finally goes to > zap_pid_ns_processes() No, there is at least one alive init thread. If they all have exited, we have the thread which calls panic() above. > and BUG(). so we don't need the SIGNAL_GROUP_EXIT check to avoid this BUG(). What have I missed? Oleg.