mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-15 08:44:14 +08:00
Smack: Handle io_uring kernel thread privileges
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 <axboe@kernel.dk> Acked-by: Jens Axboe <axboe@kernel.dk> Acked-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
This commit is contained in:
parent
9b0072e2b2
commit
942cb357ae
@ -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());
|
||||
|
Loading…
Reference in New Issue
Block a user