.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
---|
3 | | - * Licensed under the GPL |
---|
4 | 4 | */ |
---|
5 | 5 | |
---|
6 | 6 | #include <linux/module.h> |
---|
7 | 7 | #include <linux/ptrace.h> |
---|
8 | 8 | #include <linux/sched.h> |
---|
| 9 | +#include <linux/ftrace.h> |
---|
9 | 10 | #include <asm/siginfo.h> |
---|
10 | 11 | #include <asm/signal.h> |
---|
11 | 12 | #include <asm/unistd.h> |
---|
12 | 13 | #include <frame_kern.h> |
---|
13 | 14 | #include <kern_util.h> |
---|
| 15 | +#include <os.h> |
---|
14 | 16 | |
---|
15 | 17 | EXPORT_SYMBOL(block_signals); |
---|
16 | 18 | EXPORT_SYMBOL(unblock_signals); |
---|
| 19 | + |
---|
| 20 | +void block_signals_trace(void) |
---|
| 21 | +{ |
---|
| 22 | + block_signals(); |
---|
| 23 | + if (current_thread_info()) |
---|
| 24 | + trace_hardirqs_off(); |
---|
| 25 | +} |
---|
| 26 | + |
---|
| 27 | +void unblock_signals_trace(void) |
---|
| 28 | +{ |
---|
| 29 | + if (current_thread_info()) |
---|
| 30 | + trace_hardirqs_on(); |
---|
| 31 | + unblock_signals(); |
---|
| 32 | +} |
---|
| 33 | + |
---|
| 34 | +void um_trace_signals_on(void) |
---|
| 35 | +{ |
---|
| 36 | + if (current_thread_info()) |
---|
| 37 | + trace_hardirqs_on(); |
---|
| 38 | +} |
---|
| 39 | + |
---|
| 40 | +void um_trace_signals_off(void) |
---|
| 41 | +{ |
---|
| 42 | + if (current_thread_info()) |
---|
| 43 | + trace_hardirqs_off(); |
---|
| 44 | +} |
---|
17 | 45 | |
---|
18 | 46 | /* |
---|
19 | 47 | * OK, we're invoking a handler |
---|
.. | .. |
---|
25 | 53 | unsigned long sp; |
---|
26 | 54 | int err; |
---|
27 | 55 | |
---|
28 | | - if ((current->ptrace & PT_DTRACE) && (current->ptrace & PT_PTRACED)) |
---|
| 56 | + if (test_thread_flag(TIF_SINGLESTEP) && (current->ptrace & PT_PTRACED)) |
---|
29 | 57 | singlestep = 1; |
---|
30 | 58 | |
---|
31 | 59 | /* Did we come from a system call? */ |
---|
.. | .. |
---|
42 | 70 | PT_REGS_SYSCALL_RET(regs) = -EINTR; |
---|
43 | 71 | break; |
---|
44 | 72 | } |
---|
45 | | - /* fallthrough */ |
---|
| 73 | + fallthrough; |
---|
46 | 74 | case -ERESTARTNOINTR: |
---|
47 | 75 | PT_REGS_RESTART_SYSCALL(regs); |
---|
48 | 76 | PT_REGS_ORIG_SYSCALL(regs) = PT_REGS_SYSCALL_NR(regs); |
---|
.. | .. |
---|
100 | 128 | * on the host. The tracing thread will check this flag and |
---|
101 | 129 | * PTRACE_SYSCALL if necessary. |
---|
102 | 130 | */ |
---|
103 | | - if (current->ptrace & PT_DTRACE) |
---|
| 131 | + if (test_thread_flag(TIF_SINGLESTEP)) |
---|
104 | 132 | current->thread.singlestep_syscall = |
---|
105 | 133 | is_syscall(PT_REGS_IP(¤t->thread.regs)); |
---|
106 | 134 | |
---|