path: root/fs/proc/base.c
diff options
authorLinus Torvalds <>2021-06-15 09:26:19 -0700
committerLinus Torvalds <>2021-06-15 10:47:51 -0700
commit94f0b2d4a1d0c52035aef425da5e022bd2cb1c71 (patch)
treea646956edefb55000e34cf429e75add7b32f0367 /fs/proc/base.c
parenta33d62662d275cee22888fa7760fe09d5b9cd1f9 (diff)
proc: only require mm_struct for writing
Commit 591a22c14d3f ("proc: Track /proc/$pid/attr/ opener mm_struct") we started using __mem_open() to track the mm_struct at open-time, so that we could then check it for writes. But that also ended up making the permission checks at open time much stricter - and not just for writes, but for reads too. And that in turn caused a regression for at least Fedora 29, where NIC interfaces fail to start when using NetworkManager. Since only the write side wanted the mm_struct test, ignore any failures by __mem_open() at open time, leaving reads unaffected. The write() time verification of the mm_struct pointer will then catch the failure case because a NULL pointer will not match a valid 'current->mm'. Link: Fixes: 591a22c14d3f ("proc: Track /proc/$pid/attr/ opener mm_struct") Reported-and-tested-by: Leon Romanovsky <> Cc: Kees Cook <> Cc: Christian Brauner <> Cc: Andrea Righi <> Signed-off-by: Linus Torvalds <>
Diffstat (limited to 'fs/proc/base.c')
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 7118ebe38fa6..9cbd915025ad 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -2676,7 +2676,9 @@ out:
static int proc_pid_attr_open(struct inode *inode, struct file *file)
- return __mem_open(inode, file, PTRACE_MODE_READ_FSCREDS);
+ file->private_data = NULL;
+ __mem_open(inode, file, PTRACE_MODE_READ_FSCREDS);
+ return 0;
static ssize_t proc_pid_attr_read(struct file * file, char __user * buf,