Re: [PATCH] proc: make proc_fd_permission() thread-friendly

From: Eric W. Biederman
Date: Mon Aug 26 2013 - 14:33:09 EST


Oleg Nesterov <oleg@xxxxxxxxxx> writes:

> proc_fd_permission() says "process can still access /proc/self/fd
> after it has executed a setuid()", but the "task_pid() = proc_pid()
> check only helps if the task is group leader, /proc/self points to
> /proc/leader-pid.
>
> Change this check to use task_tgid() so that the whole process can
> access /proc/self/fd.

There is at least a semantic goofiness here.

There is /proc/<tgid>/fd and /proc/<tgid>/task/<pid>/fd, and the same
permission check is used by both.

We might just want to have a /proc/thread symlink as well so people
don't have this issue. Of course that would require people to use it,
and I think the common case if people care is call gettid() and build
the path themselves.

Eric
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/