arm64: signal: Use ARCH_RT_DELAYS_SIGNAL_SEND
PATCH 1/1 arm64: signal: Use ARCH_RT_DELAYS_SIGNAL_SEND
From: Wang Yong <[email protected]>
The ltp test prompts the following bug information under the 5.10 kernel:
BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:969 in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 796, name: cat Preemption disabled at: [<ffffffe40f433980>] do_debug_exception+0x60/0x180 CPU: 3 PID: 796 Comm: cat Not tainted 5.10.59-rt52-KERNEL_VERSION #38 Hardware name: linux,dummy-virt (DT) Call trace: dump_backtrace+0x0/0x198 show_stack+0x20/0x30 dump_stack+0xf0/0x13c ___might_sleep+0x140/0x178 rt_spin_lock+0x30/0x90 force_sig_info_to_task+0x30/0xe0 force_sig_fault_to_task+0x54/0x78 force_sig_fault+0x1c/0x28 arm64_force_sig_fault+0x48/0x78 send_user_sigtrap+0x4c/0x80 brk_handler+0x3c/0x68 do_debug_exception+0xac/0x180 el0_dbg+0x34/0x58 el0_sync_handler+0x50/0xb8 el0_sync+0x180/0x1c0
It has been fixed by0c34700de5e7 ("arm64: signal: Use ARCH_RT_DELAYS_SIGNAL_SEND.") in higher versions of the kernel. This patch needs to be compatible with 5.10. 5.10 kernel does not have signal.h file, so adding signal.h file to define ARCH_RT_DELAYS_SIGNAL_SEND.
--- arch/arm64/include/asm/signal.h | 12 ++++++++++++ arch/arm64/kernel/signal.c | 9 +++++++++ 2 files changed, 21 insertions(+) create mode 100644 arch/arm64/include/asm/signal.h
arch/arm64/include/asm/signal.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ARM64_ASM_SIGNAL_H +#define __ARM64_ASM_SIGNAL_H + +#include <uapi/asm/signal.h> +#include <uapi/asm/siginfo.h> + +#if defined(CONFIG_PREEMPT_RT ) +#define ARCH_RT_DELAYS_SIGNAL_SEND +#endif + +#endif
arch/arm64/kernel/signal.c +9 -0
@@ -927,6 +927,15 @@ asmlinkage void do_notify_resume(struct pt_regs *regs, }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);
Signature · 1 line
2.25.1
Quoted 32 lines · On Tue, Sep 12, 2023 at 03:14:28PM +0800, [email protected] wrote:
From: Wang Yong <[email protected]>
The ltp test prompts the following bug information under the 5.10 kernel:
BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:969 in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 796, name: cat Preemption disabled at: [<ffffffe40f433980>] do_debug_exception+0x60/0x180 CPU: 3 PID: 796 Comm: cat Not tainted 5.10.59-rt52-KERNEL_VERSION #38 Hardware name: linux,dummy-virt (DT) Call trace: dump_backtrace+0x0/0x198 show_stack+0x20/0x30 dump_stack+0xf0/0x13c ___might_sleep+0x140/0x178 rt_spin_lock+0x30/0x90 force_sig_info_to_task+0x30/0xe0 force_sig_fault_to_task+0x54/0x78 force_sig_fault+0x1c/0x28 arm64_force_sig_fault+0x48/0x78 send_user_sigtrap+0x4c/0x80 brk_handler+0x3c/0x68 do_debug_exception+0xac/0x180 el0_dbg+0x34/0x58 el0_sync_handler+0x50/0xb8 el0_sync+0x180/0x1c0It has been fixed by
0c34700de5e7("arm64: signal: UseARCH_RT_DELAYS_SIGNAL_SEND.") in higher versions of the kernel. This patch needs to be compatible with 5.10. 5.10 kernel does not havesignal.hfile, so addingsignal.hfile to defineARCH_RT_DELAYS_SIGNAL_SEND.
Quoted 5 lines
Signed-off-by Wang Yong <[email protected]>Cc Xuexin Jiang <[email protected]>Cc Yang Yang <[email protected]>Cc Xiaokai Ran <[email protected]>---
Thank you for this fix. I will add it to the release candidate that will be posted on Friday.
Best regards,
Luis
Quoted 46 lines
arch/arm64/include/asm/signal.h | 12 ++++++++++++ arch/arm64/kernel/signal.c | 9 +++++++++ 2 files changed, 21 insertions(+) create mode 100644 arch/arm64/include/asm/signal.harch/arm64/include/asm/signal.h new file +12
-0@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ARM64_ASM_SIGNAL_H +#define __ARM64_ASM_SIGNAL_H + +#include <uapi/asm/signal.h> +#include <uapi/asm/siginfo.h> + +#if defined(CONFIG_PREEMPT_RT ) +#define ARCH_RT_DELAYS_SIGNAL_SEND +#endif + +#endif arch/arm64/kernel/signal.c +9
-0@@ -927,6 +927,15 @@ asmlinkage void do_notify_resume(struct pt_regs *regs, }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);Signature · 1 line
2.25.1
---end quoted text---