Linux-rt-users archive mirror
 help / color / mirror / Atom feed
From: <yang.yang29@zte.com.cn>
To: <catalin.marinas@arm.com>, <will@kernel.org>,
	<bigeasy@linutronix.de>, <linux-arm-kernel@lists.infradead.org>,
	<stable-rt@vger.kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <he.he@windriver.com>,
	<linux-rt-users@vger.kernel.org>, <wang.yong12@zte.com.cn>,
	<yang.yang29@zte.com.cn>, <ran.xiaokai@zte.com.cn>,
	<jiang.xuexin@zte.com.cn>
Subject: [PATCH 5.10-rt] arm64: signal: Use ARCH_RT_DELAYS_SIGNAL_SEND
Date: Tue, 12 Sep 2023 15:14:28 +0800 (CST)	[thread overview]
Message-ID: <202309121514283793475@zte.com.cn> (raw)

From: Wang Yong <wang.yong12@zte.com.cn>

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 by
0c34700de5e7 ("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.

Signed-off-by: Wang Yong <wang.yong12@zte.com.cn>
Cc: Xuexin Jiang <jiang.xuexin@zte.com.cn>
Cc: Yang Yang <yang.yang29@zte.com.cn>
Cc: Xiaokai Ran <ran.xiaokai@zte.com.cn>
---
 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

diff --git a/arch/arm64/include/asm/signal.h b/arch/arm64/include/asm/signal.h
new file mode 100644
index 000000000..0fb418cf4
--- /dev/null
+++ b/arch/arm64/include/asm/signal.h
@@ -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
diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c
index fe94a3e1f..538d4aadb 100644
--- a/arch/arm64/kernel/signal.c
+++ b/arch/arm64/kernel/signal.c
@@ -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);

-- 
2.25.1

             reply	other threads:[~2023-09-12  7:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-12  7:14 yang.yang29 [this message]
2023-09-13 22:56 ` [PATCH 5.10-rt] arm64: signal: Use ARCH_RT_DELAYS_SIGNAL_SEND Luis Claudio R. Goncalves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202309121514283793475@zte.com.cn \
    --to=yang.yang29@zte.com.cn \
    --cc=bigeasy@linutronix.de \
    --cc=catalin.marinas@arm.com \
    --cc=he.he@windriver.com \
    --cc=jiang.xuexin@zte.com.cn \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=ran.xiaokai@zte.com.cn \
    --cc=stable-rt@vger.kernel.org \
    --cc=wang.yong12@zte.com.cn \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).