[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241121024112.GN3387508@ZenIV>
Date: Thu, 21 Nov 2024 02:41:12 +0000
From: Al Viro <viro@...iv.linux.org.uk>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Kees Cook <kees@...nel.org>, linux-kernel@...r.kernel.org,
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 Thu, Nov 21, 2024 at 02:36:19AM +0000, Al Viro wrote:
> On Wed, Nov 20, 2024 at 02:50:39PM -0800, Linus Torvalds wrote:
> > So you probably want to do something like
> >
> > const char *name = smp_load_acquire(&dentry->d_name.name);
> >
> > under the RCU read lock before then copying it with strscpy(). It
> > should always be NULL-terminated.
> >
> > If you want to be extra careful, you might surround it with a
> >
> > read_seqbegin_or_lock(&rename_lock, &seq);
>
> What for?
>
> char name[something];
>
> sprintf(name, "%*pD", sizeof(name) - 1, file);
>
> and be done with that...
... or
struct name_snapshot n;
take_dentry_name_snapshot(&n, file->f_path.dentry);
do_something(n.name.name);
release_dentry_name_snapshot(&n);
Powered by blists - more mailing lists