diff options
author | Jens Axboe <axboe@kernel.dk> | 2020-10-15 13:46:44 -0600 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2020-10-17 09:25:47 -0600 |
commit | 4ea33a976bfe79293965d0815e1914e4b6e58967 (patch) | |
tree | e041b64e9f8841fdbaf28120171f32c64f42247b /fs/proc/base.c | |
parent | d8a6df10aac9f2e4d5f30aff3129d552d2984ce7 (diff) | |
download | lwn-4ea33a976bfe79293965d0815e1914e4b6e58967.tar.gz lwn-4ea33a976bfe79293965d0815e1914e4b6e58967.zip |
io-wq: inherit audit loginuid and sessionid
Make sure the async io-wq workers inherit the loginuid and sessionid from
the original task, and restore them to unset once we're done with the
async work item.
While at it, disable the ability for kernel threads to write to their own
loginuid.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/proc/base.c')
-rw-r--r-- | fs/proc/base.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index aa69c35d904c..0f707003dda5 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -1268,6 +1268,10 @@ static ssize_t proc_loginuid_write(struct file * file, const char __user * buf, kuid_t kloginuid; int rv; + /* Don't let kthreads write their own loginuid */ + if (current->flags & PF_KTHREAD) + return -EPERM; + rcu_read_lock(); if (current != pid_task(proc_pid(inode), PIDTYPE_PID)) { rcu_read_unlock(); |