In message: [linux-yocto][v5.10/standard/preempt-rt/base][PATCH] arm64: signal:
Delay calling signals in atomic
on 19/10/2021 He Zhe wrote:
> Debugging with breakpoints on arm64 and RT would trigger the following
> call trace. When CONFIG_PREEMPT_RT is enabled, spin_locks become mutexes,
> and one of these is the spin lock used in signal handling.
>
> BUG: sleeping function called from invalid context at
> kernel/locking/rtmutex.c:969
> in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 17192, name:
> multi-timer
> INFO: lockdep is turned off.
> Preemption disabled at:
> [<ffffffc01003bbf0>] debug_exception_enter+0x20/0x70
> CPU: 1 PID: 17192 Comm: multi-timer Not tainted 5.10.63-rt47-yocto-preempt-rt
> #1
> Hardware name: Freescale S32G274 (DT)
> Call trace:
> dump_backtrace+0x0/0x1d4
> show_stack+0x24/0x30
> dump_stack+0xf0/0x13c
> ___might_sleep+0x17c/0x1f0
> rt_spin_lock+0x6c/0x104
> force_sig_info_to_task+0x30/0x12c
> force_sig_fault+0x58/0x80
> arm64_force_sig_fault+0x4c/0x7c
> send_user_sigtrap+0x50/0x84
> brk_handler+0x40/0x70
> do_debug_exception+0x78/0x194
> el0_dbg+0x34/0x54
> el0_sync_handler+0x110/0x1b0
> el0_sync+0x180/0x1c0
>
> Fix potential sleep while atomic in the similar way of
> 2dbbc3a07009 ("signal/x86: Delay calling signals in atomic")
>
> Define ARCH_RT_DELAYS_SIGNAL_SEND to enable delaying action in
> force_sig_info_to_task. Add actual sending action to arm64 specific path.
>
> Link:
> https://lore.kernel.org/all/[email protected]/
> Back ported for 5.10
merged.
Bruce
> Signed-off-by: He Zhe <[email protected]>
> ---
> arch/arm64/include/asm/signal.h | 11 +++++++++++
> arch/arm64/kernel/signal.c | 8 ++++++++
> 2 files changed, 19 insertions(+)
> create mode 100644 arch/arm64/include/asm/signal.h
>
> diff --git a/arch/arm64/include/asm/signal.h b/arch/arm64/include/asm/signal.h
> new file mode 100644
> index 000000000000..dea713119b5b
> --- /dev/null
> +++ b/arch/arm64/include/asm/signal.h
> @@ -0,0 +1,11 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef __ARM64_ASM_SIGNAL_H
> +#define __ARM64_ASM_SIGNAL_H
> +
> +#include <uapi/asm/signal.h>
> +
> +#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 fe94a3e1f849..10b9ac9988a3 100644
> --- a/arch/arm64/kernel/signal.c
> +++ b/arch/arm64/kernel/signal.c
> @@ -927,6 +927,14 @@ 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);
>
> --
> 2.17.1
>
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#10558):
https://lists.yoctoproject.org/g/linux-yocto/message/10558
Mute This Topic: https://lists.yoctoproject.org/mt/86434809/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-