]> git.baikalelectronics.ru Git - kernel.git/commit
x86/mm/pkeys: Fix fill_sig_info_pkey
authorEric W. Biederman <ebiederm@xmission.com>
Fri, 12 Jan 2018 20:31:35 +0000 (14:31 -0600)
committerThomas Gleixner <tglx@linutronix.de>
Sun, 14 Jan 2018 11:14:51 +0000 (12:14 +0100)
commita96f2705fd5ad5de25b1c9c0f3c7fc567c8b3bbd
tree1338577480a05b6866172a22964631095614d756
parent979f5354169b32fe4bb53853f87a0033fc747de9
x86/mm/pkeys: Fix fill_sig_info_pkey

SEGV_PKUERR is a signal specific si_code which happens to have the same
numeric value as several others: BUS_MCEERR_AR, ILL_ILLTRP, FPE_FLTOVF,
TRAP_HWBKPT, CLD_TRAPPED, POLL_ERR, SEGV_THREAD_ID, as such it is not safe
to just test the si_code the signal number must also be tested to prevent a
false positive in fill_sig_info_pkey.

This error was by inspection, and BUS_MCEERR_AR appears to be a real
candidate for confusion.  So pass in si_signo and check for SIG_SEGV to
verify that it is actually a SEGV_PKUERR

Fixes: 0aeb7661cd4a ("x86/mm/pkeys: Fill in pkey field in siginfo")
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-arch@vger.kernel.org
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/20180112203135.4669-2-ebiederm@xmission.com
arch/x86/mm/fault.c