Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp945867pxb; Wed, 29 Sep 2021 13:10:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJziCgV0KGHk4r3ZYYAUmgLM+gKgaJxGPWlZ4M49IaHencQEGzsnUbf8kSQ9jXt7YRaipc27 X-Received: by 2002:a17:902:650f:b0:13e:55a1:b395 with SMTP id b15-20020a170902650f00b0013e55a1b395mr314164plk.69.1632946237372; Wed, 29 Sep 2021 13:10:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632946237; cv=none; d=google.com; s=arc-20160816; b=XEVTa/evYsAFTt0yC0/eXl2YPCmSMkH/D/mFysoeZMmpTuA1d4W6mxja9/qu/iOJVy 5bYfJ6wMLT33/zZ6MJriDuorK71UTuKUmWogTP1+mqxYhtCZiFHNVnbQ3M8l4vLxSpcU kcoAk0Wb7N3LojwzlISzz66I3/Zsoc39uMd410lQ/jjWrUouD5n1hFmA7rHxX+erwoOf DmOn/CnSkwhlW1xK793pfyiWl1gXEvGZUN+LDFGRs40yoVSchii+56hQQHVIn85C7iBr uC2NzFCOjA/LfbKuH9Z1EL0kPzKuMkHAdFQNKkW6UyhNVaNG4qFAQkxmYYpN8IWcjtn3 YfdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Qh2eW8LeGi3ecsaiI+luhmjw9dtB3ilPhgER4eDq8qA=; b=BYewsl2b5wN20SMTfDwSfPpPdOOo5YEAIfVbCY8r7OjrVPvOcGCi6KVr7y4B6HgUHo F3f3YY2H88xxayRt2zNN1JRFUVi6bUEoT9uTSGnzCjwth0BOwSDIOzgocvtlPr3Vr5NV AdDV49l18LGvLYfIRM3Dc6ZJtmKVCXzdPYig1P0Or9hDpQEJR7OAzWFyJwdUm9YzapAz 2HRwLJByls9hWz1TK+s78sZAizBEk+JYE1YBiApbom4RJrD59q40WiZfoYXJVc4AvBqj onbcBigmYRjKYnws7OvN1tR/nU/a1RZUloErX8Z2dbUFtB3kOqvfFI+nEEgl6U9OVLJH XRjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=em8dv1Ox; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c3si1027932pjd.126.2021.09.29.13.10.19; Wed, 29 Sep 2021 13:10:37 -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=@chromium.org header.s=google header.b=em8dv1Ox; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346478AbhI2UI4 (ORCPT + 99 others); Wed, 29 Sep 2021 16:08:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346499AbhI2UIm (ORCPT ); Wed, 29 Sep 2021 16:08:42 -0400 Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F1F7C061769 for ; Wed, 29 Sep 2021 13:07:01 -0700 (PDT) Received: by mail-pg1-x531.google.com with SMTP id n18so3823579pgm.12 for ; Wed, 29 Sep 2021 13:07:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Qh2eW8LeGi3ecsaiI+luhmjw9dtB3ilPhgER4eDq8qA=; b=em8dv1OxQ3CY+GjWZuXKn0XD1KUyGIXo6JnSL4zsriDxpYcBDGVUun35YA90hQEmqi nwnf+rGGPeAbcI0LGWcU/iRdas6o494V9gL/n1Kj9aPw+qTvvWnajAqipmtpl+24cqYw Xugl3+HDyMIjT8JAMNMYddsZljPijTLJsX6bc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Qh2eW8LeGi3ecsaiI+luhmjw9dtB3ilPhgER4eDq8qA=; b=td5sQqq+3etowEoJ7xGhyRsCuwUH6LR/FgCLx7qClHniskAQz6u0+hNO7OqWsYSC+5 8/O6j9KZqb+sbkLb6FulGhfIqVIx3ugduIKbjrFTS6A7EcHtE5C38QOdU9dUX7G+5Gnl AfpQLuuQwuwzNZFe76HtixqyF96P6sXyWbIuVQ9lyUfbhdpAaUTrD3FefklBiwnIrv4c m7qJ7fFuJWDFghUJujipRA8uOG+JHEe70PFDPaZpZ+hXdQ6vIggtjOgyNUVMXOEeP0r8 n9PPUasR09QOMdyqyBCWKYReRsoZ47l6+MQjEq1U8eZVhjcY9H77IGVsjchvmZgETt/p Jqfg== X-Gm-Message-State: AOAM533U9Ev0ym5Tg3q2tHt9yP+oJJH1+9JS15m4RucmuN3x/50B0aFk 1aMMk/QfNUOqfldVPm8OzirjKA== X-Received: by 2002:aa7:9846:0:b0:444:5517:fa17 with SMTP id n6-20020aa79846000000b004445517fa17mr494981pfq.85.1632946020896; Wed, 29 Sep 2021 13:07:00 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id r23sm2773788pjo.3.2021.09.29.13.06.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 13:07:00 -0700 (PDT) Date: Wed, 29 Sep 2021 13:06:59 -0700 From: Kees Cook To: Dave Hansen Cc: Alexander Popov , Jonathan Corbet , Paul McKenney , Andrew Morton , Thomas Gleixner , Peter Zijlstra , Joerg Roedel , Maciej Rozycki , Muchun Song , Viresh Kumar , Robin Murphy , Randy Dunlap , Lu Baolu , Petr Mladek , 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: <202109291229.C64A1D9D@keescook> 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; I like this idea. I can't tell if Linus would tolerate it, though. But I really have wanted a middle ground like BUG(). Having only WARN() and panic() is not very friendly. :( > > 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, this needs to be moved into the callers of __warn() (i.e. report_bug(), and warn_slowpath_fmt()), likely with some small refactoring in report_bug(). -- Kees Cook