Re: [PATCH] fs/coredump: reduce redundant log noise in validate_coredump_safety

Christian Brauner
2026-04-22T12:44:15Z

On Fri, Apr 10, 2026 at 04:09:18AM -0400, lirongqing wrote:
> From: Li RongQing <lirongqing@baidu.com>
>
> Currently, writing to 'core_pattern' or 'suid_dumpable' sysctl nodes
> always triggers validate_coredump_safety(), even if the values have
> not changed. This results in redundant warning messages in dmesg:
>
> "Unsafe core_pattern used with fs.suid_dumpable=2..."
>
> This patch optimizes the procfs handlers to only invoke the safety
> validation when an actual change in the configuration is detected:
>
> 1. In proc_dostring_coredump(), compare the new core_pattern string
> with the existing one using strncmp().
> 2. In proc_dointvec_minmax_coredump(), check if the new suid_dumpable
> value differs from the previous one.
>
> This keeps the kernel log clean from repetitive warnings when
> re-applying the same sysctl settings.
>
> Signed-off-by: Li RongQing <lirongqing@baidu.com>
> ---

That warning should very much serve as a reminder to not use that
completely unsafe pattern. So no, move to newer coredump infra or use
absolute paths, please.