arm64: ptrace: Add a comment describing our syscall entry/exit trap ABI
authorWill Deacon <will@kernel.org>
Thu, 2 Jul 2020 20:14:20 +0000 (21:14 +0100)
committerWill Deacon <will@kernel.org>
Thu, 16 Jul 2020 10:41:41 +0000 (11:41 +0100)
commit59ee987ea47caff8c1e7ba4b89932c6900a35d0c
treeb09c8b3bd780a12ae98cf2568de00d7495da67ba
parent15956689a0e60aa0c795174f3c310b60d8794235
arm64: ptrace: Add a comment describing our syscall entry/exit trap ABI

Our tracehook logic for syscall entry/exit raises a SIGTRAP back to the
tracer following a ptrace request such as PTRACE_SYSCALL. As part of this
procedure, we clobber the reported value of one of the tracee's general
purpose registers (x7 for native tasks, r12 for compat) to indicate
whether the stop occurred on syscall entry or exit. This is a slightly
unfortunate ABI, as it prevents the tracer from accessing the real
register value and is at odds with other similar stops such as seccomp
traps.

Since we're stuck with this ABI, expand the comment in our tracehook
logic to acknowledge the issue and describe the behaviour in more detail.

Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Luis Machado <luis.machado@linaro.org>
Reported-by: Keno Fischer <keno@juliacomputing.com>
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/kernel/ptrace.c