summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/x86/test_shadow_stack.c
AgeCommit message (Collapse)AuthorFilesLines
2023-09-02selftests/x86: Update map_shadow_stack syscall nrRick Edgecombe1-1/+1
Shadow stack's selftest utilizes the map_shadow_stack syscall. The syscall is new with the feature, but the selftests cannot automatically find the headers for the kernel source tree they are located in. This resulted in the shadow stack test failing to build until the brand new headers were installed. To avoid this, a copy of the new uapi defines needed by the test were included in the selftest (see link for discussion). When shadow stack was merged the syscall number was changed, but the copy in the selftest was not updated. So update the copy of the syscall number define used when the required headers are not installed, to have the final syscall number from the merge. Signed-off-by: Rick Edgecombe <rick.p.edgecombe@intel.com> Signed-off-by: Ingo Molnar <mingo@kernel.org> Link: https://lore.kernel.org/lkml/Y%2FijdXoTAATt0+Ct@zn.tnic/ Link: https://lore.kernel.org/r/20230901181652.2583861-1-rick.p.edgecombe@intel.com Reviewed-by: Sohil Mehta <sohil.mehta@intel.com> Fixes: df57721f9a63 ("Merge tag 'x86_shstk_for_6.6-rc1' of [...]")
2023-08-03selftests/x86: Add shadow stack testRick Edgecombe1-0/+884
Add a simple selftest for exercising some shadow stack behavior: - map_shadow_stack syscall and pivot - Faulting in shadow stack memory - Handling shadow stack violations - GUP of shadow stack memory - mprotect() of shadow stack memory - Userfaultfd on shadow stack memory - 32 bit segmentation - Guard gap test - Ptrace test Co-developed-by: Yu-cheng Yu <yu-cheng.yu@intel.com> Signed-off-by: Yu-cheng Yu <yu-cheng.yu@intel.com> Signed-off-by: Rick Edgecombe <rick.p.edgecombe@intel.com> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Acked-by: Mike Rapoport (IBM) <rppt@kernel.org> Tested-by: Pengfei Xu <pengfei.xu@intel.com> Tested-by: John Allen <john.allen@amd.com> Tested-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/all/20230613001108.3040476-40-rick.p.edgecombe%40intel.com