From: "Yadi.hu" <yadi.hu@windriver.com>
Date: Wed, 29 Oct 2025 11:55:30 +0100
Subject: [PATCH v2 2/5] ARM: mm: fault: Enable interrupts before invoking
 __do_user_fault()

In the !LPAE case __do_user_fault() is invoked from do_bad_area(). If a
user pointer cause the page fault then a signal is sent.

Sending a signal requires to acquire sighand_struct::siglock which is a
spinlock_t. On PREEMPT_RT spinlock_t becomes a sleeping spin lock which
requires interrupts to be enabled. Since the calling context is user
land, interrupts must have been enabled so it is fine to enable them in
this case.

Enable interrupts in do_bad_area() before invoking __do_user_fault().

[bigeasy: Initial patch/ report by Yadi. Maintained the patch and redid
          the patch description since]

Signed-off-by: Yadi.hu <yadi.hu@windriver.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 arch/arm/mm/fault.c |    1 +
 1 file changed, 1 insertion(+)

@ arch/arm/mm/fault.c:221 @ void do_bad_area(unsigned long addr, uns
 	if (user_mode(regs)) {
 		if (addr >= TASK_SIZE)
 			harden_branch_predictor();
+		local_irq_enable();
 		__do_user_fault(addr, fsr, SIGSEGV, SEGV_MAPERR, regs);
 	} else {
 		__do_kernel_fault(mm, addr, fsr, regs);