Revert "Smack: Handle io_uring kernel thread privileges"
Subsystems (2)
PATCH 1/1 Revert "Smack: Handle io_uring kernel thread privileges"
This reverts commit 942cb357ae7d9249088e3687ee6a00ed2745a0c7.
The io_uring PF_IO_WORKER threads no longer have PF_KTHREAD set, so no need to special case them for credential checks.
--- security/smack/smack_access.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
security/smack/smack_access.c +2 -3
@@ -688,10 +688,9 @@ bool smack_privileged_cred(int cap, const struct cred *cred)bool smack_privileged (int cap) {/* -* Kernel threads may not have credentials we can use. -* The io_uring kernel threads do have reliable credentials. +* All kernel tasks are privileged */ -if ((current->flags & (PF_KTHREAD |PF_IO_WORKER )) ==PF_KTHREAD ) +if (unlikely (current->flags &PF_KTHREAD ))return true;return smack_privileged_cred (cap,current_cred ());
Signature · 4 lines
2.31.0 -- Jens Axboe
Casey Schaufler
maintainerQuoted 4 lines · Jens Axboe
This reverts commit
942cb357ae7d9249088e3687ee6a00ed2745a0c7.The
io_uringPF_IO_WORKERthreads no longer havePF_KTHREADset, so no need to special case them for credential checks.
Could you cite the commit making that change?
I wouldn't want to see this change back-ported to a kernel that doesn't have that change as well.
Quoted 24 lines
Cc Casey Schaufler <[email protected]>Signed-off-by Jens Axboe <[email protected]>--- security/smack/smack_access.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)security/smack/smack_access.c +2
-3@@ -688,10 +688,9 @@ bool smack_privileged_cred(int cap, const struct cred *cred)bool smack_privileged (int cap) {/* -* Kernel threads may not have credentials we can use. -* The io_uring kernel threads do have reliable credentials. +* All kernel tasks are privileged */ -if ((current->flags & (PF_KTHREAD |PF_IO_WORKER )) ==PF_KTHREAD ) +if (unlikely (current->flags &PF_KTHREAD ))return true;return smack_privileged_cred (cap,current_cred ());
Quoted 9 lines · Casey Schaufler
Quoted 4 lines · Jens Axboe
This reverts commit
942cb357ae7d9249088e3687ee6a00ed2745a0c7.The
io_uringPF_IO_WORKERthreads no longer havePF_KTHREADset, so no need to special case them for credential checks.Could you cite the commit making that change?
I wouldn't want to see this change back-ported to a kernel that doesn't have that change as well.
This is strictly 5.12+. The change came about from:
commit 3bfe6106693b6b4ba175ad1f929c4660b8f59ca8
Author: Jens Axboe <[email protected]> Date: Tue Feb 16 14:15:30 2021 -0700
io-wq: fork worker threads from original task
So don't backport it.
Signature · 1 line
Jens Axboe
Casey Schaufler
maintainerQuoted 7 lines · Jens Axboe
This reverts commit
942cb357ae7d9249088e3687ee6a00ed2745a0c7.The
io_uringPF_IO_WORKERthreads no longer havePF_KTHREADset, so no need to special case them for credential checks.Cc Casey Schaufler <[email protected]>Signed-off-by Jens Axboe <[email protected]>
I have added this to smack-next. Thank you.
Quoted 21 lines
--- security/smack/smack_access.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)security/smack/smack_access.c +2
-3@@ -688,10 +688,9 @@ bool smack_privileged_cred(int cap, const struct cred *cred)bool smack_privileged (int cap) {/* -* Kernel threads may not have credentials we can use. -* The io_uring kernel threads do have reliable credentials. +* All kernel tasks are privileged */ -if ((current->flags & (PF_KTHREAD |PF_IO_WORKER )) ==PF_KTHREAD ) +if (unlikely (current->flags &PF_KTHREAD ))return true;return smack_privileged_cred (cap,current_cred ());