Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

panic: only warn about deprecated panic_print on write access

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.

Link: https://lkml.kernel.org/r/20260106163321.83586-1-gal@nvidia.com
Fixes: ee13240cd78b ("panic: add note that panic_print sysctl interface is deprecated")
Fixes: 2683df6539cb ("panic: add note that 'panic_print' parameter is deprecated")
Signed-off-by: Gal Pressman <gal@nvidia.com>
Reviewed-by: Mark Bloch <mbloch@nvidia.com>
Reviewed-by: Nimrod Oren <noren@nvidia.com>
Cc: Feng Tang <feng.tang@linux.alibaba.com>
Cc: Joel Granados <joel.granados@kernel.org>
Cc: Petr Mladek <pmladek@suse.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Gal Pressman and committed by
Andrew Morton
90f3c123 f9a49aa3

+2 -2
+2 -2
kernel/panic.c
··· 131 131 static int sysctl_panic_print_handler(const struct ctl_table *table, int write, 132 132 void *buffer, size_t *lenp, loff_t *ppos) 133 133 { 134 - panic_print_deprecated(); 134 + if (write) 135 + panic_print_deprecated(); 135 136 return proc_doulongvec_minmax(table, write, buffer, lenp, ppos); 136 137 } 137 138 ··· 1015 1014 1016 1015 static int panic_print_get(char *val, const struct kernel_param *kp) 1017 1016 { 1018 - panic_print_deprecated(); 1019 1017 return param_get_ulong(val, kp); 1020 1018 } 1021 1019