@@ -827,31 +827,45 @@ enum ptrace_syscall_dir {
PTRACE_SYSCALL_EXIT,
};
-static void report_syscall(struct pt_regs *regs, enum ptrace_syscall_dir dir)
+static void report_syscall_enter(struct pt_regs *regs)
{
unsigned long ip;
/*
* IP is used to denote syscall entry/exit:
- * IP = 0 -> entry, =1 -> exit
+ * IP = 0 -> entry
*/
ip = regs->ARM_ip;
- regs->ARM_ip = dir;
+ regs->ARM_ip = PTRACE_SYSCALL_ENTER;
- if (dir == PTRACE_SYSCALL_EXIT)
- ptrace_report_syscall_exit(regs, 0);
- else if (ptrace_report_syscall_entry(regs))
+ if (ptrace_report_syscall_entry(regs))
current_thread_info()->abi_syscall = -1;
regs->ARM_ip = ip;
}
+static void report_syscall_exit(struct pt_regs *regs)
+{
+ unsigned long ip;
+
+ /*
+ * IP is used to denote syscall entry/exit:
+ * IP = 1 -> exit
+ */
+ ip = regs->ARM_ip;
+ regs->ARM_ip = PTRACE_SYSCALL_EXIT;
+
+ ptrace_report_syscall_exit(regs, 0);
+
+ regs->ARM_ip = ip;
+}
+
asmlinkage int syscall_trace_enter(struct pt_regs *regs)
{
int scno;
if (test_thread_flag(TIF_SYSCALL_TRACE))
- report_syscall(regs, PTRACE_SYSCALL_ENTER);
+ report_syscall_enter(regs);
/* Do seccomp after ptrace; syscall may have changed. */
#ifdef CONFIG_HAVE_ARCH_SECCOMP_FILTER
@@ -892,5 +906,5 @@ asmlinkage void syscall_trace_exit(struct pt_regs *regs)
trace_sys_exit(regs, regs_return_value(regs));
if (test_thread_flag(TIF_SYSCALL_TRACE))
- report_syscall(regs, PTRACE_SYSCALL_EXIT);
+ report_syscall_exit(regs);
}
The generic entry code requires that report_syscall() be provided in two parts: report_syscall_enter() and report_syscall_exit() so split the combined function in two. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- arch/arm/kernel/ptrace.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-)