x86, selftests: Add a test for the "sysret_ss_attrs" bug
On AMD CPUs, SYSRET can return with a valid SS descriptor with with the hidden attributes set to an unusable state. Make sure the kernel doesn't let this happen. This detects an as-yet-unfixed regression. Note that the 64-bit version of this test fails on AMD CPUs on all kernel versions, although the issue in the 64-bit case is much less severe than in the 32-bit case. Reported-by:Brian Gerst <brgerst@gmail.com> Tested-by:
Denys Vlasenko <dvlasenk@redhat.com> Signed-off-by:
Andy Lutomirski <luto@kernel.org> Tests: e7d6eefa ("x86/vdso32/syscall.S: Do not load __USER32_DS to %ss") Cc: Alexei Starovoitov <ast@plumgrid.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Denys Vlasenko <vda.linux@googlemail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Kees Cook <keescook@chromium.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Will Drewry <wad@chromium.org> Link: http://lkml.kernel.org/r/resend_4d740841bac383742949e2fefb03982736595087.git.luto@kernel.org Signed-off-by:
Ingo Molnar <mingo@kernel.org>
Showing
- tools/testing/selftests/x86/Makefile 4 additions, 1 deletiontools/testing/selftests/x86/Makefile
- tools/testing/selftests/x86/run_x86_tests.sh 2 additions, 0 deletionstools/testing/selftests/x86/run_x86_tests.sh
- tools/testing/selftests/x86/sysret_ss_attrs.c 112 additions, 0 deletionstools/testing/selftests/x86/sysret_ss_attrs.c
- tools/testing/selftests/x86/thunks.S 67 additions, 0 deletionstools/testing/selftests/x86/thunks.S
tools/testing/selftests/x86/thunks.S
0 → 100644
Please register or sign in to comment