/* * kernel virtual address is required to implement vmalloc/pkmap/fixmap * Refer to asm/processor.h for System Memory Map * * It simply copies the PMD entry (pointer to 2nd level page table or hugepage) * from swapper pgdir to task pgdir. The 2nd level table/page is thus shared
*/
noinline staticint handle_kernel_vaddr_fault(unsignedlong address)
{ /* * Synchronize this task's top level page-table * with the 'reference' page table.
*/
pgd_t *pgd, *pgd_k;
p4d_t *p4d, *p4d_k;
pud_t *pud, *pud_k;
pmd_t *pmd, *pmd_k;
/* * NOTE! We MUST NOT take any locks for this case. We may * be in an interrupt or a critical region, and should * only copy the information from the master page table, * nothing more.
*/ if (address >= VMALLOC_START && !user_mode(regs)) { if (unlikely(handle_kernel_vaddr_fault(address))) goto no_context; else return;
}
/* * If we're in an interrupt or have no user * context, we must not take the fault..
*/ if (faulthandler_disabled() || !mm) goto no_context;
/* Quick path to respond to signals */ if (fault_signal_pending(fault, regs)) { if (!user_mode(regs)) goto no_context; return;
}
/* The fault is fully completed (including releasing mmap lock) */ if (fault & VM_FAULT_COMPLETED) return;
/* * Fault retry nuances, mmap_lock already relinquished by core mm
*/ if (unlikely(fault & VM_FAULT_RETRY)) {
flags |= FAULT_FLAG_TRIED; goto retry;
}
bad_area:
mmap_read_unlock(mm);
bad_area_nosemaphore: /* * Major/minor page fault accounting * (in case of retry we only land here once)
*/ if (likely(!(fault & VM_FAULT_ERROR))) /* Normal return path: fault Handled Gracefully */ return;
if (!user_mode(regs)) goto no_context;
if (fault & VM_FAULT_OOM) {
pagefault_out_of_memory(); return;
}
if (fault & VM_FAULT_SIGBUS) {
sig = SIGBUS;
si_code = BUS_ADRERR;
} else {
sig = SIGSEGV;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.