if (get_user(inst, (unsignedint __user *)regs->pc)) return0; /* check for 1 in the rD field */ if (((inst >> 21) & 0x1f) != 1) return0; /* check for store opcodes */ if ((inst & 0xd0000000) == 0xd0000000) return1; return0;
}
/* *bad_page_faultiscalledwhenwehaveabadaccessfromthekernel. *Itiscalledfromdo_page_faultaboveandfromsomeoftheprocedures *intraps.c.
*/ void bad_page_fault(struct pt_regs *regs, unsignedlong address, int sig)
{ conststruct exception_table_entry *fixup; /* MS: no context */ /* Are we prepared to handle this fault? */
fixup = search_exception_tables(regs->pc); if (fixup) {
regs->pc = fixup->fixup; return;
}
/* kernel has accessed a bad area */
die("kernel access of bad area", regs, sig);
}
/* On a kernel SLB miss we can only check for a valid exception entry */ if (unlikely(kernel_mode(regs) && (address >= TASK_SIZE))) {
pr_warn("kernel task_size exceed");
_exception(SIGSEGV, regs, code, address);
}
/* for instr TLB miss and instr storage exception ESR_S is undefined */ if ((error_code & 0x13) == 0x13 || (error_code & 0x11) == 0x11)
is_write = 0;
if (unlikely(faulthandler_disabled() || !mm)) { if (kernel_mode(regs)) goto bad_area_nosemaphore;
/* faulthandler_disabled() in user mode is really bad,
as is current->mm == NULL. */
pr_emerg("Page fault in user mode with faulthandler_disabled(), mm = %p\n",
mm);
pr_emerg("r15 = %lx MSR = %lx\n",
regs->r15, regs->msr);
die("Weird page fault", regs, SIGSEGV);
}
/* When running in the kernel we expect faults to occur only to *addressesinuserspace.Allotherfaultsrepresenterrorsinthe *kernelandshouldgenerateanOOPS.Unfortunately,inthecaseofan *erroneousfaultoccurringinacodepathwhichalreadyholdsmmap_lock *wewilldeadlockattemptingtovalidatethefaultagainstthe *addressspace.Luckilythekernelonlyvalidlyreferencesuser *spacefromwelldefinedareasofcode,whicharelistedinthe *exceptionstable. * *Asthevastmajorityoffaultswillbevalidwewillonlyperform *thesourcereferencecheckwhenthereisapossibilityofadeadlock. *Attempttolocktheaddressspace,ifwecannotwethenvalidatethe *source.Ifthisisinvalidwecanskiptheaddressspacecheck, *thusavoidingthedeadlock.
*/ if (unlikely(!mmap_read_trylock(mm))) { if (kernel_mode(regs) && !search_exception_tables(regs->pc)) goto bad_area_nosemaphore;
retry:
mmap_read_lock(mm);
}
vma = find_vma(mm, address); if (unlikely(!vma)) goto bad_area;
if (vma->vm_start <= address) goto good_area;
if (unlikely(!(vma->vm_flags & VM_GROWSDOWN))) goto bad_area;
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.