Message ID | 20250115132211.25400-2-nicolas.bouchinet@clip-os.org (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Fixes multiple sysctl proc_handler usage error | expand |
On Wed, Jan 15, 2025 at 02:22:08PM +0100, nicolas.bouchinet@clip-os.org wrote: > Any negative write or >= to INT_MAX in core_pipe_limit sysctl would > hypothetically allow a user to create very high load on the system by > running processes that produces a coredump in case the core_pattern > sysctl is configured to pipe core files to user space helper. > Memory or PID exhaustion should happen before but it anyway breaks the > core_pipe_limit semantic. Isn't this true for "0" too (the default)? I'm not opposed to the change since it makes things more clear, but I don't think the >=INT_MAX problem is anything more than "functionally identical to 0". :) Reviewed-by: Kees Cook <kees@kernel.org>
On 1/16/25 1:32 AM, Kees Cook wrote: > On Wed, Jan 15, 2025 at 02:22:08PM +0100, nicolas.bouchinet@clip-os.org wrote: >> Any negative write or >= to INT_MAX in core_pipe_limit sysctl would >> hypothetically allow a user to create very high load on the system by >> running processes that produces a coredump in case the core_pattern >> sysctl is configured to pipe core files to user space helper. >> Memory or PID exhaustion should happen before but it anyway breaks the >> core_pipe_limit semantic. > Isn't this true for "0" too (the default)? I'm not opposed to the change > since it makes things more clear, but I don't think the >=INT_MAX > problem is anything more than "functionally identical to 0". :) Uhm, I think your right, its seems to be functionally identical. 0 codepath slightly differs from > 0 though since it won't trigger wait_for_dump_helpers(). Thanks for your review, Nicolas > > Reviewed-by: Kees Cook <kees@kernel.org> >
diff --git a/fs/coredump.c b/fs/coredump.c index d48edb37bc35c..9239636b8812a 100644 --- a/fs/coredump.c +++ b/fs/coredump.c @@ -1015,7 +1015,9 @@ static struct ctl_table coredump_sysctls[] = { .data = &core_pipe_limit, .maxlen = sizeof(unsigned int), .mode = 0644, - .proc_handler = proc_dointvec, + .proc_handler = proc_dointvec_minmax, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_INT_MAX, }, { .procname = "core_file_note_size_limit",