[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260125164016.331257-5-qq570070308@gmail.com>
Date: Mon, 26 Jan 2026 00:40:11 +0800
From: Xie Yuanbin <qq570070308@...il.com>
To: linux@...linux.org.uk,
johannes@...solutions.net,
masahiroy@...nel.org,
jgross@...e.com,
nsc@...nel.org,
kees@...nel.org,
tglx@...nel.org,
mingo@...nel.org,
frederic@...nel.org,
paulmck@...nel.org,
peterz@...radead.org,
mathieu.desnoyers@...icios.com,
luto@...nel.org,
edumazet@...gle.com
Cc: linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org,
Xie Yuanbin <qq570070308@...il.com>
Subject: [PATCH 4/9] ARM: entry: use exit_to_user_mode() instead of user_enter_callable()
According to user_enter_callable()'s comment, the function is obsolete.
Since exit_to_user_mode() is a inline function, add
arm_exit_to_user_mode_no_work_pending() to call exit_to_user_mode(),
thereby replacing user_enter_callable() and asm_trace_hardirqs_on().
Also move stackleak_erase_on_task_stack() to
arm_exit_to_user_mode_no_work_pending().
Signed-off-by: Xie Yuanbin <qq570070308@...il.com>
---
arch/arm/include/asm/entry-common.h | 8 ++++++++
arch/arm/kernel/Makefile | 2 +-
arch/arm/kernel/entry-common.S | 10 +---------
arch/arm/kernel/entry.c | 20 ++++++++++++++++++++
4 files changed, 30 insertions(+), 10 deletions(-)
create mode 100644 arch/arm/include/asm/entry-common.h
create mode 100644 arch/arm/kernel/entry.c
diff --git a/arch/arm/include/asm/entry-common.h b/arch/arm/include/asm/entry-common.h
new file mode 100644
index 000000000000..d34c80d4b32b
--- /dev/null
+++ b/arch/arm/include/asm/entry-common.h
@@ -0,0 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef ARCH_ARM_ENTRY_COMMON_H
+#define ARCH_ARM_ENTRY_COMMON_H
+
+asmlinkage __section(".entry.text")
+void arm_exit_to_user_mode_no_work_pending(void);
+
+#endif
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
index b36cf0cfd4a7..e8a855d73055 100644
--- a/arch/arm/kernel/Makefile
+++ b/arch/arm/kernel/Makefile
@@ -17,7 +17,7 @@ CFLAGS_REMOVE_return_address.o = -pg
# Object file lists.
-obj-y := elf.o entry-common.o irq.o opcodes.o \
+obj-y := elf.o entry-common.o entry.o irq.o opcodes.o \
process.o ptrace.o reboot.o io.o \
setup.o signal.o sigreturn_codes.o \
stacktrace.o sys_arm.o time.o traps.o
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index 0e462bbede2f..108b77e2b405 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -113,15 +113,7 @@ ENTRY(ret_to_user_from_irq)
movs r1, r1, lsl #16
bne slow_work_pending
no_work_pending:
-#ifdef CONFIG_CONTEXT_TRACKING_USER
- bl user_enter_callable
-#endif
-
- asm_trace_hardirqs_on save = 0
-
-#ifdef CONFIG_KSTACK_ERASE
- bl stackleak_erase_on_task_stack
-#endif
+ bl arm_exit_to_user_mode_no_work_pending
restore_user_regs fast = 0, offset = 0
ENDPROC(ret_to_user_from_irq)
ENDPROC(ret_to_user)
diff --git a/arch/arm/kernel/entry.c b/arch/arm/kernel/entry.c
new file mode 100644
index 000000000000..d32f7be9a107
--- /dev/null
+++ b/arch/arm/kernel/entry.c
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include <linux/linkage.h>
+#include <linux/irq-entry-common.h>
+#include <linux/kstack_erase.h>
+
+/*
+ * arm_exit_to_user_mode_no_work_pending - Fixup state when exiting to user mode
+ *
+ * The calling code satisfies (arch_irqs_disabled() && !lockdep_hardirqs_enabled()).
+ * When the function returns, the state satisfies (arch_irqs_disabled() &&
+ * lockdep_hardirqs_enabled()).
+ */
+asmlinkage __section(".entry.text")
+void arm_exit_to_user_mode_no_work_pending(void)
+{
+ exit_to_user_mode();
+#ifdef CONFIG_KSTACK_ERASE
+ stackleak_erase_on_task_stack();
+#endif
+}
--
2.51.0
Powered by blists - more mailing lists