OSDN Git Service

x86/fault: Don't send SIGSEGV twice on SEGV_PKUERR
authorJiashuo Liang <liangjs@pku.edu.cn>
Tue, 1 Jun 2021 08:52:03 +0000 (16:52 +0800)
committerBorislav Petkov <bp@suse.de>
Fri, 4 Jun 2021 13:23:28 +0000 (15:23 +0200)
commit5405b42c2f08efe67b531799ba2fdb35bac93e70
tree0d7d092f885acd03316731626a3b3fb6efeedb54
parentf1d4d47c5851b348b7713007e152bc68b94d728b
x86/fault: Don't send SIGSEGV twice on SEGV_PKUERR

__bad_area_nosemaphore() calls both force_sig_pkuerr() and
force_sig_fault() when handling SEGV_PKUERR. This does not cause
problems because the second signal is filtered by the legacy_queue()
check in __send_signal() because in both cases, the signal is SIGSEGV,
the second one seeing that the first one is already pending.

This causes the kernel to do unnecessary work so send the signal only
once for SEGV_PKUERR.

 [ bp: Massage commit message. ]

Fixes: 9db812dbb29d ("signal/x86: Call force_sig_pkuerr from __bad_area_nosemaphore")
Suggested-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Jiashuo Liang <liangjs@pku.edu.cn>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
Link: https://lkml.kernel.org/r/20210601085203.40214-1-liangjs@pku.edu.cn
arch/x86/mm/fault.c