aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386/kernel/ptrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/i386/kernel/ptrace.c')
-rw-r--r--arch/i386/kernel/ptrace.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/arch/i386/kernel/ptrace.c b/arch/i386/kernel/ptrace.c
index b2f17640ceff..e34f651fa13c 100644
--- a/arch/i386/kernel/ptrace.c
+++ b/arch/i386/kernel/ptrace.c
@@ -16,6 +16,7 @@
16#include <linux/security.h> 16#include <linux/security.h>
17#include <linux/audit.h> 17#include <linux/audit.h>
18#include <linux/seccomp.h> 18#include <linux/seccomp.h>
19#include <linux/signal.h>
19 20
20#include <asm/uaccess.h> 21#include <asm/uaccess.h>
21#include <asm/pgtable.h> 22#include <asm/pgtable.h>
@@ -511,7 +512,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
511 case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ 512 case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */
512 case PTRACE_CONT: /* restart after signal. */ 513 case PTRACE_CONT: /* restart after signal. */
513 ret = -EIO; 514 ret = -EIO;
514 if ((unsigned long) data > _NSIG) 515 if (!valid_signal(data))
515 break; 516 break;
516 if (request == PTRACE_SYSCALL) { 517 if (request == PTRACE_SYSCALL) {
517 set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); 518 set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
@@ -543,7 +544,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
543 544
544 case PTRACE_SINGLESTEP: /* set the trap flag. */ 545 case PTRACE_SINGLESTEP: /* set the trap flag. */
545 ret = -EIO; 546 ret = -EIO;
546 if ((unsigned long) data > _NSIG) 547 if (!valid_signal(data))
547 break; 548 break;
548 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); 549 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
549 set_singlestep(child); 550 set_singlestep(child);
@@ -682,24 +683,18 @@ void do_syscall_trace(struct pt_regs *regs, int entryexit)
682 /* do the secure computing check first */ 683 /* do the secure computing check first */
683 secure_computing(regs->orig_eax); 684 secure_computing(regs->orig_eax);
684 685
685 if (unlikely(current->audit_context)) { 686 if (unlikely(current->audit_context) && entryexit)
686 if (!entryexit) 687 audit_syscall_exit(current, AUDITSC_RESULT(regs->eax), regs->eax);
687 audit_syscall_entry(current, regs->orig_eax,
688 regs->ebx, regs->ecx,
689 regs->edx, regs->esi);
690 else
691 audit_syscall_exit(current, regs->eax);
692 }
693 688
694 if (!(current->ptrace & PT_PTRACED)) 689 if (!(current->ptrace & PT_PTRACED))
695 return; 690 goto out;
696 691
697 /* Fake a debug trap */ 692 /* Fake a debug trap */
698 if (test_thread_flag(TIF_SINGLESTEP)) 693 if (test_thread_flag(TIF_SINGLESTEP))
699 send_sigtrap(current, regs, 0); 694 send_sigtrap(current, regs, 0);
700 695
701 if (!test_thread_flag(TIF_SYSCALL_TRACE)) 696 if (!test_thread_flag(TIF_SYSCALL_TRACE))
702 return; 697 goto out;
703 698
704 /* the 0x80 provides a way for the tracing parent to distinguish 699 /* the 0x80 provides a way for the tracing parent to distinguish
705 between a syscall stop and SIGTRAP delivery */ 700 between a syscall stop and SIGTRAP delivery */
@@ -714,4 +709,9 @@ void do_syscall_trace(struct pt_regs *regs, int entryexit)
714 send_sig(current->exit_code, current, 1); 709 send_sig(current->exit_code, current, 1);
715 current->exit_code = 0; 710 current->exit_code = 0;
716 } 711 }
712 out:
713 if (unlikely(current->audit_context) && !entryexit)
714 audit_syscall_entry(current, AUDIT_ARCH_I386, regs->orig_eax,
715 regs->ebx, regs->ecx, regs->edx, regs->esi);
716
717} 717}