Skip to content

Commit 13fb0e1

Browse files
axboegregkh
authored andcommitted
proc: don't allow async path resolution of /proc/thread-self components
commit 0d4370c upstream. If this is attempted by an io-wq 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. Use PF_IO_WORKER for this to speciically target the io_uring workers. Modify the /proc/self/ check to use PF_IO_WORKER as well. Cc: stable@vger.kernel.org Fixes: 8d4c3e7 ("proc: don't allow async path resolution of /proc/self components") Reported-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent b7cd971 commit 13fb0e1

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

‎fs/proc/self.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ static const char *proc_self_get_link(struct dentry *dentry,
2020
* Not currently supported. Once we can inherit all of struct pid,
2121
* we can allow this.
2222
*/
23-
if (current->flags & PF_KTHREAD)
23+
if (current->flags & PF_IO_WORKER)
2424
return ERR_PTR(-EOPNOTSUPP);
2525

2626
if (!tgid)

‎fs/proc/thread_self.c‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ static const char *proc_thread_self_get_link(struct dentry *dentry,
1717
pid_t pid = task_pid_nr_ns(current, ns);
1818
char *name;
1919

20+
/*
21+
* Not currently supported. Once we can inherit all of struct pid,
22+
* we can allow this.
23+
*/
24+
if (current->flags & PF_IO_WORKER)
25+
return ERR_PTR(-EOPNOTSUPP);
26+
2027
if (!pid)
2128
return ERR_PTR(-ENOENT);
2229
name = kmalloc(10 + 6 + 10 + 1, dentry ? GFP_KERNEL : GFP_ATOMIC);

0 commit comments

Comments
 (0)