uprobes/x86: Fix uprobe syscall vs shadow stack
authorPeter Zijlstra <peterz@infradead.org>
Wed, 20 Aug 2025 12:28:34 +0000 (14:28 +0200)
committerPeter Zijlstra <peterz@infradead.org>
Thu, 21 Aug 2025 18:09:22 +0000 (20:09 +0200)
commitf349ec80865dfeaf8a33feae6b4a500db039c69c
treea106ea4718a82888f61572181ca4d74a54769558
parent7c2bfc183b05103287cc32ad68184f7d4312c06d
uprobes/x86: Fix uprobe syscall vs shadow stack

The uprobe syscall stores and strips the trampoline stack frame from
the user context, to make it appear similar to an exception at the
original instruction. It then restores the trampoline stack when it
can exit using sysexit.

Make sure to match the regular stack manipulation with shadow stack
operations such that regular and shadow stack don't get out of sync
and causes trouble.

This enables using the optimization when shadow stack is in use.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20250821123657.055790090@infradead.org
arch/x86/include/asm/shstk.h
arch/x86/kernel/shstk.c
arch/x86/kernel/uprobes.c