diff options
Diffstat (limited to 'arch/x86/kernel/ptrace.c')
-rw-r--r-- | arch/x86/kernel/ptrace.c | 36 |
1 files changed, 7 insertions, 29 deletions
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c index e37dccce85db..9e43a48ad6e0 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> |
@@ -69,7 +70,7 @@ static inline bool invalid_selector(u16 value) | |||
69 | 70 | ||
70 | #define FLAG_MASK FLAG_MASK_32 | 71 | #define FLAG_MASK FLAG_MASK_32 |
71 | 72 | ||
72 | static long *pt_regs_access(struct pt_regs *regs, unsigned long regno) | 73 | static unsigned long *pt_regs_access(struct pt_regs *regs, unsigned long regno) |
73 | { | 74 | { |
74 | BUILD_BUG_ON(offsetof(struct pt_regs, bx) != 0); | 75 | BUILD_BUG_ON(offsetof(struct pt_regs, bx) != 0); |
75 | regno >>= 2; | 76 | regno >>= 2; |
@@ -1375,30 +1376,6 @@ void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code) | |||
1375 | force_sig_info(SIGTRAP, &info, tsk); | 1376 | force_sig_info(SIGTRAP, &info, tsk); |
1376 | } | 1377 | } |
1377 | 1378 | ||
1378 | static void syscall_trace(struct pt_regs *regs) | ||
1379 | { | ||
1380 | if (!(current->ptrace & PT_PTRACED)) | ||
1381 | return; | ||
1382 | |||
1383 | #if 0 | ||
1384 | printk("trace %s ip %lx sp %lx ax %d origrax %d caller %lx tiflags %x ptrace %x\n", | ||
1385 | current->comm, | ||
1386 | regs->ip, regs->sp, regs->ax, regs->orig_ax, __builtin_return_address(0), | ||
1387 | current_thread_info()->flags, current->ptrace); | ||
1388 | #endif | ||
1389 | |||
1390 | ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) | ||
1391 | ? 0x80 : 0)); | ||
1392 | /* | ||
1393 | * this isn't the same as continuing with a signal, but it will do | ||
1394 | * for normal use. strace only continues with a signal if the | ||
1395 | * stopping signal is not SIGTRAP. -brl | ||
1396 | */ | ||
1397 | if (current->exit_code) { | ||
1398 | send_sig(current->exit_code, current, 1); | ||
1399 | current->exit_code = 0; | ||
1400 | } | ||
1401 | } | ||
1402 | 1379 | ||
1403 | #ifdef CONFIG_X86_32 | 1380 | #ifdef CONFIG_X86_32 |
1404 | # define IS_IA32 1 | 1381 | # define IS_IA32 1 |
@@ -1432,8 +1409,9 @@ asmregparm long syscall_trace_enter(struct pt_regs *regs) | |||
1432 | if (unlikely(test_thread_flag(TIF_SYSCALL_EMU))) | 1409 | if (unlikely(test_thread_flag(TIF_SYSCALL_EMU))) |
1433 | ret = -1L; | 1410 | ret = -1L; |
1434 | 1411 | ||
1435 | if (ret || test_thread_flag(TIF_SYSCALL_TRACE)) | 1412 | if ((ret || test_thread_flag(TIF_SYSCALL_TRACE)) && |
1436 | syscall_trace(regs); | 1413 | tracehook_report_syscall_entry(regs)) |
1414 | ret = -1L; | ||
1437 | 1415 | ||
1438 | if (unlikely(current->audit_context)) { | 1416 | if (unlikely(current->audit_context)) { |
1439 | if (IS_IA32) | 1417 | if (IS_IA32) |
@@ -1459,7 +1437,7 @@ asmregparm void syscall_trace_leave(struct pt_regs *regs) | |||
1459 | audit_syscall_exit(AUDITSC_RESULT(regs->ax), regs->ax); | 1437 | audit_syscall_exit(AUDITSC_RESULT(regs->ax), regs->ax); |
1460 | 1438 | ||
1461 | if (test_thread_flag(TIF_SYSCALL_TRACE)) | 1439 | if (test_thread_flag(TIF_SYSCALL_TRACE)) |
1462 | syscall_trace(regs); | 1440 | tracehook_report_syscall_exit(regs, 0); |
1463 | 1441 | ||
1464 | /* | 1442 | /* |
1465 | * If TIF_SYSCALL_EMU is set, we only get here because of | 1443 | * If TIF_SYSCALL_EMU is set, we only get here because of |
@@ -1475,6 +1453,6 @@ asmregparm void syscall_trace_leave(struct pt_regs *regs) | |||
1475 | * system call instruction. | 1453 | * system call instruction. |
1476 | */ | 1454 | */ |
1477 | if (test_thread_flag(TIF_SINGLESTEP) && | 1455 | if (test_thread_flag(TIF_SINGLESTEP) && |
1478 | (current->ptrace & PT_PTRACED)) | 1456 | tracehook_consider_fatal_signal(current, SIGTRAP, SIG_DFL)) |
1479 | send_sigtrap(current, regs, 0); | 1457 | send_sigtrap(current, regs, 0); |
1480 | } | 1458 | } |