mm: Fixup all fault handlers to check current->pagefault_disable
Necessary for decoupling pagefault disable from preempt count. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:
parent
9a34aa5f5a
commit
caf7963976
|
@ -107,7 +107,7 @@ do_page_fault(unsigned long address, unsigned long mmcsr,
|
|||
|
||||
/* If we're in an interrupt context, or have no user context,
|
||||
we must not take the fault. */
|
||||
if (!mm || in_atomic())
|
||||
if (!mm || in_atomic() || current->pagefault_disabled)
|
||||
goto no_context;
|
||||
|
||||
#ifdef CONFIG_ALPHA_LARGE_VMALLOC
|
||||
|
|
|
@ -277,7 +277,7 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
|
|||
* If we're in an interrupt or have no user
|
||||
* context, we must not take the fault..
|
||||
*/
|
||||
if (in_atomic() || !mm)
|
||||
if (in_atomic() || !mm || current->pagefault_disabled)
|
||||
goto no_context;
|
||||
|
||||
if (user_mode(regs))
|
||||
|
|
|
@ -81,7 +81,8 @@ asmlinkage void do_page_fault(unsigned long ecr, struct pt_regs *regs)
|
|||
* If we're in an interrupt or have no user context, we must
|
||||
* not take the fault...
|
||||
*/
|
||||
if (in_atomic() || !mm || regs->sr & SYSREG_BIT(GM))
|
||||
if (in_atomic() || !mm || regs->sr & SYSREG_BIT(GM) ||
|
||||
current->pagefault_disabled)
|
||||
goto no_context;
|
||||
|
||||
local_irq_enable();
|
||||
|
|
|
@ -113,7 +113,7 @@ do_page_fault(unsigned long address, struct pt_regs *regs,
|
|||
* user context, we must not take the fault.
|
||||
*/
|
||||
|
||||
if (in_atomic() || !mm)
|
||||
if (in_atomic() || !mm || current->pagefault_disabled)
|
||||
goto no_context;
|
||||
|
||||
if (user_mode(regs))
|
||||
|
|
|
@ -78,7 +78,7 @@ asmlinkage void do_page_fault(int datammu, unsigned long esr0, unsigned long ear
|
|||
* If we're in an interrupt or have no user
|
||||
* context, we must not take the fault..
|
||||
*/
|
||||
if (in_atomic() || !mm)
|
||||
if (in_atomic() || !mm || current->pagefault_disabled)
|
||||
goto no_context;
|
||||
|
||||
if (user_mode(__frame))
|
||||
|
|
|
@ -96,7 +96,7 @@ ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *re
|
|||
/*
|
||||
* If we're in an interrupt or have no user context, we must not take the fault..
|
||||
*/
|
||||
if (in_atomic() || !mm)
|
||||
if (in_atomic() || !mm || current->pagefault_disabled)
|
||||
goto no_context;
|
||||
|
||||
#ifdef CONFIG_VIRTUAL_MEM_MAP
|
||||
|
|
|
@ -114,7 +114,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code,
|
|||
* If we're in an interrupt or have no user context or are running in an
|
||||
* atomic region then we must not take the fault..
|
||||
*/
|
||||
if (in_atomic() || !mm)
|
||||
if (in_atomic() || !mm || current->pagefault_disabled
|
||||
goto bad_area_nosemaphore;
|
||||
|
||||
if (error_code & ACE_USERMODE)
|
||||
|
|
|
@ -81,7 +81,7 @@ int do_page_fault(struct pt_regs *regs, unsigned long address,
|
|||
* If we're in an interrupt or have no user
|
||||
* context, we must not take the fault..
|
||||
*/
|
||||
if (in_atomic() || !mm)
|
||||
if (in_atomic() || !mm || current->pagefault_disabled)
|
||||
goto no_context;
|
||||
|
||||
if (user_mode(regs))
|
||||
|
|
|
@ -107,7 +107,7 @@ void do_page_fault(struct pt_regs *regs, unsigned long address,
|
|||
if ((error_code & 0x13) == 0x13 || (error_code & 0x11) == 0x11)
|
||||
is_write = 0;
|
||||
|
||||
if (unlikely(in_atomic() || !mm)) {
|
||||
if (unlikely(in_atomic() || !mm || current->pagefault_disabled)) {
|
||||
if (kernel_mode(regs))
|
||||
goto bad_area_nosemaphore;
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ static void __kprobes __do_page_fault(struct pt_regs *regs, unsigned long write,
|
|||
* If we're in an interrupt or have no user
|
||||
* context, we must not take the fault..
|
||||
*/
|
||||
if (in_atomic() || !mm)
|
||||
if (in_atomic() || !mm || current->pagefault_disabled)
|
||||
goto bad_area_nosemaphore;
|
||||
|
||||
if (user_mode(regs))
|
||||
|
|
|
@ -168,7 +168,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long fault_code,
|
|||
* If we're in an interrupt or have no user
|
||||
* context, we must not take the fault..
|
||||
*/
|
||||
if (in_atomic() || !mm)
|
||||
if (in_atomic() || !mm || current->pagefault_disabled)
|
||||
goto no_context;
|
||||
|
||||
if ((fault_code & MMUFCR_xFC_ACCESS) == MMUFCR_xFC_ACCESS_USR)
|
||||
|
|
|
@ -207,7 +207,7 @@ void do_page_fault(struct pt_regs *regs, unsigned long code,
|
|||
int fault;
|
||||
unsigned int flags;
|
||||
|
||||
if (in_atomic())
|
||||
if (in_atomic() || current->pagefault_disabled)
|
||||
goto no_context;
|
||||
|
||||
tsk = current;
|
||||
|
|
|
@ -261,7 +261,7 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
|
|||
if (!arch_irq_disabled_regs(regs))
|
||||
local_irq_enable();
|
||||
|
||||
if (in_atomic() || mm == NULL) {
|
||||
if (in_atomic() || mm == NULL || current->pagefault_disabled) {
|
||||
if (!user_mode(regs)) {
|
||||
rc = SIGSEGV;
|
||||
goto bail;
|
||||
|
|
|
@ -297,7 +297,8 @@ static inline int do_exception(struct pt_regs *regs, int access)
|
|||
* user context.
|
||||
*/
|
||||
fault = VM_FAULT_BADCONTEXT;
|
||||
if (unlikely(!user_space_fault(trans_exc_code) || in_atomic() || !mm))
|
||||
if (unlikely(!user_space_fault(trans_exc_code) || in_atomic() || !mm ||
|
||||
tsk->pagefault_disabled))
|
||||
goto out;
|
||||
|
||||
address = trans_exc_code & __FAIL_ADDR_MASK;
|
||||
|
|
|
@ -73,7 +73,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long write,
|
|||
* If we're in an interrupt or have no user
|
||||
* context, we must not take the fault..
|
||||
*/
|
||||
if (in_atomic() || !mm)
|
||||
if (in_atomic() || !mm || current->pagefault_disabled)
|
||||
goto bad_area_nosemaphore;
|
||||
|
||||
if (user_mode(regs))
|
||||
|
|
|
@ -440,7 +440,7 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
|
|||
* If we're in an interrupt, have no user context or are running
|
||||
* in an atomic region then we must not take the fault:
|
||||
*/
|
||||
if (unlikely(in_atomic() || !mm)) {
|
||||
if (unlikely(in_atomic() || !mm || current->pagefault_disabled)) {
|
||||
bad_area_nosemaphore(regs, error_code, address);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -199,7 +199,7 @@ asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write,
|
|||
* If we're in an interrupt or have no user
|
||||
* context, we must not take the fault..
|
||||
*/
|
||||
if (in_atomic() || !mm)
|
||||
if (in_atomic() || !mm || current->pagefault_disabled)
|
||||
goto no_context;
|
||||
|
||||
perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
|
||||
|
|
|
@ -332,7 +332,7 @@ asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs)
|
|||
* If we're in an interrupt or have no user
|
||||
* context, we must not take the fault..
|
||||
*/
|
||||
if (in_atomic() || !mm)
|
||||
if (in_atomic() || !mm || current->pagefault_enabled)
|
||||
goto intr_or_no_mm;
|
||||
|
||||
perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
|
||||
|
|
|
@ -357,7 +357,7 @@ static int handle_page_fault(struct pt_regs *regs,
|
|||
* If we're in an interrupt, have no user context or are running in an
|
||||
* atomic region then we must not take the fault.
|
||||
*/
|
||||
if (in_atomic() || !mm) {
|
||||
if (in_atomic() || !mm || current->pagefault_disabled) {
|
||||
vma = NULL; /* happy compiler */
|
||||
goto bad_area_nosemaphore;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ int handle_page_fault(unsigned long address, unsigned long ip,
|
|||
* If the fault was during atomic operation, don't take the fault, just
|
||||
* fail.
|
||||
*/
|
||||
if (in_atomic())
|
||||
if (in_atomic() || current->pagefault_disabled)
|
||||
goto out_nosemaphore;
|
||||
|
||||
if (is_user)
|
||||
|
|
|
@ -1098,7 +1098,7 @@ __do_page_fault(struct pt_regs *regs, unsigned long error_code,
|
|||
* If we're in an interrupt, have no user context or are running
|
||||
* in an atomic region then we must not take the fault:
|
||||
*/
|
||||
if (unlikely(in_atomic() || !mm)) {
|
||||
if (unlikely(in_atomic() || !mm || current->pagefault_disabled)) {
|
||||
bad_area_nosemaphore(regs, error_code, address);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ void do_page_fault(struct pt_regs *regs)
|
|||
/* If we're in an interrupt or have no user
|
||||
* context, we must not take the fault..
|
||||
*/
|
||||
if (in_atomic() || !mm) {
|
||||
if (in_atomic() || !mm || current->pagefault_disabled) {
|
||||
bad_page_fault(regs, address, SIGSEGV);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue