From 85a2fd47c7ee8774700c599c05466edbe676e842 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. 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(+) Index: linux-5.15.19-rt29/arch/arm64/include/asm/signal.h =================================================================== @ linux-5.15.19-rt29/arch/arm64/include/asm/signal.h:25 @ static inline void __user *arch_untagged } #define arch_untagged_si_addr arch_untagged_si_addr +#if defined(CONFIG_PREEMPT_RT) +#define ARCH_RT_DELAYS_SIGNAL_SEND +#endif + #endif Index: linux-5.15.19-rt29/arch/arm64/kernel/signal.c =================================================================== --- linux-5.15.19-rt29.orig/arch/arm64/kernel/signal.c +++ linux-5.15.19-rt29/arch/arm64/kernel/signal.c @ linux-5.15.19-rt29/arch/arm64/include/asm/signal.h:931 @ void do_notify_resume(struct pt_regs *re } 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);