powerpc/ptrace: Add support for PTRACE_SYSEMU
This is a patch that adds support for PTRACE_SYSEMU ptrace request in PowerPC architecture. When ptrace(PTRACE_SYSEMU, ...) request is called, it will be handled by the arch independent function ptrace_resume(), which will tag the task with the TIF_SYSCALL_EMU flag. This flag needs to be handled from a platform dependent point of view, which is what this patch does. This patch adds this task's flag as part of the _TIF_SYSCALL_DOTRACE, which is the MACRO that is used to trace syscalls at entrance/exit. Since TIF_SYSCALL_EMU is now part of _TIF_SYSCALL_DOTRACE, if the task has _TIF_SYSCALL_DOTRACE set, it will hit do_syscall_trace_enter() at syscall entrance and do_syscall_trace_leave() at syscall leave. do_syscall_trace_enter() needs to handle the TIF_SYSCALL_EMU flag properly, which will interrupt the syscall executing if TIF_SYSCALL_EMU is set. The output values should not be changed, i.e. the return value (r3) should contain the original syscall argument on exit. With this flag set, the syscall is not executed fundamentally, because do_syscall_trace_enter() is returning -1 which is bigger than NR_syscall, thus, skipping the syscall execution and exiting userspace. Signed-off-by: Breno Leitao <leitao@debian.org> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:

committed by
Michael Ellerman

parent
16d7c69c89
commit
5521eb4bca
@@ -160,6 +160,10 @@ struct pt_regs {
|
||||
#define PTRACE_GETVSRREGS 0x1b
|
||||
#define PTRACE_SETVSRREGS 0x1c
|
||||
|
||||
/* Syscall emulation defines */
|
||||
#define PTRACE_SYSEMU 0x1d
|
||||
#define PTRACE_SYSEMU_SINGLESTEP 0x1e
|
||||
|
||||
/*
|
||||
* Get or set a debug register. The first 16 are DABR registers and the
|
||||
* second 16 are IABR registers.
|
||||
|
Reference in New Issue
Block a user