]> www.infradead.org Git - users/jedix/linux-maple.git/commit
selftests/mm: Add new testcases for pkeys
authorKeith Lucas <keith.lucas@oracle.com>
Fri, 2 Aug 2024 06:13:18 +0000 (06:13 +0000)
committerThomas Gleixner <tglx@linutronix.de>
Fri, 2 Aug 2024 12:12:21 +0000 (14:12 +0200)
commit6998a73efbb8a87f4dd0bddde90b7f5b0d47b5e0
treef72764ebd02be0401ee14ea944fe3fd614ded7b2
parentd10b554919d4cc8fa8fe2e95b57ad2624728c8e4
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
tools/testing/selftests/mm/Makefile
tools/testing/selftests/mm/pkey-helpers.h
tools/testing/selftests/mm/pkey_sighandler_tests.c [new file with mode: 0644]
tools/testing/selftests/mm/protection_keys.c