]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb: Enable displaced stepping with shadow stack on amd64 linux.
authorChristina Schimpe <christina.schimpe@intel.com>
Fri, 18 Feb 2022 11:09:46 +0000 (03:09 -0800)
committerChristina Schimpe <christina.schimpe@intel.com>
Fri, 29 Aug 2025 17:02:10 +0000 (17:02 +0000)
commit7a8821ff0e1badeaa284f6a6ff0b79b8e1fe5237
treee7ae8d870198bc201a2d5b395c2f2ccd83608f1d
parent66dee5a4f05b8f0ac84d354ec5102c0be31a8148
gdb: Enable displaced stepping with shadow stack on amd64 linux.

Currently, if displaced stepping is active and the single stepped instruction
is a call instruction, the return address atop the stack is the address
following the copied instruction.  However, to allow normal program execution
it has to be the address following the original instruction.  Due to that
reason, the return address is corrected in amd64_displaced_step_fixup and
i386_displaced_step_fixup.

For programs that are shadow-stack enabled we see a control-protection
exception, as the address on the shadow stack does not match the address
atop the stack.

Fix this by correcting the shadow stack top address as well.

Approved-By: Andrew Burgess <aburgess@redhat.com>
Approved-By: Luis Machado <luis.machado@arm.com>
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
gdb/NEWS
gdb/amd64-linux-tdep.c
gdb/amd64-tdep.c
gdb/doc/gdb.texinfo
gdb/i386-tdep.c
gdb/testsuite/gdb.arch/amd64-shadow-stack-disp-step.exp [new file with mode: 0644]
gdb/testsuite/gdb.arch/amd64-shadow-stack.c