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 2/2] exec: Avoid pathological argc, envc, and bprm->p values
Date: Fri, 21 Jun 2024 06:21:15 -0700 [thread overview]
Message-ID: <1f410012-bf41-4825-9a37-7b7cc7c1df76@roeck-us.net> (raw)
In-Reply-To: <202406202354.3020C4FCA4@keescook>
On 6/21/24 00:00, Kees Cook wrote:
> On Thu, Jun 20, 2024 at 05:19:55PM -0700, Guenter Roeck wrote:
>> Hi,
>>
>> On Sun, May 19, 2024 at 07:16:12PM -0700, Kees Cook wrote:
>>> Make sure nothing goes wrong with the string counters or the bprm's
>>> belief about the stack pointer. Add checks and matching self-tests.
>>>
>>> For 32-bit validation, this was run under 32-bit UML:
>>> $ tools/testing/kunit/kunit.py run --make_options SUBARCH=i386 exec
>>>
>>> Signed-off-by: Kees Cook <keescook@chromium.org>
>>
>> With this patch in linux-next, the qemu m68k:mcf5208evb emulation
>> fails to boot. The error is:
>
> Eeek. Thanks for the report! I've dropped this patch from my for-next
> tree.
>
>> Run /init as init process
>> Failed to execute /init (error -7)
>
> -7 is E2BIG, so it's certainly one of the 3 new added checks. I must
> have made a mistake in my reasoning about how bprm->p is initialized;
> the other two checks seems extremely unlikely to be tripped.
>
> I will try to get qemu set up and take a close look at what's happening.
> While I'm doing that, if it's easy for you, can you try it with just
> this removed (i.e. the other 2 new -E2BIG cases still in place):
>
> /* Avoid a pathological bprm->p. */
> if (bprm->p < limit)
> return -E2BIG;
I added a printk:
argc: 1 envc: 2 p: 262140 limit: 2097152
^^^^^^^^^^^^^^^^^^^^^^^^
Removing the check above does indeed fix the problem.
Guenter
next prev parent reply other threads:[~2024-06-21 13:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20240520021337.work.198-kees@kernel.org>
2024-05-20 2:16 ` [PATCH 1/2] exec: Add KUnit test for bprm_stack_limits() Kees Cook
2024-05-20 14:13 ` kernel test robot
2024-05-20 15:17 ` kernel test robot
2024-05-20 2:16 ` [PATCH 2/2] exec: Avoid pathological argc, envc, and bprm->p values Kees Cook
[not found] ` <fbc4e2e4-3ca2-45b7-8443-0a8372d4ba94@roeck-us.net>
2024-06-21 7:00 ` Kees Cook
2024-06-21 13:21 ` Guenter Roeck [this message]
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=1f410012-bf41-4825-9a37-7b7cc7c1df76@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