Messages in this thread | | | Date | Sun, 25 Aug 2013 13:05:55 -0700 | Subject | Re: /proc/pid/fd && anon_inode_fops | From | Linus Torvalds <> |
| |
On Sun, Aug 25, 2013 at 12:48 PM, Oleg Nesterov <oleg@redhat.com> wrote: > > Or pid_revalidate(), but my concern is task_dumpable() logic. > > pid_revalidate() does inode->i_*id = GLOBAL_ROOT_*ID if task_dumpable() > fails, but it can fail simply because ->mm = NULL. > > This means that almost everything in /proc/zombie-pid/ becomes root. > Doesn't really hurt, but for what? Looks a bit strange imho.
The zombie case shouldn't be relevant, because a zombie will have closed all the file descriptors anyway, so they no longer exist.
That said, task_dumpable isn't wonderful, and I suspect we could drop that logic entirely in the tid-fd case if we just use f_cred.
The reason we have task_dumpable is exactly because we use the task credentials, and they may not really be relevant to the file credentials. IOW, it's there to protect against execve'ing a suid program that opens some protected file and then in setuid()'s back the the original user after having done the critical stuff. But file->f_cred is exactly about the credentials at the time of the open, so it should make things like that irrelevant.
Linus
| |