Re: [PATCH 1/2] exec: Add KUnit test for bprm_stack_limits()
From: Guenter Roeck
Date: Wed Mar 18 2026 - 15:53:41 EST
On 3/18/26 11:33, Kees Cook wrote:
On Mon, Mar 16, 2026 at 12:16:58PM -0700, Guenter Roeck wrote:I ended up writing a test program.
Hi,
On Sun, May 19, 2024 at 07:16:11PM -0700, Kees Cook wrote:
Since bprm_stack_limits() operates with very limited side-effects, add...
it as the first exec.c KUnit test. Add to Kconfig and adjust MAINTAINERS
file to include it.
Tested on 64-bit UML:
$ tools/testing/kunit/kunit.py run exec
Signed-off-by: Kees Cook <keescook@xxxxxxxxxxxx>
---
Cc: Eric Biederman <ebiederm@xxxxxxxxxxxx>
Cc: Justin Stitt <justinstitt@xxxxxxxxxx>
Cc: Alexander Viro <viro@xxxxxxxxxxxxxxxxxx>
Cc: Christian Brauner <brauner@xxxxxxxxxx>
Cc: Jan Kara <jack@xxxxxxx>
Cc: linux-fsdevel@xxxxxxxxxxxxxxx
Cc: linux-mm@xxxxxxxxx
---
+++ b/fs/exec.c...
+ .expected_argmin = ULONG_MAX - (_STK_LIM / 4 * 3) + sizeof(void *) },^^^^^^
+ { { .p = ULONG_MAX, .rlim_stack.rlim_cur = 4 * (_STK_LIM / 4 * + sizeof(void *)),
Google's experimental AI review agent tagged the above change as syntactically wrong.
How does this even compile ?
Wow. I have no idea how this ever built either. I will get it fixed.
#define TESTVAL 10
...
long int x = TESTVAL / 4 * + sizeof(void *);
does build, as does
long int x = TESTVAL / 4 * - sizeof(void *);
or even
long int x = TESTVAL / 4 * 3 - - sizeof(void *);
long int x = TESTVAL / 4 * - - sizeof(void *);
It doesn't even have problems with
long int x = TESTVAL / 4 * - - + - + - sizeof(void *);
Weird. Looks like the compiler takes the "+" or "-" as sign value,
not as operator, and once can have as many of those as one desires.
Guenter