Messages in this thread | | | Date | Wed, 8 Dec 2021 09:49:17 -1000 | From | Tejun Heo <> | Subject | Re: [PATCH] exit: Retain nsproxy for exit_task_work() work entries |
| |
Hello,
On Wed, Dec 08, 2021 at 11:39:43AM -0800, Linus Torvalds wrote: > (b) alternatively, go ahead and do the permission check at IO time, > but do it using "file->f_cred" (ie the open-time permission), not the > current process ones. > > In the above, (a) and (b) are basically the same: it uses f_cred for > permission checking. The only difference is that in (a) you may be > using some function that _technically_ uses the implicit "current > credentials" (there are many of them), and you just separately make > sure that those current credentials are identical to what they were at > open time. > > Obviously (b) is hugely preferred, but sometimes the code organization > (ie "file or f_cred just isn't passed down deep enough") means that > (a) might be the only realistic option. > > IOW, it's not *wrong* to do permission checking at IO time, but it > absolutely needs to be done using the open-time credentials.
Yeah, (b) sounds good to me. Will look into it.
Thanks.
-- tejun
| |