Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2698177ybb; Mon, 30 Mar 2020 11:08:03 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsJBqBhfml/wbg2Nc9xnFkxiZexUYPQhfmJUPwXJWUoRYk80+Ek1q/AINXYFSlSgORyuw8z X-Received: by 2002:a05:6830:4038:: with SMTP id i24mr329909ots.0.1585591683063; Mon, 30 Mar 2020 11:08:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585591683; cv=none; d=google.com; s=arc-20160816; b=fHKCIlh7JV71dMqTQUupVOix/Qjbz5ITjJ5LmTKv1fcquRwQGCR5X2gDrBXmUd2bL+ CIZ74QpCKoZPxWnF9CuxeIm0DSnEFBtnBa7SR/oIuKHT4kVWRX1tqNNWD+PNXndjKXEL nEgr6A1vPZxJIuqhl+AaJoCR8p37A8q1Hul43rVcEf2kdX3etiJLAq+JTCX2T/e531y2 FBk7ttRdF/rZVpTmy0RUsljMdemyqRWeTHIzYWM9sS8sVQrcN4rdIjLtLs4ahkLpXYVx rN+vhqYDjqCjgr9CfOaioQVpLVAKgikOGtg6ME05aiPcKtMqad7ikw6rC46Dbdfi5aIY 0/eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=JAZJzRt7fuqaSj+7HicEUO63r6qcWUEADIAna3qwLDs=; b=vYlMMRLMSWnDSivnwIkiyUFRLjrethMUkSTIoMMoHF0JBvr1o9APYmPS3MMLaKy2Cl YNrVakQf8Zm7cbC+mWW8H2FD1M2p9sHN4Vs+orEY8eTIzQVkYpiCexb1b2VSdMp+k8aV wGI2dQ5M9vrOnQr4ssQDxBEHqgw4OYPRk5cZmIpZBqk5F36reFlSRmvCGKBsg3fSV/tx X1OPiTWktjEL5tzxnwrCRef7aXT2BwsaYoblpwCTxya+qDOSC/cH3dkt57H7R7hYu9rC CLGqK+cYII/vpldtNzA98VNaJmxOoM6rFK7Mr2Yh+HrI9mAvJx+c7Y/gGyIJp26BW2Fw mHYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=dF49PPbE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id 141si5936821oii.44.2020.03.30.11.07.50; Mon, 30 Mar 2020 11:08:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=dF49PPbE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1729618AbgC3Rn3 (ORCPT + 99 others); Mon, 30 Mar 2020 13:43:29 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:40018 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727779AbgC3Rn2 (ORCPT ); Mon, 30 Mar 2020 13:43:28 -0400 Received: by mail-pg1-f196.google.com with SMTP id t24so8998852pgj.7 for ; Mon, 30 Mar 2020 10:43:28 -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=JAZJzRt7fuqaSj+7HicEUO63r6qcWUEADIAna3qwLDs=; b=dF49PPbEaBBAIakmxJGfH4zdz1EarD3UK9HHLVKkyMv3TfMpe6uEid/u1o00U8uISw +jMjg1dnPsE/lkzCZBlV3+UsnmQv7/ya8oEP7SuUFOX6Mqkgfo9AR7gsx4Inp4EDmhT/ Qzhi67TS9ZFS/EziBdF1M/V1cW2IN5FCwMU8c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=JAZJzRt7fuqaSj+7HicEUO63r6qcWUEADIAna3qwLDs=; b=OTmVJH+gD5UDFPws+vnZOFcyb+Hza1ujbcyA2uzokXKKt8uV/fXHUUZib2Q0V9z5M1 2ToJ0IT1+fdQfgOkRlPbmJS1kfYCLTzSkPH20whfQ9Fn4f1ohnY8DaBZgTXhnzdoz6Yb rOEy2J6OMimwSXdunfqax4uG+HfQP6YaMYYXWUMOMB+JbsyYZ86HKmAV3wYm9iNBr9n3 Use2Gz+jh9DlQZf4sOFDG2bfK9KuKPymWl4FgptItFX/X+sS9JCXRG1d5I6OtLwj1qhs voNQTMELqIXvlWrCvFdHUIfxTSU9M2pNRC38RF87v8fEgBgJJFEuyGpZCKPkdS7T1TfC ZxoA== X-Gm-Message-State: ANhLgQ3y3kg/LH3RecbS7BtNjV4T4hDBTGXK5CUJGW7jefEsx6NWSxYn 2LKOAssNc510d8Nr01hjmwl1BOC2WPA= X-Received: by 2002:a63:1862:: with SMTP id 34mr14099661pgy.191.1585590207804; Mon, 30 Mar 2020 10:43:27 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id k3sm10598303pfp.142.2020.03.30.10.43.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Mar 2020 10:43:27 -0700 (PDT) Date: Mon, 30 Mar 2020 10:43:26 -0700 From: Kees Cook To: Vlastimil Babka Cc: Luis Chamberlain , Iurii Zaikin , linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, linux-mm@kvack.org, Ivan Teterevkov , Michal Hocko , David Rientjes , Matthew Wilcox , "Eric W . Biederman" , "Guilherme G . Piccoli" , Alexey Dobriyan , Thomas Gleixner , Greg Kroah-Hartman , Christian Brauner Subject: Re: [PATCH 3/3] kernel/hung_task convert hung_task_panic boot parameter to sysctl Message-ID: <202003301042.97F3B00@keescook> References: <20200330115535.3215-1-vbabka@suse.cz> <20200330115535.3215-4-vbabka@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200330115535.3215-4-vbabka@suse.cz> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 30, 2020 at 01:55:35PM +0200, Vlastimil Babka wrote: > We can now handle sysctl parameters on kernel command line and have > infrastructure to convert legacy command line options that duplicate sysctl > to become a sysctl alias. > > This patch converts the hung_task_panic parameter. Note that the sysctl handler > is more strict and allows only 0 and 1, while the legacy parameter allowed > any non-zero value. But there is little reason anyone would not be using 1. > > Signed-off-by: Vlastimil Babka I'll let others double-check, but I think this change should be okay. If not, we can adjust the sysctl handler to accept an arbitrary int. Reviewed-by: Kees Cook -Kees > --- > Documentation/admin-guide/kernel-parameters.txt | 2 +- > fs/proc/proc_sysctl.c | 1 + > kernel/hung_task.c | 10 ---------- > 3 files changed, 2 insertions(+), 11 deletions(-) > > diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt > index 81ff626fc700..e0b8840404a1 100644 > --- a/Documentation/admin-guide/kernel-parameters.txt > +++ b/Documentation/admin-guide/kernel-parameters.txt > @@ -1457,7 +1457,7 @@ > [KNL] Should the hung task detector generate panics. > Format: > > - A nonzero value instructs the kernel to panic when a > + A value of 1 instructs the kernel to panic when a > hung task is detected. The default value is controlled > by the CONFIG_BOOTPARAM_HUNG_TASK_PANIC build-time > option. The value selected by this boot parameter can > diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c > index 97eb0b552bf8..77b1b844b02b 100644 > --- a/fs/proc/proc_sysctl.c > +++ b/fs/proc/proc_sysctl.c > @@ -1743,6 +1743,7 @@ struct sysctl_alias { > */ > static const struct sysctl_alias sysctl_aliases[] = { > {"numa_zonelist_order", "vm.numa_zonelist_order" }, > + {"hung_task_panic", "kernel.hung_task_panic" }, > { } > }; > > diff --git a/kernel/hung_task.c b/kernel/hung_task.c > index 14a625c16cb3..b22b5eeab3cb 100644 > --- a/kernel/hung_task.c > +++ b/kernel/hung_task.c > @@ -63,16 +63,6 @@ static struct task_struct *watchdog_task; > unsigned int __read_mostly sysctl_hung_task_panic = > CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE; > > -static int __init hung_task_panic_setup(char *str) > -{ > - int rc = kstrtouint(str, 0, &sysctl_hung_task_panic); > - > - if (rc) > - return rc; > - return 1; > -} > -__setup("hung_task_panic=", hung_task_panic_setup); > - > static int > hung_task_panic(struct notifier_block *this, unsigned long event, void *ptr) > { > -- > 2.25.1 > -- Kees Cook