]> Git Repo - linux.git/commitdiff
Smack: Handle io_uring kernel thread privileges
authorCasey Schaufler <[email protected]>
Tue, 22 Dec 2020 23:34:24 +0000 (15:34 -0800)
committerCasey Schaufler <[email protected]>
Tue, 22 Dec 2020 23:34:24 +0000 (15:34 -0800)
Smack assumes that kernel threads are privileged for smackfs
operations. This was necessary because the credential of the
kernel thread was not related to a user operation. With io_uring
the credential does reflect a user's rights and can be used.

Suggested-by: Jens Axboe <[email protected]>
Acked-by: Jens Axboe <[email protected]>
Acked-by: Eric W. Biederman <[email protected]>
Signed-off-by: Casey Schaufler <[email protected]>
security/smack/smack_access.c

index efe2406a39609d12d085b049c035e8af0f93e742..7eabb448acab4235808e11d0ae15c3ededfca9b1 100644 (file)
@@ -688,9 +688,10 @@ bool smack_privileged_cred(int cap, const struct cred *cred)
 bool smack_privileged(int cap)
 {
        /*
-        * All kernel tasks are privileged
+        * Kernel threads may not have credentials we can use.
+        * The io_uring kernel threads do have reliable credentials.
         */
-       if (unlikely(current->flags & PF_KTHREAD))
+       if ((current->flags & (PF_KTHREAD | PF_IO_WORKER)) == PF_KTHREAD)
                return true;
 
        return smack_privileged_cred(cap, current_cred());
This page took 0.057788 seconds and 4 git commands to generate.