[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210201194012.524831-1-avagin@gmail.com>
Date: Mon, 1 Feb 2021 11:40:09 -0800
From: Andrei Vagin <avagin@...il.com>
To: Will Deacon <will@...nel.org>,
Catalin Marinas <catalin.marinas@....com>
Cc: Oleg Nesterov <oleg@...hat.com>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-api@...r.kernel.org,
Anthony Steinhauser <asteinhauser@...gle.com>,
Andrei Vagin <avagin@...il.com>,
Dave Martin <Dave.Martin@....com>,
Keno Fischer <keno@...iacomputing.com>
Subject: [PATCH 0/3 v2] arm64/ptrace: allow to get all registers on syscall traps
Right now, ip/r12 for AArch32 and x7 for AArch64 is used to indicate
whether or not the stop has been signalled from syscall entry or syscall
exit. This means that:
- Any writes by the tracer to this register during the stop are
ignored/discarded.
- The actual value of the register is not available during the stop,
so the tracer cannot save it and restore it later.
For applications like the user-mode Linux or gVisor, it is critical to
have access to the full set of registers in any moment. For example,
they need to change values of all registers to emulate rt_sigreturn or
execve and they need to have the full set of registers to build a signal
frame.
This series introduces the PTRACE_O_ARM64_RAW_REGS option. If it is set,
PTRACE_GETREGSET returns values of all registers, and PTRACE_SETREGSET
allows to change any of them.
Cc: Catalin Marinas <catalin.marinas@....com>
Cc: Dave Martin <Dave.Martin@....com>
Cc: Keno Fischer <keno@...iacomputing.com>
Cc: Oleg Nesterov <oleg@...hat.com>
Cc: Will Deacon <will@...nel.org>
Andrei Vagin (3):
arm64/ptrace: don't clobber task registers on syscall entry/exit traps
arm64/ptrace: introduce PTRACE_O_ARM64_RAW_REGS
selftest/arm64/ptrace: add tests for PTRACE_O_ARM64_RAW_REGS
v2: use the ptrace option instead of adding a new regset.
arch/arm64/include/asm/ptrace.h | 5 +
arch/arm64/kernel/ptrace.c | 130 +++++++++++-----
include/uapi/linux/elf.h | 1 +
tools/testing/selftests/arm64/Makefile | 2 +-
tools/testing/selftests/arm64/ptrace/Makefile | 6 +
.../arm64/ptrace/ptrace_syscall_regs_test.c | 142 ++++++++++++++++++
6 files changed, 246 insertions(+), 40 deletions(-)
create mode 100644 tools/testing/selftests/arm64/ptrace/Makefile
create mode 100644 tools/testing/selftests/arm64/ptrace/ptrace_syscall_regs_test.c
--
2.29.2
Powered by blists - more mailing lists