On 08/26, Oleg Nesterov wrote:
>
> Not sure we really want this in this case but
>
>       $ ./ls /proc/self/fd
>       0  1  2  3
>
> still works, I guess thanks to proc_fd_permission().

And btw. Whatever we do, shouldn't we change proc_fd_permission()?

/proc/self is actually /proc/tgid, this means that the task_pid()
check can't help if a sub-thread uses /proc/self.

Oleg.

--- x/fs/proc/fd.c
+++ x/fs/proc/fd.c
@@ -288,7 +288,7 @@ int proc_fd_permission(struct inode *ino
        int rv = generic_permission(inode, mask);
        if (rv == 0)
                return 0;
-       if (task_pid(current) == proc_pid(inode))
+       if (task_tgid(current) == proc_pid(inode))
                rv = 0;
        return rv;
 }

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

Reply via email to