summaryrefslogtreecommitdiffstats
path: root/debian/patches-rt/0146-arm64-signal-Use-ARCH_RT_DELAYS_SIGNAL_SEND.patch
blob: 0511181cd2c6f728bf57686e546421cb3cfea529 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
From a6ab6c02e3ad5281a679066578d54a90af435b98 Mon Sep 17 00:00:00 2001
From: He Zhe <zhe.he@windriver.com>
Date: Tue, 12 Oct 2021 16:44:21 +0800
Subject: [PATCH 146/158] arm64: signal: Use ARCH_RT_DELAYS_SIGNAL_SEND.
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/5.15/older/patches-5.15.10-rt24.tar.xz

The software breakpoint is handled via do_debug_exception() which
disables preemption. On PREEMPT_RT spinlock_t become sleeping locks and
must not be acquired with disabled preemption.

Use ARCH_RT_DELAYS_SIGNAL_SEND so the signal (from send_user_sigtrap())
is sent delayed in return to userland.

Cc: stable-rt@vger.kernel.org
Signed-off-by: He Zhe <zhe.he@windriver.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Link: https://lore.kernel.org/r/20211012084421.35136-1-zhe.he@windriver.com
---
 arch/arm64/include/asm/signal.h | 4 ++++
 arch/arm64/kernel/signal.c      | 8 ++++++++
 2 files changed, 12 insertions(+)

diff --git a/arch/arm64/include/asm/signal.h b/arch/arm64/include/asm/signal.h
index ef449f5f4ba8..5e535c3e4926 100644
--- a/arch/arm64/include/asm/signal.h
+++ b/arch/arm64/include/asm/signal.h
@@ -22,4 +22,8 @@ static inline void __user *arch_untagged_si_addr(void __user *addr,
 }
 #define arch_untagged_si_addr arch_untagged_si_addr
 
+#if defined(CONFIG_PREEMPT_RT)
+#define ARCH_RT_DELAYS_SIGNAL_SEND
+#endif
+
 #endif
diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c
index 8a9194ed981c..1d65f2801e13 100644
--- a/arch/arm64/kernel/signal.c
+++ b/arch/arm64/kernel/signal.c
@@ -928,6 +928,14 @@ void do_notify_resume(struct pt_regs *regs, unsigned long thread_flags)
 		} else {
 			local_daif_restore(DAIF_PROCCTX);
 
+#ifdef ARCH_RT_DELAYS_SIGNAL_SEND
+			if (unlikely(current->forced_info.si_signo)) {
+				struct task_struct *t = current;
+				force_sig_info(&t->forced_info);
+				t->forced_info.si_signo = 0;
+			}
+#endif
+
 			if (thread_flags & _TIF_UPROBE)
 				uprobe_notify_resume(regs);
 
-- 
2.33.1