Skip to content

Commit

Permalink
MIPS: Fix syscall_get_nr for the syscall exit tracing.
Browse files Browse the repository at this point in the history
Register 2 is alredy overwritten by the return value when
syscall_trace_leave() is called.

Signed-off-by: Lars Persson <larper@axis.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/9187/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  • Loading branch information
larperaxis authored and ralfbaechle committed Feb 4, 2015
1 parent 26f7c4b commit c2d9f17
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
8 changes: 1 addition & 7 deletions arch/mips/include/asm/syscall.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,7 @@
static inline long syscall_get_nr(struct task_struct *task,
struct pt_regs *regs)
{
/* O32 ABI syscall() - Either 64-bit with O32 or 32-bit */
if ((config_enabled(CONFIG_32BIT) ||
test_tsk_thread_flag(task, TIF_32BIT_REGS)) &&
(regs->regs[2] == __NR_syscall))
return regs->regs[4];
else
return regs->regs[2];
return current_thread_info()->syscall;
}

static inline unsigned long mips_get_syscall_arg(unsigned long *arg,
Expand Down
1 change: 1 addition & 0 deletions arch/mips/include/asm/thread_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ struct thread_info {
*/
struct restart_block restart_block;
struct pt_regs *regs;
long syscall; /* syscall number */
};

/*
Expand Down
2 changes: 2 additions & 0 deletions arch/mips/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,8 @@ asmlinkage long syscall_trace_enter(struct pt_regs *regs, long syscall)
long ret = 0;
user_exit();

current_thread_info()->syscall = syscall;

if (secure_computing() == -1)
return -1;

Expand Down

0 comments on commit c2d9f17

Please sign in to comment.