diff options
Diffstat (limited to 'arch/x86/kernel/ptrace.c')
-rw-r--r-- | arch/x86/kernel/ptrace.c | 34 |
1 files changed, 6 insertions, 28 deletions
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c index d00e756c05af..e375b658efc3 100644 --- a/arch/x86/kernel/ptrace.c +++ b/arch/x86/kernel/ptrace.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/errno.h> | 14 | #include <linux/errno.h> |
15 | #include <linux/ptrace.h> | 15 | #include <linux/ptrace.h> |
16 | #include <linux/regset.h> | 16 | #include <linux/regset.h> |
17 | #include <linux/tracehook.h> | ||
17 | #include <linux/user.h> | 18 | #include <linux/user.h> |
18 | #include <linux/elf.h> | 19 | #include <linux/elf.h> |
19 | #include <linux/security.h> | 20 | #include <linux/security.h> |
@@ -1469,30 +1470,6 @@ void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code) | |||
1469 | force_sig_info(SIGTRAP, &info, tsk); | 1470 | force_sig_info(SIGTRAP, &info, tsk); |
1470 | } | 1471 | } |
1471 | 1472 | ||
1472 | static void syscall_trace(struct pt_regs *regs) | ||
1473 | { | ||
1474 | if (!(current->ptrace & PT_PTRACED)) | ||
1475 | return; | ||
1476 | |||
1477 | #if 0 | ||
1478 | printk("trace %s ip %lx sp %lx ax %d origrax %d caller %lx tiflags %x ptrace %x\n", | ||
1479 | current->comm, | ||
1480 | regs->ip, regs->sp, regs->ax, regs->orig_ax, __builtin_return_address(0), | ||
1481 | current_thread_info()->flags, current->ptrace); | ||
1482 | #endif | ||
1483 | |||
1484 | ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) | ||
1485 | ? 0x80 : 0)); | ||
1486 | /* | ||
1487 | * this isn't the same as continuing with a signal, but it will do | ||
1488 | * for normal use. strace only continues with a signal if the | ||
1489 | * stopping signal is not SIGTRAP. -brl | ||
1490 | */ | ||
1491 | if (current->exit_code) { | ||
1492 | send_sig(current->exit_code, current, 1); | ||
1493 | current->exit_code = 0; | ||
1494 | } | ||
1495 | } | ||
1496 | 1473 | ||
1497 | #ifdef CONFIG_X86_32 | 1474 | #ifdef CONFIG_X86_32 |
1498 | # define IS_IA32 1 | 1475 | # define IS_IA32 1 |
@@ -1526,8 +1503,9 @@ asmregparm long syscall_trace_enter(struct pt_regs *regs) | |||
1526 | if (unlikely(test_thread_flag(TIF_SYSCALL_EMU))) | 1503 | if (unlikely(test_thread_flag(TIF_SYSCALL_EMU))) |
1527 | ret = -1L; | 1504 | ret = -1L; |
1528 | 1505 | ||
1529 | if (ret || test_thread_flag(TIF_SYSCALL_TRACE)) | 1506 | if ((ret || test_thread_flag(TIF_SYSCALL_TRACE)) && |
1530 | syscall_trace(regs); | 1507 | tracehook_report_syscall_entry(regs)) |
1508 | ret = -1L; | ||
1531 | 1509 | ||
1532 | if (unlikely(current->audit_context)) { | 1510 | if (unlikely(current->audit_context)) { |
1533 | if (IS_IA32) | 1511 | if (IS_IA32) |
@@ -1553,7 +1531,7 @@ asmregparm void syscall_trace_leave(struct pt_regs *regs) | |||
1553 | audit_syscall_exit(AUDITSC_RESULT(regs->ax), regs->ax); | 1531 | audit_syscall_exit(AUDITSC_RESULT(regs->ax), regs->ax); |
1554 | 1532 | ||
1555 | if (test_thread_flag(TIF_SYSCALL_TRACE)) | 1533 | if (test_thread_flag(TIF_SYSCALL_TRACE)) |
1556 | syscall_trace(regs); | 1534 | tracehook_report_syscall_exit(regs, 0); |
1557 | 1535 | ||
1558 | /* | 1536 | /* |
1559 | * If TIF_SYSCALL_EMU is set, we only get here because of | 1537 | * If TIF_SYSCALL_EMU is set, we only get here because of |
@@ -1569,6 +1547,6 @@ asmregparm void syscall_trace_leave(struct pt_regs *regs) | |||
1569 | * system call instruction. | 1547 | * system call instruction. |
1570 | */ | 1548 | */ |
1571 | if (test_thread_flag(TIF_SINGLESTEP) && | 1549 | if (test_thread_flag(TIF_SINGLESTEP) && |
1572 | (current->ptrace & PT_PTRACED)) | 1550 | tracehook_consider_fatal_signal(current, SIGTRAP, SIG_DFL)) |
1573 | send_sigtrap(current, regs, 0); | 1551 | send_sigtrap(current, regs, 0); |
1574 | } | 1552 | } |