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 X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE1F4C2D0E5 for ; Mon, 30 Mar 2020 17:43:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6DF042082D for ; Mon, 30 Mar 2020 17:43:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="dF49PPbE" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729664AbgC3Rn3 (ORCPT ); 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-Google-Smtp-Source: ADFU+vsi0e3UarNlqpbTS7I7SsjeqBAthl6X9Kptox1ndXG/A6U3/rU8cIh4ts0jiI17uPGOP22EBQ== 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