Skip to content

Commit 59e4f3b

Browse files
author
Russell King (Oracle)
committed
ARM: ensure interrupts are enabled in __do_user_fault()
__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>
1 parent 05f7e89 commit 59e4f3b

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

arch/arm/mm/fault.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,14 +190,17 @@ __do_kernel_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr,
190190

191191
/*
192192
* Something tried to access memory that isn't in our memory map..
193-
* User mode accesses just cause a SIGSEGV
193+
* User mode accesses just cause a SIGSEGV. Ensure interrupts are enabled
194+
* for preempt RT.
194195
*/
195196
static void
196197
__do_user_fault(unsigned long addr, unsigned int fsr, unsigned int sig,
197198
int code, struct pt_regs *regs)
198199
{
199200
struct task_struct *tsk = current;
200201

202+
local_irq_enable();
203+
201204
#ifdef CONFIG_DEBUG_USER
202205
if (((user_debug & UDBG_SEGV) && (sig == SIGSEGV)) ||
203206
((user_debug & UDBG_BUS) && (sig == SIGBUS))) {
@@ -268,6 +271,7 @@ do_kernel_address_page_fault(struct mm_struct *mm, unsigned long addr,
268271
* should not be faulting in kernel space, which includes the
269272
* vector/khelper page. Handle the branch predictor hardening
270273
* while interrupts are still disabled, then send a SIGSEGV.
274+
* Note that __do_user_fault() will enable interrupts.
271275
*/
272276
harden_branch_predictor();
273277
__do_user_fault(addr, fsr, SIGSEGV, SEGV_MAPERR, regs);

0 commit comments

Comments
 (0)