aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arc/configs/vdk_hs38_defconfig
diff options
context:
space:
mode:
authorChristian Brauner <christian@brauner.io>2019-03-07 16:29:40 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2019-03-07 18:32:02 -0800
commit7f2923c4f73f21cfd714d12a2d48de8c21f11cfe (patch)
treedecf5eb1e244a09fc561e85e2377d32af787cf1c /arch/arc/configs/vdk_hs38_defconfig
parentrapidio/mport_cdev: mark expected switch fall-through (diff)
downloadlinux-dev-7f2923c4f73f21cfd714d12a2d48de8c21f11cfe.tar.xz
linux-dev-7f2923c4f73f21cfd714d12a2d48de8c21f11cfe.zip
sysctl: handle overflow in proc_get_long
proc_get_long() is a funny function. It uses simple_strtoul() and for a good reason. proc_get_long() wants to always succeed the parse and return the maybe incorrect value and the trailing characters to check against a pre-defined list of acceptable trailing values. However, simple_strtoul() explicitly ignores overflows which can cause funny things like the following to happen: echo 18446744073709551616 > /proc/sys/fs/file-max cat /proc/sys/fs/file-max 0 (Which will cause your system to silently die behind your back.) On the other hand kstrtoul() does do overflow detection but does not return the trailing characters, and also fails the parse when anything other than '\n' is a trailing character whereas proc_get_long() wants to be more lenient. Now, before adding another kstrtoul() function let's simply add a static parse strtoul_lenient() which: - fails on overflow with -ERANGE - returns the trailing characters to the caller The reason why we should fail on ERANGE is that we already do a partial fail on overflow right now. Namely, when the TMPBUFLEN is exceeded. So we already reject values such as 184467440737095516160 (21 chars) but accept values such as 18446744073709551616 (20 chars) but both are overflows. So we should just always reject 64bit overflows and not special-case this based on the number of chars. Link: http://lkml.kernel.org/r/20190107222700.15954-2-christian@brauner.io Signed-off-by: Christian Brauner <christian@brauner.io> Acked-by: Kees Cook <keescook@chromium.org> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Luis Chamberlain <mcgrof@kernel.org> Cc: Joe Lawrence <joe.lawrence@redhat.com> Cc: Waiman Long <longman@redhat.com> Cc: Dominik Brodowski <linux@dominikbrodowski.net> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/arc/configs/vdk_hs38_defconfig')
0 files changed, 0 insertions, 0 deletions