[PATCH v3 0/5] x86: Support shstk via prctl

From: Bill Roberts

Date: Thu Aug 20 2026 - 11:32:07 EST


This is a continuation of adding prctl support for x86:
- https://patchew.org/linux/20260714154740.140431-1-bill.roberts@xxxxxxx/

History:
- v1: Initial Patches
- v2: Nacked by author
- Refactors the test suite
- v3:
- Fixes an existing fork bug pointed out by Shashiko
- Fixes a state rollback issue in the patch itself
- Fixes Makefile dependencies
- Add's a test for shadow stack state locking
- Refactors the arch_prctl and prctl tests into two different files using
a shared testing suite file

FWIW X86 Maintaners and Rick, I structured this so you can just pull the bug fixes only
(up to but not including commit "x86/shstk: support via prctl") if you have concerns
on the other patches for me to address, this will allow you to take the bug fixes
and additional test now if desired.

Bill Roberts (5):
selftests/x86: fix Makefile dependencies
selftests/x86: fix fork bug
selftests/x86: add shadow stack lock test
x86/shstk: support via prctl
selftests/x86: add generic prctl shadow stack test

arch/x86/kernel/shstk.c | 56 +
tools/testing/selftests/x86/Makefile | 12 +-
tools/testing/selftests/x86/shadow_stack.c | 1287 +++++++++++++++++
tools/testing/selftests/x86/shadow_stack.h | 14 +
.../testing/selftests/x86/test_shadow_stack.c | 1168 +--------------
.../selftests/x86/test_shadow_stack_prctl.c | 12 +
6 files changed, 1384 insertions(+), 1165 deletions(-)
create mode 100644 tools/testing/selftests/x86/shadow_stack.c
create mode 100644 tools/testing/selftests/x86/shadow_stack.h
create mode 100644 tools/testing/selftests/x86/test_shadow_stack_prctl.c

--
2.55.0