Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp58566pxf; Wed, 10 Mar 2021 20:43:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJwuDUkjui6ProHRNiNGwGK5DQZfYhgdFvS0kiltfuhphUIyJEm4YXzPKRGUcJzRrIH09rE5 X-Received: by 2002:a17:907:3e8c:: with SMTP id hs12mr1219328ejc.105.1615437833618; Wed, 10 Mar 2021 20:43:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615437833; cv=none; d=google.com; s=arc-20160816; b=gLZTY8TxpSH+2voBrLXAaJyFfLEuLSNFMouQl4KYJraPMDhHgyHPeQAG5gPWJO2lzX gvvLK2B/dOuwDfT2Ck+vls7wYYVn2biuUiRd3OV23wQq+5zppyK+ozxKh4nlIQunqOYa rv6OumI2HdlK9goLBztfudiuEYOJRAiwA/5IOOPnMNkh/DqS7948R8+QCtfMbEkcSuL0 fV+fnKSlwoflZAj9ZfvKnJzwzrhIIXHZZlzz3eZg7n/fVG8pwXueg3ZOuXx4DBbbLuQh 1iwwS0j4gHvAauGMQ1g0cuTdHnH285wI9b2BX4lSNmRyCnnQOgwjLPM1j7hDG1gypqjp ZMuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=/QfY9o5qVU+uaM0GkTw3MH4V3esABZsaKGtxvHD5Dq8=; b=x9qzsnVBANhZT6uNdcCFajCoEBLdUoiZ3qkw8F7l4j/Ppe0tSxAd3U8toOCqrEj+XE lP2iFnR+OJ82xnjolK5ovSObpMioM/l1zJS3mzfV2BvbwqSDwNSGzucoPmcNGCThudYF kkSGK78eGVM6hI6nsZG66j64dfAIDYr4xwJmIdJ1N3AgvFdOLCazUpCHkDJ2fq2Avq77 ubJ0NQUv9J1igzHUcLMz/R2MCXvFRZtl31eJGoNCH87+rvT4QYF9hjIaIs6rI8bW9ODX qFBIQt+J0pgXHbgzxf9PuQ1MYnGzVg0s+0KjcVv3ZfU+YyxxTu3X3vT5D6sB5q7jRErq xEOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IhYpCm80; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f7si939905edu.503.2021.03.10.20.42.47; Wed, 10 Mar 2021 20:43:53 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=IhYpCm80; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231157AbhCKEl2 (ORCPT + 99 others); Wed, 10 Mar 2021 23:41:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230462AbhCKElB (ORCPT ); Wed, 10 Mar 2021 23:41:01 -0500 Received: from mail-il1-x12a.google.com (mail-il1-x12a.google.com [IPv6:2607:f8b0:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24047C061574 for ; Wed, 10 Mar 2021 20:41:01 -0800 (PST) Received: by mail-il1-x12a.google.com with SMTP id h18so17821653ils.2 for ; Wed, 10 Mar 2021 20:41:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/QfY9o5qVU+uaM0GkTw3MH4V3esABZsaKGtxvHD5Dq8=; b=IhYpCm80Np4hg6Xo6Wyld4fgWI9hbM7PL0geE+DexqPqb9aiwIfGrVV4rWhVRORrso c7rIasHuArlq3WDixS3xmHnlFQ1AxCF+0lYfILz5qjqtaEee9BL+5WzSfguFqm13psuI mvrX2yYzT17e31WZY5Jak1OroUDN+BfH8XuTqoYQUgVYAWvrn9+eqpFuJtOjx2WMQgXt 7C9SvKNQS/dYaONPjv/+uYdeXWrFX9Zi6OpyEKioc1Uac+gQpN2VxxHdD6cjFNA41HT0 Ohf9H93qOYxlA4v1/G8cv1/6xH8rnmxkKeQ2zJnjzHP3xDsbyLXb0uXR5mlKl0qglevA 06rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/QfY9o5qVU+uaM0GkTw3MH4V3esABZsaKGtxvHD5Dq8=; b=Ow6XAE6lzQ9NASHqlp4FqyPuKJBG7ghoeI39Di0wUStYtFGXMkTzoqtNfxvsyQ0PK5 6+1L9mEa1dLB8rVu9HTk+7i5/5EbNVuRzhZiYWDxZM0OncnbW5TxC4wo6DzpvvqLyvwz Mfb7i6USrBf4J428YCVRCZiUEFd9U1UCfkI0uqpLbrrn+QgrNtnU6tWcxdHMFJ+wBOlr sE/s3AHeT9CZ7noGGVqda8T0qBOXtpFVnp1paWNgYFVcBbMx0YGA16HXrbMczmGtavk2 1kIUYyQ4y//JRy1fqbuhDyzaNuzc3HD82GZxUacxRCOqHt0iNDs88M+CbnZl9VC9LMrv 3TKQ== X-Gm-Message-State: AOAM532gl6kVS+x+4W7pzOVRQIt6X4xL/SECgBuB+YIlsoemUJDFrwFM xymvP17JEmZi8ka+rbo02AoLpSDlZiH4klT4TQg= X-Received: by 2002:a05:6e02:1bec:: with SMTP id y12mr5273816ilv.214.1615437660537; Wed, 10 Mar 2021 20:41:00 -0800 (PST) MIME-Version: 1.0 References: <1615296712-175334-1-git-send-email-zhaoqianligood@gmail.com> <20210309182657.GA1408@redhat.com> In-Reply-To: From: qianli zhao Date: Thu, 11 Mar 2021 12:40:49 +0800 Message-ID: Subject: Re: [PATCH] exit: trigger panic when init process is set to SIGNAL_GROUP_EXIT To: "Eric W. Biederman" Cc: Oleg Nesterov , christian@brauner.io, axboe@kernel.dk, Thomas Gleixner , Peter Collingbourne , linux-kernel@vger.kernel.org, Qianli Zhao Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Eric Thank you for your suggestion > At the start of your changelog and your patch subject you describe what > you are doing but not why. For the next revision of the patch please > lead with the why it makes what you are trying to do much easier to > understand. got it. > > It does not work to use SIGNAL_UNKILLABLE for this. Normally init > has SIGNAL_UNKILLABLE set. The only case that clears SIGNAL_UNKILLABLE > is force_sig_info_to_task. If the init process exits with exit(2) > SIGNAL_UNKILLABLE will already be set. Which means testing > SIGNAL_UNKILLABLE as your patch does will prevent the panic. > Ok,using SIGNAL_UNKILLABLE is incorrect. > Further simply calling panic is sufficient to guarantee that the other > threads don't exit, and that whichever thread calls panic first > will be the reporting thread. The rest of the threads will be caught > in panic_smp_self_stop(), if they happen to be running on other cpus. > > So I would make the whole thing just be: > > /* If global init has exited, > * panic immediately to get a useable coredump. > */ > if (unlikely(is_global_init(tsk) && > (thread_group_empty(tsk) || > (tsk->signal->flags & SIGNAL_GROUP_EXIT)))) { > panic("Attempted to kill init! exitcode=0x%08x\n", > tsk->signal->group_exit_code ?: (int)code); > } > > The thread_group_empty test is needed to handle single threaded > inits. > > Do you think you can respin your patch as something like that? > Ok.it's a very good change,other CPUs calls to panic() will be caught and execute panic_smp_self_stop(), there is no need to deal with this situation separately when other CPUs exit().