Re: question about commit "proc: make proc_fd_permission() thread-friendly"

From: Oleg Nesterov
Date: Mon Nov 02 2015 - 12:50:18 EST


Hi Jin,

(add lkml)

On 11/02, Jin, Yihua wrote:
>
> --- a/fs/proc/fd.c<http://kernel.suse.com/cgit/kernel/tree/fs/proc/fd.c?h=SLE12&id=a3c039929d01f793c47922017b6c0ae438e11598>
> +++ b/fs/proc/fd.c<http://kernel.suse.com/cgit/kernel/tree/fs/proc/fd.c?h=SLE12&id=96d0df79f2644fc823f26c06491e182d87a90c2a>
> @@ -286,7 +286,7 @@ int proc_fd_permission(struct inode *inode, int mask)
> 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;
> }
>
> I understand the intention is to make sub-thread access /proc/self/fd/ OK, however, after this commit, access /proc/<tid>/fd/ is denied if the process is non-dumpable.
>
> This make application in a delimma:
> Before your commit, application sub-thread can access /proc/<tid>/fd/, but not /proc/self/fd/, after your commit, application sub-thread can access /proc/self/fd/, but not /proc/<tid>/fd/.
> This make application impossible to adapt both to kernel before the commit and kernel after the commit.

Yes thanks... I'll try to think tomorrow.

Oleg.

--
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/