Skip to content

Commit

Permalink
csky/syscall_trace: Fixup return processing flow
Browse files Browse the repository at this point in the history
The function tracehook_report_syscall_entry's return value is
__must_check attribute. We should add return processing flow in
ptrace.c and set the syscall number to -1 when failed just like
riscv's.

Signed-off-by: Guo Ren <ren_guo@c-sky.com>
Cc: Arnd Bergmann <arnd@arndb.de>
  • Loading branch information
Guo Ren committed Apr 22, 2019
1 parent 1a23710 commit a691f33
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions arch/csky/include/asm/syscall.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
return regs_syscallid(regs);
}

static inline void
syscall_set_nr(struct task_struct *task, struct pt_regs *regs,
int sysno)
{
regs_syscallid(regs) = sysno;
}

static inline void
syscall_rollback(struct task_struct *task, struct pt_regs *regs)
{
Expand Down
3 changes: 2 additions & 1 deletion arch/csky/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ long arch_ptrace(struct task_struct *child, long request,
asmlinkage void syscall_trace_enter(struct pt_regs *regs)
{
if (test_thread_flag(TIF_SYSCALL_TRACE))
tracehook_report_syscall_entry(regs);
if (tracehook_report_syscall_entry(regs))
syscall_set_nr(current, regs, -1);

if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
trace_sys_enter(regs, syscall_get_nr(current, regs));
Expand Down

0 comments on commit a691f33

Please sign in to comment.