Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1246541pxb; Fri, 1 Oct 2021 06:45:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwB7tnmZyT3kWA7tb0exR5rmgieMJBdFyRngz5NRvwaJKHTtsM3iEVQ/7KNx030v0gqXYFw X-Received: by 2002:adf:9bd2:: with SMTP id e18mr7294637wrc.218.1633095916647; Fri, 01 Oct 2021 06:45:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633095916; cv=none; d=google.com; s=arc-20160816; b=pjHV7ZhjXJJoVwWXwStR1imJNQ0BhGH62qkPFFIRsRp4AvzfmXMwVBDzdhDai7VZp7 v83ChFdDgRLbKXhhs0H6zCgdht5Pz62/pjBpkT/fogXqY21RlNcrVM2dImCKA8iv2rJ3 U7DNRyt6C7jPY1qaMJUudQZ08HaOjwY4EskDvWvZvGllXu2TlV8OUmeANsWka9cpMwai CcISDW2y2MS1QZcTffDHCCrIlLKyIiFbUorKEGUZomMDrYB62+ceRP2Jqx73LxAkeWZG DIoVlY40k29KWz73UtvXJKiAJ9H3Qg3xazHLY7SmkpbgXzy9wTZbTtU8bkTMJiXnz8Ev nV3A== 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=wtBZ7U5ewDlKJ28ZtqZTNSvN7kEYRmILRT2iVxUTj2c=; b=ykmARFtwfR67SLbEyK6++YBerTVnOM39Z+gq5jEDrzT+SXgaCBs/qHD4KiN2HiT2nq v+mLpG2fnL/2sIhg5HwXchrI90eVj3zrWEi05T5cQ1esIc8IoLTl6nGB9BplA0XqIqyv o5nT6puQcEyB7IcekFfnxHABcQeoykOX/66+iqcZNuxX10yQ9G2Xno3VYgIZm3/x9WVY Y7xxBPVGH30YCPOZunIAw7qA841E5UiftqNx+xuCV6b8XpLA8BirNmmAdfuxhjfEojOG SJRxkyG+OZfm7Or2GUOCYdTyVuMOcJuPSL63LXs+RCA2ztqLwdDIr9WuSwly3lSnfddX keTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b="m/wphk5u"; 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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b13si11511576ede.572.2021.10.01.06.44.51; Fri, 01 Oct 2021 06:45:16 -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=@suse.com header.s=susede1 header.b="m/wphk5u"; 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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231298AbhJAMZi (ORCPT + 99 others); Fri, 1 Oct 2021 08:25:38 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:56636 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231186AbhJAMZe (ORCPT ); Fri, 1 Oct 2021 08:25:34 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 0E7CB22644; Fri, 1 Oct 2021 12:23:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1633091029; h=from:from:reply-to: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=wtBZ7U5ewDlKJ28ZtqZTNSvN7kEYRmILRT2iVxUTj2c=; b=m/wphk5uR59ODqBgPtgUELkhpG+snjW4Ik51wxuXL7I+dgCA/YWVS6i8kfqV3u/+B2rFRf nuk6zDSKvhAs2QhrlRxWlDH53/17tz18jDnmmyRctW1FYjWNFKCdFZkZjrQGIpTzSWjafn dUFZjBihk0jDWceRW3LSio4aswzbFdw= Received: from suse.cz (pathway.suse.cz [10.100.12.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 799EFA3B81; Fri, 1 Oct 2021 12:23:48 +0000 (UTC) Date: Fri, 1 Oct 2021 14:23:48 +0200 From: Petr Mladek To: Alexander Popov Cc: "Paul E. McKenney" , Jonathan Corbet , Andrew Morton , Thomas Gleixner , Peter Zijlstra , Joerg Roedel , Maciej Rozycki , Muchun Song , Viresh Kumar , Robin Murphy , Randy Dunlap , Lu Baolu , Kees Cook , Luis Chamberlain , Wei Liu , John Ogness , Andy Shevchenko , Alexey Kardashevskiy , Christophe Leroy , Jann Horn , Greg Kroah-Hartman , Mark Rutland , Andy Lutomirski , Dave Hansen , Steven Rostedt , Will Deacon , David S Miller , Borislav Petkov , kernel-hardening@lists.openwall.com, linux-hardening@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, notify@kernel.org, Linus Torvalds , Dmitry Vyukov Subject: Re: [PATCH] Introduce the pkill_on_warn boot parameter Message-ID: <20211001122348.GB965@pathway.suse.cz> References: <20210929185823.499268-1-alex.popov@linux.com> <20210929194924.GA880162@paulmck-ThinkPad-P17-Gen-1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 2021-09-30 18:05:54, Alexander Popov wrote: > On 30.09.2021 12:15, Petr Mladek wrote: > > On Wed 2021-09-29 12:49:24, Paul E. McKenney wrote: > >> On Wed, Sep 29, 2021 at 10:01:33PM +0300, Alexander Popov wrote: > >>> This patch was tested using CONFIG_LKDTM. > >>> The kernel kills a process that performs this: > >>> echo WARNING > /sys/kernel/debug/provoke-crash/DIRECT > >>> > >>> If you are fine with this approach, I will prepare a patch adding the > >>> pkill_on_warn sysctl. > >> > >> I suspect that you need a list of kthreads for which you are better > >> off just invoking panic(). RCU's various kthreads, for but one set > >> of examples. > > > > I wonder if kernel could survive killing of any kthread. I have never > > seen a code that would check whether a kthread was killed and > > restart it. > > The do_group_exit() function calls do_exit() from kernel/exit.c, which is also > called during a kernel oops. This function cares about a lot of special cases > depending on the current task_struct. Is it fine? IMHO, the bigger problem is that nobody will start the kthreads again. As a result, some kernel functionality will not longer work. User space threads are different. The user/admin typically have a chance to start them again. We might get inspiration in OOM killer. It never kills kthreads and the init process, see oom_unkillable_task(). It would be better to panic() when WARN() is called from a kthread or the init process. Best Regards, Petr