]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ARM: ensure interrupts are enabled in __do_user_fault()
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Fri, 5 Dec 2025 12:17:00 +0000 (12:17 +0000)
committerRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Mon, 2 Mar 2026 11:03:18 +0000 (11:03 +0000)
__do_user_fault() may be called from fault handling paths where the
interrupts are enabled or disabled. E.g. do_page_fault() calls this
with interrupts enabled, whereas do_sect_fault()->do_bad_area()
will call this with interrupts disabled. Since this is a userspace
fault, we know that interrupts were enabled in the parent context,
so call local_irq_enable() here to give a consistent interrupt state.

This is necessary for force_sig_info() when PREEMPT_RT is enabled.

Reported-by: Yadi.hu <yadi.hu@windriver.com>
Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
arch/arm/mm/fault.c

index ed4330cc3f4e6ff2217c9715dd94ac6cb70b14f8..6c27ebd4909386b4b78b03725a963ea4b86dafdf 100644 (file)
@@ -190,7 +190,8 @@ __do_kernel_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr,
 
 /*
  * Something tried to access memory that isn't in our memory map..
- * User mode accesses just cause a SIGSEGV
+ * User mode accesses just cause a SIGSEGV. Ensure interrupts are enabled
+ * for preempt RT.
  */
 static void
 __do_user_fault(unsigned long addr, unsigned int fsr, unsigned int sig,
@@ -198,6 +199,8 @@ __do_user_fault(unsigned long addr, unsigned int fsr, unsigned int sig,
 {
        struct task_struct *tsk = current;
 
+       local_irq_enable();
+
 #ifdef CONFIG_DEBUG_USER
        if (((user_debug & UDBG_SEGV) && (sig == SIGSEGV)) ||
            ((user_debug & UDBG_BUS)  && (sig == SIGBUS))) {
@@ -268,6 +271,7 @@ do_kernel_address_page_fault(struct mm_struct *mm, unsigned long addr,
                 * should not be faulting in kernel space, which includes the
                 * vector/khelper page. Handle the branch predictor hardening
                 * while interrupts are still disabled, then send a SIGSEGV.
+                * Note that __do_user_fault() will enable interrupts.
                 */
                harden_branch_predictor();
                __do_user_fault(addr, fsr, SIGSEGV, SEGV_MAPERR, regs);