From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BCEF4C4332F for ; Wed, 29 Sep 2021 19:53:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 99FA360EE3 for ; Wed, 29 Sep 2021 19:53:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345636AbhI2TzH (ORCPT ); Wed, 29 Sep 2021 15:55:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235491AbhI2TzG (ORCPT ); Wed, 29 Sep 2021 15:55:06 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 458E7C06161C; Wed, 29 Sep 2021 12:53:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=hFOGKPuhhfj9xW2jOvQT+nHKqB9j9dqpkjZzQyMzNZA=; b=K2nrTG3EL0nN/zraOAxNEfggL3 ZYhqUqepv1ta3h4uZsqjlg/0fZuacEQEUAbxOtGaBpOctsemaHQhZCJVR/Q4wUMsopgTQe5k2Ao/r NSAelQStPA5CrdRxuiBXZC5yhCRvrNBE6DBpy2Rfp6cq4oTcLt6BYZprH+qoaR5LVDPU26EKQxOFv 694jxJgFnaNkRm25H57+eZVm5bysToxe7o/S9ScyfFMQZAc+uGUyxuKLYNqSRY7lbGzAESYupmfpy hI8Z+4BJXToUIq3yJQB6d4aJ62cwqm7GAwumMYoxEL6czAG0GJSR8PzxSYEL4umpUjsLvlG4fCljD uvbQWjHg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1mVfYF-00CB0j-R0; Wed, 29 Sep 2021 19:47:44 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id 54524981431; Wed, 29 Sep 2021 21:47:35 +0200 (CEST) Date: Wed, 29 Sep 2021 21:47:35 +0200 From: Peter Zijlstra To: Dave Hansen Cc: Alexander Popov , Jonathan Corbet , Paul McKenney , Andrew Morton , Thomas Gleixner , Joerg Roedel , Maciej Rozycki , Muchun Song , Viresh Kumar , Robin Murphy , Randy Dunlap , Lu Baolu , Petr Mladek , 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 , Thomas Garnier , Will Deacon , Ard Biesheuvel , Laura Abbott , 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 Subject: Re: [PATCH] Introduce the pkill_on_warn boot parameter Message-ID: <20210929194735.GB4323@worktop.programming.kicks-ass.net> References: <20210929185823.499268-1-alex.popov@linux.com> <323d0784-249d-7fef-6c60-e8426d35b083@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <323d0784-249d-7fef-6c60-e8426d35b083@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 29, 2021 at 12:03:36PM -0700, Dave Hansen wrote: > On 9/29/21 11:58 AM, Alexander Popov wrote: > > --- a/kernel/panic.c > > +++ b/kernel/panic.c > > @@ -53,6 +53,7 @@ static int pause_on_oops_flag; > > static DEFINE_SPINLOCK(pause_on_oops_lock); > > bool crash_kexec_post_notifiers; > > int panic_on_warn __read_mostly; > > +int pkill_on_warn __read_mostly; > > unsigned long panic_on_taint; > > bool panic_on_taint_nousertaint = false; > > > > @@ -610,6 +611,9 @@ void __warn(const char *file, int line, void *caller, unsigned taint, > > > > print_oops_end_marker(); > > > > + if (pkill_on_warn && system_state >= SYSTEM_RUNNING) > > + do_group_exit(SIGKILL); > > + > > /* Just a warning, don't kill lockdep. */ > > add_taint(taint, LOCKDEP_STILL_OK); > > } > > Doesn't this tie into the warning *printing* code? That's better than > nothing, for sure. But, if we're doing this for hardening, I think we > would want to kill anyone provoking a warning, not just the first one > that triggered *printing* the warning. Right, that would be lib/bug.c:report_bug(), for most archs I suppose.