Re: [GIT PULL] execve updates for v6.13-rc1
From: Linus Torvalds
Date: Wed Nov 20 2024 - 21:51:44 EST
On Wed, 20 Nov 2024 at 18:36, Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
> > If you want to be extra careful, you might surround it with a
> >
> > read_seqbegin_or_lock(&rename_lock, &seq);
>
> What for?
Yeah, probably no good reason.
> char name[something];
>
> sprintf(name, "%*pD", sizeof(name) - 1, file);
>
> and be done with that...
I think you might as well just do the much cheaper
rcu_read_lock();
strscpy_pad(tsk->comm, sizeof(tsk->comm),
smp_read_acquire(&dentry->d_name.name);
rcu_read_unlock();
and be done with it. Using snprintf() on tsk->comm[] violates all the
rules we have for it, and while our rules aren't great, *that* one we
shouldn't do.
Linus