From: Guenter Roeck <linux@roeck-us.net>
To: Kees Cook <kees@kernel.org>
Cc: Eric Biederman <ebiederm@xmission.com>,
Justin Stitt <justinstitt@google.com>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: [PATCH 1/2] exec: Add KUnit test for bprm_stack_limits()
Date: Wed, 18 Mar 2026 12:50:23 -0700 [thread overview]
Message-ID: <cce7a4aa-0786-4c55-afcd-4816f977806a@roeck-us.net> (raw)
In-Reply-To: <202603181132.507C829A9@keescook>
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 <keescook@chromium.org>
>>> ---
>>> Cc: Eric Biederman <ebiederm@xmission.com>
>>> Cc: Justin Stitt <justinstitt@google.com>
>>> Cc: Alexander Viro <viro@zeniv.linux.org.uk>
>>> Cc: Christian Brauner <brauner@kernel.org>
>>> Cc: Jan Kara <jack@suse.cz>
>>> Cc: linux-fsdevel@vger.kernel.org
>>> Cc: linux-mm@kvack.org
>>> ---
>> ...
>>> +++ 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
next prev parent reply other threads:[~2026-03-18 19:50 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-20 2:16 [PATCH 0/2] exec: Add KUnit test for bprm_stack_limits() Kees Cook
2024-05-20 2:16 ` [PATCH 1/2] " Kees Cook
2024-05-20 14:13 ` kernel test robot
2024-05-20 15:17 ` kernel test robot
2026-03-16 19:16 ` Guenter Roeck
2026-03-18 18:33 ` Kees Cook
2026-03-18 19:50 ` Guenter Roeck [this message]
2024-05-20 2:16 ` [PATCH 2/2] exec: Avoid pathological argc, envc, and bprm->p values Kees Cook
2024-06-21 0:19 ` Guenter Roeck
2024-06-21 7:00 ` Kees Cook
2024-06-21 13:21 ` Guenter Roeck
2024-06-21 19:54 ` Kees Cook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cce7a4aa-0786-4c55-afcd-4816f977806a@roeck-us.net \
--to=linux@roeck-us.net \
--cc=brauner@kernel.org \
--cc=ebiederm@xmission.com \
--cc=jack@suse.cz \
--cc=justinstitt@google.com \
--cc=kees@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox