aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorGerald Schaefer <gerald.schaefer@de.ibm.com>2010-05-12 03:32:12 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-05-26 17:32:06 -0400
commit6304f31cfc670abcd2006c18cf8d960072c00c5c (patch)
tree960466726613074c735c5e6eb2c71360174dd65c /arch
parentd53662168530910feb44e0058b10e9b4ec2302be (diff)
ptrace: fix return value of do_syscall_trace_enter()
commit 545c174d1f093a462b4bb9131b23d5ea72a600e1 upstream. strace may change the system call number, so regs->gprs[2] must not be read before tracehook_report_syscall_entry(). This fixes a bug where "strace -f" will hang after a vfork(). Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/s390/kernel/ptrace.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c
index 7cf464234419..11e94de973ad 100644
--- a/arch/s390/kernel/ptrace.c
+++ b/arch/s390/kernel/ptrace.c
@@ -640,7 +640,7 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
640 640
641asmlinkage long do_syscall_trace_enter(struct pt_regs *regs) 641asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
642{ 642{
643 long ret; 643 long ret = 0;
644 644
645 /* Do the secure computing check first. */ 645 /* Do the secure computing check first. */
646 secure_computing(regs->gprs[2]); 646 secure_computing(regs->gprs[2]);
@@ -649,7 +649,6 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
649 * The sysc_tracesys code in entry.S stored the system 649 * The sysc_tracesys code in entry.S stored the system
650 * call number to gprs[2]. 650 * call number to gprs[2].
651 */ 651 */
652 ret = regs->gprs[2];
653 if (test_thread_flag(TIF_SYSCALL_TRACE) && 652 if (test_thread_flag(TIF_SYSCALL_TRACE) &&
654 (tracehook_report_syscall_entry(regs) || 653 (tracehook_report_syscall_entry(regs) ||
655 regs->gprs[2] >= NR_syscalls)) { 654 regs->gprs[2] >= NR_syscalls)) {
@@ -671,7 +670,7 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
671 regs->gprs[2], regs->orig_gpr2, 670 regs->gprs[2], regs->orig_gpr2,
672 regs->gprs[3], regs->gprs[4], 671 regs->gprs[3], regs->gprs[4],
673 regs->gprs[5]); 672 regs->gprs[5]);
674 return ret; 673 return ret ?: regs->gprs[2];
675} 674}
676 675
677asmlinkage void do_syscall_trace_exit(struct pt_regs *regs) 676asmlinkage void do_syscall_trace_exit(struct pt_regs *regs)