diff options
Diffstat (limited to 'tools/testing/selftests/x86')
| -rw-r--r-- | tools/testing/selftests/x86/corrupt_xstate_header.c | 2 | ||||
| -rw-r--r-- | tools/testing/selftests/x86/helpers.h | 2 | ||||
| -rw-r--r-- | tools/testing/selftests/x86/lam.c | 2 | ||||
| -rw-r--r-- | tools/testing/selftests/x86/syscall_numbering.c | 2 | ||||
| -rw-r--r-- | tools/testing/selftests/x86/test_mremap_vdso.c | 2 | ||||
| -rw-r--r-- | tools/testing/selftests/x86/test_vsyscall.c | 23 | ||||
| -rw-r--r-- | tools/testing/selftests/x86/xstate.h | 2 |
7 files changed, 19 insertions, 16 deletions
diff --git a/tools/testing/selftests/x86/corrupt_xstate_header.c b/tools/testing/selftests/x86/corrupt_xstate_header.c index 93a89a5997ca..f4d67b050275 100644 --- a/tools/testing/selftests/x86/corrupt_xstate_header.c +++ b/tools/testing/selftests/x86/corrupt_xstate_header.c @@ -17,7 +17,7 @@ #include <stdint.h> #include <sys/wait.h> -#include "../kselftest.h" /* For __cpuid_count() */ +#include "kselftest.h" /* For __cpuid_count() */ #include "helpers.h" static inline int xsave_enabled(void) diff --git a/tools/testing/selftests/x86/helpers.h b/tools/testing/selftests/x86/helpers.h index 6deaad035161..4c747a1278d9 100644 --- a/tools/testing/selftests/x86/helpers.h +++ b/tools/testing/selftests/x86/helpers.h @@ -7,7 +7,7 @@ #include <asm/processor-flags.h> -#include "../kselftest.h" +#include "kselftest.h" static inline unsigned long get_eflags(void) { diff --git a/tools/testing/selftests/x86/lam.c b/tools/testing/selftests/x86/lam.c index 0873b0e5f48b..1919fa6daec0 100644 --- a/tools/testing/selftests/x86/lam.c +++ b/tools/testing/selftests/x86/lam.c @@ -18,7 +18,7 @@ #include <sys/uio.h> #include <linux/io_uring.h> -#include "../kselftest.h" +#include "kselftest.h" #ifndef __x86_64__ # error This test is 64-bit only diff --git a/tools/testing/selftests/x86/syscall_numbering.c b/tools/testing/selftests/x86/syscall_numbering.c index 41c42b7b54a6..ca0eca7b9dce 100644 --- a/tools/testing/selftests/x86/syscall_numbering.c +++ b/tools/testing/selftests/x86/syscall_numbering.c @@ -25,7 +25,7 @@ #include <sys/mman.h> #include <linux/ptrace.h> -#include "../kselftest.h" +#include "kselftest.h" /* Common system call numbers */ #define SYS_READ 0 diff --git a/tools/testing/selftests/x86/test_mremap_vdso.c b/tools/testing/selftests/x86/test_mremap_vdso.c index 94bee6e0c813..a5edf6c5f17e 100644 --- a/tools/testing/selftests/x86/test_mremap_vdso.c +++ b/tools/testing/selftests/x86/test_mremap_vdso.c @@ -20,7 +20,7 @@ #include <sys/auxv.h> #include <sys/syscall.h> #include <sys/wait.h> -#include "../kselftest.h" +#include "kselftest.h" #define PAGE_SIZE 4096 diff --git a/tools/testing/selftests/x86/test_vsyscall.c b/tools/testing/selftests/x86/test_vsyscall.c index 05e1e6774fba..f1c3df642352 100644 --- a/tools/testing/selftests/x86/test_vsyscall.c +++ b/tools/testing/selftests/x86/test_vsyscall.c @@ -21,7 +21,7 @@ #include <sys/uio.h> #include "helpers.h" -#include "../kselftest.h" +#include "kselftest.h" #ifdef __x86_64__ #define TOTAL_TESTS 13 @@ -308,12 +308,13 @@ static void test_getcpu(int cpu) #ifdef __x86_64__ static jmp_buf jmpbuf; -static volatile unsigned long segv_err; +static volatile unsigned long segv_err, segv_trapno; static void sigsegv(int sig, siginfo_t *info, void *ctx_void) { ucontext_t *ctx = (ucontext_t *)ctx_void; + segv_trapno = ctx->uc_mcontext.gregs[REG_TRAPNO]; segv_err = ctx->uc_mcontext.gregs[REG_ERR]; siglongjmp(jmpbuf, 1); } @@ -336,7 +337,8 @@ static void test_vsys_r(void) else if (can_read) ksft_test_result_pass("We have read access\n"); else - ksft_test_result_pass("We do not have read access: #PF(0x%lx)\n", segv_err); + ksft_test_result_pass("We do not have read access (trap=%ld, error=0x%lx)\n", + segv_trapno, segv_err); } static void test_vsys_x(void) @@ -347,7 +349,7 @@ static void test_vsys_x(void) return; } - ksft_print_msg("Make sure that vsyscalls really page fault\n"); + ksft_print_msg("Make sure that vsyscalls really cause a fault\n"); bool can_exec; if (sigsetjmp(jmpbuf, 1) == 0) { @@ -358,13 +360,14 @@ static void test_vsys_x(void) } if (can_exec) - ksft_test_result_fail("Executing the vsyscall did not page fault\n"); - else if (segv_err & (1 << 4)) /* INSTR */ - ksft_test_result_pass("Executing the vsyscall page failed: #PF(0x%lx)\n", - segv_err); + ksft_test_result_fail("Executing the vsyscall did not fault\n"); + /* #GP or #PF (with X86_PF_INSTR) */ + else if ((segv_trapno == 13) || ((segv_trapno == 14) && (segv_err & (1 << 4)))) + ksft_test_result_pass("Executing the vsyscall page failed (trap=%ld, error=0x%lx)\n", + segv_trapno, segv_err); else - ksft_test_result_fail("Execution failed with the wrong error: #PF(0x%lx)\n", - segv_err); + ksft_test_result_fail("Execution failed with the wrong error (trap=%ld, error=0x%lx)\n", + segv_trapno, segv_err); } /* diff --git a/tools/testing/selftests/x86/xstate.h b/tools/testing/selftests/x86/xstate.h index e91e3092b5d2..6ee816e7625a 100644 --- a/tools/testing/selftests/x86/xstate.h +++ b/tools/testing/selftests/x86/xstate.h @@ -4,7 +4,7 @@ #include <stdint.h> -#include "../kselftest.h" +#include "kselftest.h" #define XSAVE_HDR_OFFSET 512 #define XSAVE_HDR_SIZE 64 |
