]> www.infradead.org Git - users/jedix/linux-maple.git/commit
exec: Avoid pathological argc, envc, and bprm->p values
authorKees Cook <kees@kernel.org>
Fri, 21 Jun 2024 20:50:44 +0000 (13:50 -0700)
committerKees Cook <kees@kernel.org>
Sun, 14 Jul 2024 04:31:58 +0000 (21:31 -0700)
commit21f93108306026b8066db31c24a097192c8c36c7
treeeeab89c91b56534dfc7af8dcbc048a6a30677d39
parent084ebf7ca83e6cb743784f2eecc654193ce064fb
exec: Avoid pathological argc, envc, and bprm->p values

Make sure nothing goes wrong with the string counters or the bprm's
belief about the stack pointer. Add checks and matching self-tests.

Take special care for !CONFIG_MMU, since argmin is not exposed there.

For 32-bit validation, 32-bit UML was used:
$ tools/testing/kunit/kunit.py run \
--make_options CROSS_COMPILE=i686-linux-gnu- \
--make_options SUBARCH=i386 \
exec

For !MMU validation, m68k was used:
$ tools/testing/kunit/kunit.py run \
--arch m68k --make_option CROSS_COMPILE=m68k-linux-gnu- \
exec

Link: https://lore.kernel.org/r/20240520021615.741800-2-keescook@chromium.org
Link: https://lore.kernel.org/r/20240621205046.4001362-2-kees@kernel.org
Signed-off-by: Kees Cook <kees@kernel.org>
fs/exec.c
fs/exec_test.c