x86/vsyscall: Document odd SIGSEGV error code for vsyscalls
authorAndy Lutomirski <luto@kernel.org>
Thu, 27 Jun 2019 04:45:05 +0000 (21:45 -0700)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 27 Jun 2019 22:04:39 +0000 (00:04 +0200)
commite0a446ce394a7915f2ffc03f9bb610c5ac4dbbf1
treea2458144d3b24a798ebe5632e8efdb9002df5154
parent918ce325098a4eef99daad7b6796da33cebaf03a
x86/vsyscall: Document odd SIGSEGV error code for vsyscalls

Even if vsyscall=none, user page faults on the vsyscall page are reported
as though the PROT bit in the error code was set.  Add a comment explaining
why this is probably okay and display the value in the test case.

While at it, explain why the behavior is correct with respect to PKRU.

Modify also the selftest to print the odd error code so that there is a
way to demonstrate the odd behaviour.

If anyone really cares about more accurate emulation, the behaviour could
be changed. But that needs a real good justification.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Kees Cook <keescook@chromium.org>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: Jann Horn <jannh@google.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Kernel Hardening <kernel-hardening@lists.openwall.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lkml.kernel.org/r/75c91855fd850649ace162eec5495a1354221aaa.1561610354.git.luto@kernel.org
arch/x86/mm/fault.c
tools/testing/selftests/x86/test_vsyscall.c