diff options
| author | Lars Persson <lars.persson@axis.com> | 2015-02-03 11:08:17 -0500 |
|---|---|---|
| committer | Ralf Baechle <ralf@linux-mips.org> | 2015-02-04 10:40:09 -0500 |
| commit | c2d9f17757310484ab4fd65954f5f9850f6a1349 (patch) | |
| tree | 93df833f0fdbddb083326d14eff6585d086e3186 | |
| parent | 26f7c4bd05cf34e63a4a794150ab66a40a5a84a9 (diff) | |
MIPS: Fix syscall_get_nr for the syscall exit tracing.
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>
| -rw-r--r-- | arch/mips/include/asm/syscall.h | 8 | ||||
| -rw-r--r-- | arch/mips/include/asm/thread_info.h | 1 | ||||
| -rw-r--r-- | arch/mips/kernel/ptrace.c | 2 |
3 files changed, 4 insertions, 7 deletions
diff --git a/arch/mips/include/asm/syscall.h b/arch/mips/include/asm/syscall.h index bb7963753730..6499d93ae68d 100644 --- a/arch/mips/include/asm/syscall.h +++ b/arch/mips/include/asm/syscall.h | |||
| @@ -29,13 +29,7 @@ | |||
| 29 | static inline long syscall_get_nr(struct task_struct *task, | 29 | static inline long syscall_get_nr(struct task_struct *task, |
| 30 | struct pt_regs *regs) | 30 | struct pt_regs *regs) |
| 31 | { | 31 | { |
| 32 | /* O32 ABI syscall() - Either 64-bit with O32 or 32-bit */ | 32 | return current_thread_info()->syscall; |
| 33 | if ((config_enabled(CONFIG_32BIT) || | ||
| 34 | test_tsk_thread_flag(task, TIF_32BIT_REGS)) && | ||
| 35 | (regs->regs[2] == __NR_syscall)) | ||
| 36 | return regs->regs[4]; | ||
| 37 | else | ||
| 38 | return regs->regs[2]; | ||
| 39 | } | 33 | } |
| 40 | 34 | ||
| 41 | static inline unsigned long mips_get_syscall_arg(unsigned long *arg, | 35 | static inline unsigned long mips_get_syscall_arg(unsigned long *arg, |
diff --git a/arch/mips/include/asm/thread_info.h b/arch/mips/include/asm/thread_info.h index 99eea59604e9..e4440f92b366 100644 --- a/arch/mips/include/asm/thread_info.h +++ b/arch/mips/include/asm/thread_info.h | |||
| @@ -36,6 +36,7 @@ struct thread_info { | |||
| 36 | */ | 36 | */ |
| 37 | struct restart_block restart_block; | 37 | struct restart_block restart_block; |
| 38 | struct pt_regs *regs; | 38 | struct pt_regs *regs; |
| 39 | long syscall; /* syscall number */ | ||
| 39 | }; | 40 | }; |
| 40 | 41 | ||
| 41 | /* | 42 | /* |
diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c index 9d1487d83293..510452812594 100644 --- a/arch/mips/kernel/ptrace.c +++ b/arch/mips/kernel/ptrace.c | |||
| @@ -770,6 +770,8 @@ asmlinkage long syscall_trace_enter(struct pt_regs *regs, long syscall) | |||
| 770 | long ret = 0; | 770 | long ret = 0; |
| 771 | user_exit(); | 771 | user_exit(); |
| 772 | 772 | ||
| 773 | current_thread_info()->syscall = syscall; | ||
| 774 | |||
| 773 | if (secure_computing() == -1) | 775 | if (secure_computing() == -1) |
| 774 | return -1; | 776 | return -1; |
| 775 | 777 | ||
