]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit7b50a22c5c55d703d9cc35ef647bd52ad903d859
tree0d7d092f885acd03316731626a3b3fb6efeedb54
parent42909513a7b62c320d9ae9ad5e9de24a6814670b
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: b24992ac6a3a ("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