[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=whi+OgKMXoPQ+48i=_Cu_Yb5_QCv9U9+Wpg0-GumHZSXg@mail.gmail.com>
Date: Thu, 28 Nov 2024 20:44:11 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Al Viro <viro@...iv.linux.org.uk>
Cc: Kees Cook <kees@...nel.org>, linux-kernel@...r.kernel.org,
Christophe JAILLET <christophe.jaillet@...adoo.fr>, "Eric W. Biederman" <ebiederm@...ssion.com>,
Nir Lichtman <nir@...htman.org>, Tycho Andersen <tandersen@...flix.com>,
Vegard Nossum <vegard.nossum@...cle.com>
Subject: Re: [GIT PULL] execve updates for v6.13-rc1 (take 2)
On Thu, 28 Nov 2024 at 19:34, Al Viro <viro@...iv.linux.org.uk> wrote:
>
> Just one thing - IMO we want to use the relative pathname when it's
> not empty. Even in execveat()
Oh, absolutely agreed.
Good catch, because yes, I messed that part up in my suggested patch at
https://lore.kernel.org/all/CAHk-=wjF_09Z6vu7f8UAbQVDDoHnd-j391YpUxmBPLD=SKbKtQ@mail.gmail.com/
which did this dentry name thing for anything that used a base fd, but
yes, as you say, it should only do it when there is no name at all.
So instead of basing it (incorrectly) on that existing
if (fd == AT_FDCWD || filename->name[0] == '/') {
test, the logic should probably look something like
if (!filename->name[0]) {
rcu_read_lock();
strscpy(bprm->comm,
smp_load_acquire(&file->f_path.dentry->d_name.name));
rcu_read_unlock();
} else
strscpy(bprm->comm, kbasename(filename->name));
and it probably wouldn't be a bad idea to separate this out to be a
helper function that just does this one thing.
Linus
Powered by blists - more mailing lists