On 3/18/26 11:33, Kees Cook wrote:
On Mon, Mar 16, 2026 at 12:16:58PM -0700, Guenter Roeck wrote:
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 <[email protected]>
---
Cc: Eric Biederman <[email protected]>
Cc: Justin Stitt <[email protected]>
Cc: Alexander Viro <[email protected]>
Cc: Christian Brauner <[email protected]>
Cc: Jan Kara <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
...
+++ 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.
I ended up writing a test program.
#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