original_kernel/tools/testing/selftests/x86
Ricardo Neri a9e017d561 selftests/x86: Add tests for the STR and SLDT instructions
The STR and SLDT instructions are not valid when running on virtual-8086
mode and generate an invalid operand exception. These two instructions are
protected by the Intel User-Mode Instruction Prevention (UMIP) security
feature. In protected mode, if UMIP is enabled, these instructions generate
a general protection fault if called from CPL > 0. Linux traps the general
protection fault and emulates the instructions sgdt, sidt and smsw; but not
str and sldt.

These tests are added to verify that the emulation code does not emulate
these two instructions but the expected invalid operand exception is
seen.

Tests fallback to exit with INT3 in case emulation does happen.

Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Borislav Petkov <bp@suse.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Chen Yucong <slaoub@gmail.com>
Cc: Chris Metcalf <cmetcalf@mellanox.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Huang Rui <ray.huang@amd.com>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi V. Shankar <ravi.v.shankar@intel.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: ricardo.neri@intel.com
Link: http://lkml.kernel.org/r/1509935277-22138-13-git-send-email-ricardo.neri-calderon@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2017-11-08 11:16:25 +01:00
..
.gitignore
Makefile
check_cc.sh
check_initial_reg_state.c
entry_from_vm86.c selftests/x86: Add tests for the STR and SLDT instructions 2017-11-08 11:16:25 +01:00
fsgsbase.c
ioperm.c
iopl.c
ldt_gdt.c selftests/x86/ldt_get: Add a few additional tests for limits 2017-11-07 11:13:43 +01:00
mpx-debug.h
mpx-dig.c
mpx-hw.h
mpx-mini-test.c
mpx-mm.h
pkey-helpers.h
protection_keys.c
ptrace_syscall.c
raw_syscall_helper_32.S
sigreturn.c
single_step_syscall.c
syscall_arg_fault.c
syscall_nt.c
sysret_rip.c
sysret_ss_attrs.c
test_FCMOV.c
test_FCOMI.c
test_FISTTP.c
test_mremap_vdso.c
test_syscall_vdso.c
test_vdso.c
thunks.S
thunks_32.S
trivial_32bit_program.c
trivial_64bit_program.c
unwind_vdso.c
vdso_restorer.c