[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aV3MWf005ja00BDU@U-2FWC9VHC-2323.local>
Date: Wed, 7 Jan 2026 11:00:41 +0800
From: Feng Tang <feng.tang@...ux.alibaba.com>
To: Gal Pressman <gal@...dia.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Petr Mladek <pmladek@...e.com>, linux-kernel@...r.kernel.org,
Mark Bloch <mbloch@...dia.com>, Nimrod Oren <noren@...dia.com>
Subject: Re: [PATCH] panic: only warn about deprecated panic_print on write
access
Hi Gal,
Thanks for the fix!
On Tue, Jan 06, 2026 at 06:33:21PM +0200, Gal Pressman wrote:
> The panic_print_deprecated() warning is being triggered on both read and
> write operations to the panic_print parameter.
>
> This causes spurious warnings when users run 'sysctl -a' to list all
> sysctl values, since that command reads /proc/sys/kernel/panic_print and
> triggers the deprecation notice.
>
> Modify the handlers to only emit the deprecation warning when the
> parameter is actually being set:
>
> - sysctl_panic_print_handler(): check 'write' flag before warning.
> - panic_print_get(): remove the deprecation call entirely.
>
> This way, users are only warned when they actively try to use the
> deprecated parameter, not when passively querying system state.
>
> Fixes: ee13240cd78b ("panic: add note that panic_print sysctl interface is deprecated")
> Fixes: 2683df6539cb ("panic: add note that 'panic_print' parameter is deprecated")
> Cc: Feng Tang <feng.tang@...ux.alibaba.com>
> Reviewed-by: Mark Bloch <mbloch@...dia.com>
> Reviewed-by: Nimrod Oren <noren@...dia.com>
> Signed-off-by: Gal Pressman <gal@...dia.com>
> ---
> kernel/panic.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/panic.c b/kernel/panic.c
> index 0d52210a9e2b..0c20fcaae98a 100644
> --- a/kernel/panic.c
> +++ b/kernel/panic.c
> @@ -131,7 +131,8 @@ static int proc_taint(const struct ctl_table *table, int write,
> static int sysctl_panic_print_handler(const struct ctl_table *table, int write,
> void *buffer, size_t *lenp, loff_t *ppos)
> {
> - panic_print_deprecated();
> + if (write)
> + panic_print_deprecated();
This makes sense to me, as 'sysctl -a' is a very common usage.
> return proc_doulongvec_minmax(table, write, buffer, lenp, ppos);
> }
>
> @@ -1014,7 +1015,6 @@ static int panic_print_set(const char *val, const struct kernel_param *kp)
>
> static int panic_print_get(char *val, const struct kernel_param *kp)
> {
> - panic_print_deprecated();
Actually this was intentional, in one of the patch version, this
panic_print_get() was not there but reusing the param_get_ulong().
It was added later as sometimes developer do want to runtime check
the current 'panic_print' setting through /sys/module/kernel/parameters/
interface, and I thought it may be better to give the warning.
Thanks,
Feng
> return param_get_ulong(val, kp);
> }
>
> --
> 2.40.1
Powered by blists - more mailing lists