Skip to content

Commit aa40f5e

Browse files
Tetsuo Handagregkh
authored andcommitted
tomoyo: recognize kernel threads correctly
commit 9c83465 upstream. Commit db68ce1 ("new helper: uaccess_kernel()") replaced segment_eq(get_fs(), KERNEL_DS) with uaccess_kernel(). But the correct method for tomoyo to check whether current is a kernel thread in order to assume that kernel threads are privileged for socket operations was (current->flags & PF_KTHREAD). Now that uaccess_kernel() became 0 on x86, tomoyo has to fix this problem. Do like commit 942cb35 ("Smack: Handle io_uring kernel thread privileges") does. Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 4645271 commit aa40f5e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎security/tomoyo/network.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ static int tomoyo_check_unix_address(struct sockaddr *addr,
613613
static bool tomoyo_kernel_service(void)
614614
{
615615
/* Nothing to do if I am a kernel service. */
616-
return uaccess_kernel();
616+
return (current->flags & (PF_KTHREAD | PF_IO_WORKER)) == PF_KTHREAD;
617617
}
618618

619619
/**

0 commit comments

Comments
 (0)