diff options
author | Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> | 2021-02-01 11:53:05 +0900 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-03-09 11:21:23 +0100 |
commit | a34b849b583582b54f17e3e682f7fc2c29ecb3d0 (patch) | |
tree | 2c44a8aa9ddfcbd262132e71494a9456def3e1b1 | |
parent | 8f7d495c1005f022b12bf5636cf241092d256d88 (diff) |
tomoyo: recognize kernel threads correctly
commit 9c83465f3245c2faa82ffeb7016f40f02bfaa0ad upstream.
Commit db68ce10c4f0a27c ("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 942cb357ae7d9249 ("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>
-rw-r--r-- | security/tomoyo/network.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/security/tomoyo/network.c b/security/tomoyo/network.c index a89ed55d85d4..478f757ff843 100644 --- a/security/tomoyo/network.c +++ b/security/tomoyo/network.c @@ -613,7 +613,7 @@ static int tomoyo_check_unix_address(struct sockaddr *addr, static bool tomoyo_kernel_service(void) { /* Nothing to do if I am a kernel service. */ - return uaccess_kernel(); + return (current->flags & (PF_KTHREAD | PF_IO_WORKER)) == PF_KTHREAD; } /** |