[PATCH v4 1/5] arm64/entry: Unify user mode handling

André Almeida andrealmeid at igalia.com
Sun Jul 5 10:56:51 PDT 2026


Currently, arm64 has two functions to prepare and handle context switches
from userspace: arm64_syscall_enter_from_user_mode() and
arm64_enter_from_user_mode(). The only difference is that the later calls
rseq_note_user_irq_entry() that sets rseq.event.user_irq as true.

To ensure that futex_fixup_robust_unlock() works correctly, unify the
handling from user mode functions into one that always calls
rseq_note_user_irq_entry().

Other architectures calls irqentry_enter_from_user_mode() for syscalls
and interruptions, that sets rseq.event.user_irq as well.

Signed-off-by: André Almeida <andrealmeid at igalia.com>
---
 arch/arm64/kernel/entry-common.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/arch/arm64/kernel/entry-common.c b/arch/arm64/kernel/entry-common.c
index ceb4eb11232a..fd62ee585b52 100644
--- a/arch/arm64/kernel/entry-common.c
+++ b/arch/arm64/kernel/entry-common.c
@@ -62,13 +62,6 @@ static void noinstr arm64_exit_to_kernel_mode(struct pt_regs *regs,
 	irqentry_exit_to_kernel_mode_after_preempt(regs, state);
 }
 
-static __always_inline void arm64_syscall_enter_from_user_mode(struct pt_regs *regs)
-{
-	enter_from_user_mode(regs);
-	mte_disable_tco_entry(current);
-	sme_enter_from_user_mode();
-}
-
 /*
  * Handle IRQ/context state management when entering from user mode.
  * Before this function is called it is not safe to call regular kernel code,
@@ -729,7 +722,7 @@ static void noinstr el0_brk64(struct pt_regs *regs, unsigned long esr)
 
 static void noinstr el0_svc(struct pt_regs *regs)
 {
-	arm64_syscall_enter_from_user_mode(regs);
+	arm64_enter_from_user_mode(regs);
 	cortex_a76_erratum_1463225_svc_handler();
 	fpsimd_syscall_enter();
 	local_daif_restore(DAIF_PROCCTX);
@@ -881,7 +874,7 @@ static void noinstr el0_cp15(struct pt_regs *regs, unsigned long esr)
 
 static void noinstr el0_svc_compat(struct pt_regs *regs)
 {
-	arm64_syscall_enter_from_user_mode(regs);
+	arm64_enter_from_user_mode(regs);
 	cortex_a76_erratum_1463225_svc_handler();
 	local_daif_restore(DAIF_PROCCTX);
 	do_el0_svc_compat(regs);

-- 
2.54.0




More information about the linux-arm-kernel mailing list