[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wgLSHFvUhf7J5aJuuWpkW7vayoHjmtbnY1HZZvT361uxA@mail.gmail.com>
Date: Fri, 22 Nov 2024 22:09:04 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Amir Goldstein <amir73il@...il.com>
Cc: Miklos Szeredi <miklos@...redi.hu>, Christian Brauner <brauner@...nel.org>, linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org, linux-unionfs@...r.kernel.org
Subject: Re: [GIT PULL] overlayfs updates for 6.13
On Fri, 22 Nov 2024 at 21:21, Linus Torvalds
<torvalds@...ux-foundation.org> wrote:
>
> So may I ask that you look at perhaps just converting the (not very
> many) users of the non-light cred override to the "light" version?
I think you could do a completely automated conversion:
(a) add a new "dup_cred()" helper
/* Get the cred without clearing the 'non_rcu' flag */
const struct cred *dup_cred(const struct cred *cred)
{ get_new_cred((struct cred *)cred); return cred; }
(b) mindlessly convert:
override_creds(cred) -> override_creds_light(dup_cred(cred))
revert_creds(cred) -> put_cred(revert_creds_light(old));
(c) rename away the "_light" again:
override_creds_light -> override_creds
revert_creds_light -> revert_creds
and then finally the only non-automated part would be
(d) simplify any obvious and trivial dup_cred -> put_cred chains.
which might take some effort, but there should be at least a couple of
really obvious cases of "that's not necessary".
Because honestly, I think I'd rather see a few cases of
old_creds = override_creds(dup_cred(cred));
...
put_cred(revert_creds(old));
that look a bit more complicated, and couldn't be trivially simplified away.
That seems better than the current case of having two very different
forms of override_creds() / put_cred() where people have to know
deeply when to use one or the other.
No?
Linus
Powered by blists - more mailing lists