Skip to content

Commit e754aed

Browse files
hansendcIngo Molnar
authored andcommitted
x86/mpx, selftests: Add MPX self test
I've had this code for a while, but never submitted it upstream. Now that Skylake hardware is out in the wild, folks can actually run this for real. It tests the following: 1. The MPX hardware is enabled by the kernel and doing what it is supposed to 2. The MPX management code is present and enabled in the kernel 3. MPX Signal handling 4. The MPX bounds table population code (on-demand population) 5. The MPX bounds table unmapping code (kernel-initiated freeing when unused) This has also caught bugs in the XSAVE code because MPX state is saved/restored with XSAVE. I'm submitting it now because it would have caught the recent issues with the compat_siginfo code not being properly augmented when new siginfo state is added. Signed-off-by: Dave Hansen <[email protected]> Cc: Al Viro <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Brian Gerst <[email protected]> Cc: Dave Hansen <[email protected]> Cc: Denys Vlasenko <[email protected]> Cc: H. Peter Anvin <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Oleg Nesterov <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Shuah Khan <[email protected]> Cc: Thomas Gleixner <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent 02e8fda commit e754aed

File tree

6 files changed

+2230
-1
lines changed

6 files changed

+2230
-1
lines changed

tools/testing/selftests/x86/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ include ../lib.mk
55
.PHONY: all all_32 all_64 warn_32bit_failure clean
66

77
TARGETS_C_BOTHBITS := single_step_syscall sysret_ss_attrs syscall_nt ptrace_syscall \
8-
check_initial_reg_state sigreturn ldt_gdt iopl
8+
check_initial_reg_state sigreturn ldt_gdt iopl mpx-mini-test
99
TARGETS_C_32BIT_ONLY := entry_from_vm86 syscall_arg_fault test_syscall_vdso unwind_vdso \
1010
test_FCMOV test_FCOMI test_FISTTP \
1111
vdso_restorer
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#ifndef _MPX_DEBUG_H
2+
#define _MPX_DEBUG_H
3+
4+
#ifndef DEBUG_LEVEL
5+
#define DEBUG_LEVEL 0
6+
#endif
7+
#define dprintf_level(level, args...) do { if(level <= DEBUG_LEVEL) printf(args); } while(0)
8+
#define dprintf1(args...) dprintf_level(1, args)
9+
#define dprintf2(args...) dprintf_level(2, args)
10+
#define dprintf3(args...) dprintf_level(3, args)
11+
#define dprintf4(args...) dprintf_level(4, args)
12+
#define dprintf5(args...) dprintf_level(5, args)
13+
14+
#endif /* _MPX_DEBUG_H */

0 commit comments

Comments
 (0)