[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wgB1L75+C89AU62n4jBEiwKs=e4dvBDOoLQ13rUwJLFXQ@mail.gmail.com>
Date: Wed, 20 Nov 2024 14:32:44 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Kees Cook <kees@...nel.org>
Cc: linux-kernel@...r.kernel.org, Alexander Viro <viro@...iv.linux.org.uk>,
Christophe JAILLET <christophe.jaillet@...adoo.fr>, Dan Carpenter <dan.carpenter@...aro.org>,
"Eric W. Biederman" <ebiederm@...ssion.com>, Nir Lichtman <nir@...htman.org>,
syzbot+03e1af5c332f7e0eb84b@...kaller.appspotmail.com,
Tycho Andersen <tandersen@...flix.com>, Vegard Nossum <vegard.nossum@...cle.com>,
Zbigniew Jędrzejewski-Szmek <zbyszek@...waw.pl>
Subject: Re: [GIT PULL] execve updates for v6.13-rc1
On Tue, 19 Nov 2024 at 09:00, Kees Cook <kees@...nel.org> wrote:
>
> - exec: Use argv[0] for "comm" with AT_EMPTY_PATH (Tycho Andersen,
> Dan Carpenter, Nir Lichtman)
Ugh. I *really* despise this one.
People: we *have* a filename. It's right there in the dentry. Which is
right there as bprm->file->f_dentry.dentry.
And that's actually going to match the actual execcutable, unlike, for
example, argv[0], which can be filled in with random data.
*AND* we don't need any silly and expensive get_user_arg_ptr() and
strndup_user() copy for it, which does that user access twice.
And no, we shouldn't fall back to the horrid thing that bprm->fdpath
does either. That's the thing that you apparently thought was too ugly
to use, and literally the *only* use of it was for this case.
The reason that code existed at all was to generate a filename, and
because we didn't use to have access to the 'bprm->file' back in the
days.
But that was changed by commit 978ffcbf00d8 ("execve: open the
executable file before doing anything else").
So I really really think that what this code *should* have done is
- get rid of fdpath that you made pointless by not using it for 'comm[]'
- teach the code to use the dentry name instead
because this horrible hack is too broken to live.
Linus
Powered by blists - more mailing lists