hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/arch/um/kernel/signal.c
....@@ -1,19 +1,47 @@
1
+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3
- * Licensed under the GPL
44 */
55
66 #include <linux/module.h>
77 #include <linux/ptrace.h>
88 #include <linux/sched.h>
9
+#include <linux/ftrace.h>
910 #include <asm/siginfo.h>
1011 #include <asm/signal.h>
1112 #include <asm/unistd.h>
1213 #include <frame_kern.h>
1314 #include <kern_util.h>
15
+#include <os.h>
1416
1517 EXPORT_SYMBOL(block_signals);
1618 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
+}
1745
1846 /*
1947 * OK, we're invoking a handler
....@@ -25,7 +53,7 @@
2553 unsigned long sp;
2654 int err;
2755
28
- if ((current->ptrace & PT_DTRACE) && (current->ptrace & PT_PTRACED))
56
+ if (test_thread_flag(TIF_SINGLESTEP) && (current->ptrace & PT_PTRACED))
2957 singlestep = 1;
3058
3159 /* Did we come from a system call? */
....@@ -42,7 +70,7 @@
4270 PT_REGS_SYSCALL_RET(regs) = -EINTR;
4371 break;
4472 }
45
- /* fallthrough */
73
+ fallthrough;
4674 case -ERESTARTNOINTR:
4775 PT_REGS_RESTART_SYSCALL(regs);
4876 PT_REGS_ORIG_SYSCALL(regs) = PT_REGS_SYSCALL_NR(regs);
....@@ -100,7 +128,7 @@
100128 * on the host. The tracing thread will check this flag and
101129 * PTRACE_SYSCALL if necessary.
102130 */
103
- if (current->ptrace & PT_DTRACE)
131
+ if (test_thread_flag(TIF_SINGLESTEP))
104132 current->thread.singlestep_syscall =
105133 is_syscall(PT_REGS_IP(&current->thread.regs));
106134