On Mon, Jun 1, 2020 at 5:23 AM Dave Martin <dave.mar...@arm.com> wrote: > > > Can't PTRACE_SYSEMU be emulated by using PTRACE_SYSCALL, cancelling the > > > syscall at the syscall enter stop, then modifying the regs at the > > > syscall exit stop? > > > > Yes, it can. The idea behind SYSEMU is to be able to save half the > > ptrace traps that would require, in theory making the ptracer > > a decent amount faster. That said, the x7 issue is orthogonal to > > SYSEMU, you'd have the same issues if you used PTRACE_SYSCALL. > > Right, I just wondered whether there was some deeper difference between > the two approaches.
You're asking about a new regset vs trying to do it via ptrace option? I don't think there's anything a ptrace option can do that a new regset that replicates the same registers (I'm gonna propose adding orig_x0, while we're at it and changing the x0 semantics a bit, will have those details with the patch) wouldn't be able to do . The reason I originally thought it might have to be a ptrace option is because the register modification currently gets applied in the syscall entry code to the actual regs struct, so I thought you might have to know to preserve those registers. However, then I realized that you could just change the regset accessors to emulate the old behavior, since we do already store all the required information (what kind of stop we're currently at) in order to be able to answer the ptrace informational queries. So doing that it probably just all around easier. I guess NT_PRSTATUS might also rot, but I guess strace doesn't really have to stop using it, since it doesn't care about the x7 value nor does it need to modify it. Keno