summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/mm/protection_keys.c
diff options
context:
space:
mode:
authorKeith Lucas <keith.lucas@oracle.com>2024-08-02 08:13:18 +0200
committerThomas Gleixner <tglx@linutronix.de>2024-08-02 14:12:21 +0200
commit6998a73efbb8a87f4dd0bddde90b7f5b0d47b5e0 (patch)
treef72764ebd02be0401ee14ea944fe3fd614ded7b2 /tools/testing/selftests/mm/protection_keys.c
parentx86/pkeys: Restore altstack access in sigreturn() (diff)
downloadlinux-6998a73efbb8a87f4dd0bddde90b7f5b0d47b5e0.tar.xz
linux-6998a73efbb8a87f4dd0bddde90b7f5b0d47b5e0.zip
selftests/mm: Add new testcases for pkeys
Add a few new tests to exercise the signal handler flow, especially with PKEY 0 disabled: - Verify that the SIGSEGV handler is invoked when pkey 0 is disabled. - Verify that a thread which disables PKEY 0 segfaults with PKUERR when accessing the stack. - Verify that the SIGSEGV handler that uses an alternate signal stack is correctly invoked when the thread disabled PKEY 0 - Verify that the PKRU value set by the application is correctly restored upon return from signal handling. - Verify that sigreturn() is able to restore the altstack even if the thread had PKEY 0 disabled [ Aruna: Adapted to upstream ] [ tglx: Made it actually compile. Restored protection_keys compile. Added useful info to the changelog instead of bare function names. ] Signed-off-by: Keith Lucas <keith.lucas@oracle.com> Signed-off-by: Aruna Ramakrishna <aruna.ramakrishna@oracle.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/all/20240802061318.2140081-6-aruna.ramakrishna@oracle.com
Diffstat (limited to 'tools/testing/selftests/mm/protection_keys.c')
-rw-r--r--tools/testing/selftests/mm/protection_keys.c10
1 files changed, 0 insertions, 10 deletions
diff --git a/tools/testing/selftests/mm/protection_keys.c b/tools/testing/selftests/mm/protection_keys.c
index eaa6d1fc5328..cc6de1644360 100644
--- a/tools/testing/selftests/mm/protection_keys.c
+++ b/tools/testing/selftests/mm/protection_keys.c
@@ -950,16 +950,6 @@ void close_test_fds(void)
nr_test_fds = 0;
}
-#define barrier() __asm__ __volatile__("": : :"memory")
-__attribute__((noinline)) int read_ptr(int *ptr)
-{
- /*
- * Keep GCC from optimizing this away somehow
- */
- barrier();
- return *ptr;
-}
-
void test_pkey_alloc_free_attach_pkey0(int *ptr, u16 pkey)
{
int i, err;