Skip to content
This repository has been archived by the owner on Jun 20, 2022. It is now read-only.

Commit

Permalink
proc: don't allow async path resolution of /proc/self components
Browse files Browse the repository at this point in the history
[ Upstream commit 8d4c3e76e3be11a64df95ddee52e99092d42fc19 ]

If this is attempted by a kthread, then return -EOPNOTSUPP as we don't
currently support that. Once we can get task_pid_ptr() doing the right
thing, then this can go away again.

Signed-off-by: Jens Axboe <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
axboe authored and gregkh committed Dec 2, 2020
1 parent 22aaeae commit ebb83fd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions fs/proc/self.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ static const char *proc_self_follow_link(struct dentry *dentry, void **cookie)
pid_t tgid = task_tgid_nr_ns(current, ns);
char *name;

/*
* Not currently supported. Once we can inherit all of struct pid,
* we can allow this.
*/
if (current->flags & PF_KTHREAD)
return ERR_PTR(-EOPNOTSUPP);

if (!tgid)
return ERR_PTR(-ENOENT);
/* 11 for max length of signed int in decimal + NULL term */
Expand Down

0 comments on commit ebb83fd

Please sign in to comment.