diff options
author | Will Deacon <will@kernel.org> | 2020-02-13 12:06:26 +0000 |
---|---|---|
committer | Will Deacon <will@kernel.org> | 2020-07-16 11:41:21 +0100 |
commit | 3a5a4366cecc25daa300b9a9174f7fdd352b9068 (patch) | |
tree | cab8688b96d324ee0b110d0525679eee6f2a43e5 /arch/mips/sgi-ip22/ip22-berr.c | |
parent | ac2081cdc4d99c57f219c1a6171526e0fa0a6fff (diff) |
arm64: ptrace: Override SPSR.SS when single-stepping is enabled
Luis reports that, when reverse debugging with GDB, single-step does not
function as expected on arm64:
| I've noticed, under very specific conditions, that a PTRACE_SINGLESTEP
| request by GDB won't execute the underlying instruction. As a consequence,
| the PC doesn't move, but we return a SIGTRAP just like we would for a
| regular successful PTRACE_SINGLESTEP request.
The underlying problem is that when the CPU register state is restored
as part of a reverse step, the SPSR.SS bit is cleared and so the hardware
single-step state can transition to the "active-pending" state, causing
an unexpected step exception to be taken immediately if a step operation
is attempted.
In hindsight, we probably shouldn't have exposed SPSR.SS in the pstate
accessible by the GPR regset, but it's a bit late for that now. Instead,
simply prevent userspace from configuring the bit to a value which is
inconsistent with the TIF_SINGLESTEP state for the task being traced.
Cc: <stable@vger.kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Keno Fischer <keno@juliacomputing.com>
Link: https://lore.kernel.org/r/1eed6d69-d53d-9657-1fc9-c089be07f98c@linaro.org
Reported-by: Luis Machado <luis.machado@linaro.org>
Tested-by: Luis Machado <luis.machado@linaro.org>
Signed-off-by: Will Deacon <will@kernel.org>
Diffstat (limited to 'arch/mips/sgi-ip22/ip22-berr.c')
0 files changed, 0 insertions, 0 deletions