summaryrefslogtreecommitdiff
path: root/fs/exec_test.c
diff options
context:
space:
mode:
authorKees Cook <kees@kernel.org>2024-06-21 23:50:43 +0300
committerKees Cook <kees@kernel.org>2024-07-14 07:31:57 +0300
commit084ebf7ca83e6cb743784f2eecc654193ce064fb (patch)
tree33cd2f226459837414b36dc3d34cb2d7ce056e0e /fs/exec_test.c
parent2a97388a807b6ab5538aa8f8537b2463c6988bd2 (diff)
downloadlinux-084ebf7ca83e6cb743784f2eecc654193ce064fb.tar.xz
execve: Keep bprm->argmin behind CONFIG_MMU
When argmin was added in commit 655c16a8ce9c ("exec: separate MM_ANONPAGES and RLIMIT_STACK accounting"), it was intended only for validating stack limits on CONFIG_MMU[1]. All checking for reaching the limit (argmin) is wrapped in CONFIG_MMU ifdef checks, though setting argmin was not. That argmin is only supposed to be used under CONFIG_MMU was rediscovered recently[2], and I don't want to trip over this again. Move argmin's declaration into the existing CONFIG_MMU area, and add helpers functions so the MMU tests can be consolidated. Link: https://lore.kernel.org/all/20181126122307.GA1660@redhat.com [1] Link: https://lore.kernel.org/all/202406211253.7037F69@keescook/ [2] Link: https://lore.kernel.org/r/20240621205046.4001362-1-kees@kernel.org Signed-off-by: Kees Cook <kees@kernel.org>
Diffstat (limited to 'fs/exec_test.c')
-rw-r--r--fs/exec_test.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/exec_test.c b/fs/exec_test.c
index 32a90c6f47e7..8fea0bf0b7f5 100644
--- a/fs/exec_test.c
+++ b/fs/exec_test.c
@@ -96,7 +96,9 @@ static void exec_test_bprm_stack_limits(struct kunit *test)
rc = bprm_stack_limits(&bprm);
KUNIT_EXPECT_EQ_MSG(test, rc, result->expected_rc, "on loop %d", i);
+#ifdef CONFIG_MMU
KUNIT_EXPECT_EQ_MSG(test, bprm.argmin, result->expected_argmin, "on loop %d", i);
+#endif
}
}