Commit 049439e2 authored by Nicolas Bouchinet's avatar Nicolas Bouchinet Committed by Joel Granados
Browse files

coredump: Fixes core_pipe_limit sysctl proc_handler



proc_dointvec converts a string to a vector of signed int, which is
stored in the unsigned int .data core_pipe_limit.
It was thus authorized to write a negative value to core_pipe_limit
sysctl which once stored in core_pipe_limit, leads to the signed int
dump_count check against core_pipe_limit never be true. The same can be
achieved with core_pipe_limit set to INT_MAX.

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.

This commit fixes this by changing core_pipe_limit sysctl's proc_handler
to proc_dointvec_minmax and bound checking between SYSCTL_ZERO and
SYSCTL_INT_MAX.

Fixes: a293980c ("exec: let do_coredump() limit the number of concurrent dumps to pipes")
Signed-off-by: default avatarNicolas Bouchinet <nicolas.bouchinet@ssi.gouv.fr>
Reviewed-by: default avatarJan Kara <jack@suse.cz>
Reviewed-by: default avatarKees Cook <kees@kernel.org>
Signed-off-by: default avatarJoel Granados <joel.granados@kernel.org>
parent dccf3c99
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment