Lines Matching full:address

172 static inline pmd_t *vmalloc_sync_one(pgd_t *pgd, unsigned long address)  in vmalloc_sync_one()  argument
174 unsigned index = pgd_index(address); in vmalloc_sync_one()
191 p4d = p4d_offset(pgd, address); in vmalloc_sync_one()
192 p4d_k = p4d_offset(pgd_k, address); in vmalloc_sync_one()
196 pud = pud_offset(p4d, address); in vmalloc_sync_one()
197 pud_k = pud_offset(p4d_k, address); in vmalloc_sync_one()
201 pmd = pmd_offset(pud, address); in vmalloc_sync_one()
202 pmd_k = pmd_offset(pud_k, address); in vmalloc_sync_one()
229 static noinline int vmalloc_fault(unsigned long address) in vmalloc_fault() argument
236 if (!(address >= VMALLOC_START && address < VMALLOC_END)) in vmalloc_fault()
247 pmd_k = vmalloc_sync_one(__va(pgd_paddr), address); in vmalloc_fault()
254 pte_k = pte_offset_kernel(pmd_k, address); in vmalloc_fault()
291 static void dump_pagetable(unsigned long address) in dump_pagetable() argument
294 pgd_t *pgd = &base[pgd_index(address)]; in dump_pagetable()
308 p4d = p4d_offset(pgd, address); in dump_pagetable()
309 pud = pud_offset(p4d, address); in dump_pagetable()
310 pmd = pmd_offset(pud, address); in dump_pagetable()
323 pte = pte_offset_kernel(pmd, address); in dump_pagetable()
347 static void dump_pagetable(unsigned long address) in dump_pagetable() argument
350 pgd_t *pgd = base + pgd_index(address); in dump_pagetable()
364 p4d = p4d_offset(pgd, address); in dump_pagetable()
372 pud = pud_offset(p4d, address); in dump_pagetable()
380 pmd = pmd_offset(pud, address); in dump_pagetable()
388 pte = pte_offset_kernel(pmd, address); in dump_pagetable()
416 static int is_errata93(struct pt_regs *regs, unsigned long address) in is_errata93() argument
426 if (address != regs->ip) in is_errata93()
429 if ((address >> 32) != 0) in is_errata93()
432 address |= 0xffffffffUL << 32; in is_errata93()
433 if ((address >= (u64)_stext && address <= (u64)_etext) || in is_errata93()
434 (address >= MODULES_VADDR && address <= MODULES_END)) { in is_errata93()
436 regs->ip = address; in is_errata93()
451 static int is_errata100(struct pt_regs *regs, unsigned long address) in is_errata100() argument
454 if ((regs->cs == __USER32_CS || (regs->cs & (1<<2))) && (address >> 32)) in is_errata100()
462 unsigned long address) in is_f00f_bug() argument
466 idt_is_f00f_address(address)) { in is_f00f_bug()
490 if (copy_from_kernel_nofault(&desc, (void *)(gdt->address + offset), in show_ldttss()
506 show_fault_oops(struct pt_regs *regs, unsigned long error_code, unsigned long address) in show_fault_oops() argument
517 pgd += pgd_index(address); in show_fault_oops()
519 pte = lookup_address_in_pgd(pgd, address, &level); in show_fault_oops()
531 if (address < PAGE_SIZE && !user_mode(regs)) in show_fault_oops()
532 pr_alert("BUG: kernel NULL pointer dereference, address: %px\n", in show_fault_oops()
533 (void *)address); in show_fault_oops()
535 pr_alert("BUG: unable to handle page fault for address: %px\n", in show_fault_oops()
536 (void *)address); in show_fault_oops()
570 idt.address, idt.size, gdt.address, gdt.size); in show_fault_oops()
579 dump_pagetable(address); in show_fault_oops()
584 unsigned long address) in pgtable_bad() argument
594 printk(KERN_ALERT "%s: Corrupted page table at address %lx\n", in pgtable_bad()
595 tsk->comm, address); in pgtable_bad()
596 dump_pagetable(address); in pgtable_bad()
604 static void sanitize_error_code(unsigned long address, in sanitize_error_code() argument
616 if (address >= TASK_SIZE_MAX) in sanitize_error_code()
620 static void set_signal_archinfo(unsigned long address, in set_signal_archinfo() argument
627 tsk->thread.cr2 = address; in set_signal_archinfo()
632 unsigned long address) in page_fault_oops() argument
651 if (is_vmalloc_addr((void *)address) && in page_fault_oops()
652 (((unsigned long)current->stack - 1 - address < PAGE_SIZE) || in page_fault_oops()
653 address - ((unsigned long)current->stack + THREAD_SIZE) < PAGE_SIZE)) { in page_fault_oops()
670 "S" (regs), "d" (address), in page_fault_oops()
682 efi_crash_gracefully_on_page_fault(address); in page_fault_oops()
686 kfence_handle_page_fault(address, error_code & X86_PF_WRITE, regs)) in page_fault_oops()
696 show_fault_oops(regs, error_code, address); in page_fault_oops()
706 printk(KERN_DEFAULT "CR2: %016lx\n", address); in page_fault_oops()
713 unsigned long address, int signal, int si_code, in kernelmode_fixup_or_oops() argument
719 if (fixup_exception(regs, X86_TRAP_PF, error_code, address)) { in kernelmode_fixup_or_oops()
735 sanitize_error_code(address, &error_code); in kernelmode_fixup_or_oops()
737 set_signal_archinfo(address, error_code); in kernelmode_fixup_or_oops()
740 force_sig_pkuerr((void __user *)address, pkey); in kernelmode_fixup_or_oops()
743 force_sig_fault(signal, si_code, (void __user *)address); in kernelmode_fixup_or_oops()
757 if (is_prefetch(regs, error_code, address)) in kernelmode_fixup_or_oops()
760 page_fault_oops(regs, error_code, address); in kernelmode_fixup_or_oops()
769 unsigned long address, struct task_struct *tsk) in show_signal_msg() argument
780 loglvl, tsk->comm, task_pid_nr(tsk), address, in show_signal_msg()
792 * of the address space that has user-accessible permissions.
801 unsigned long address, u32 pkey, int si_code) in __bad_area_nosemaphore() argument
806 kernelmode_fixup_or_oops(regs, error_code, address, in __bad_area_nosemaphore()
813 page_fault_oops(regs, error_code, address); in __bad_area_nosemaphore()
827 if (is_prefetch(regs, error_code, address)) in __bad_area_nosemaphore()
830 if (is_errata100(regs, address)) in __bad_area_nosemaphore()
833 sanitize_error_code(address, &error_code); in __bad_area_nosemaphore()
835 if (fixup_vdso_exception(regs, X86_TRAP_PF, error_code, address)) in __bad_area_nosemaphore()
839 show_signal_msg(regs, error_code, address, tsk); in __bad_area_nosemaphore()
841 set_signal_archinfo(address, error_code); in __bad_area_nosemaphore()
844 force_sig_pkuerr((void __user *)address, pkey); in __bad_area_nosemaphore()
846 force_sig_fault(SIGSEGV, si_code, (void __user *)address); in __bad_area_nosemaphore()
853 unsigned long address) in bad_area_nosemaphore() argument
855 __bad_area_nosemaphore(regs, error_code, address, 0, SEGV_MAPERR); in bad_area_nosemaphore()
860 unsigned long address, u32 pkey, int si_code) in __bad_area() argument
869 __bad_area_nosemaphore(regs, error_code, address, pkey, si_code); in __bad_area()
873 bad_area(struct pt_regs *regs, unsigned long error_code, unsigned long address) in bad_area() argument
875 __bad_area(regs, error_code, address, 0, SEGV_MAPERR); in bad_area()
897 unsigned long address, struct vm_area_struct *vma) in bad_area_access_error() argument
927 __bad_area(regs, error_code, address, pkey, SEGV_PKUERR); in bad_area_access_error()
929 __bad_area(regs, error_code, address, 0, SEGV_ACCERR); in bad_area_access_error()
934 do_sigbus(struct pt_regs *regs, unsigned long error_code, unsigned long address, in do_sigbus() argument
939 kernelmode_fixup_or_oops(regs, error_code, address, in do_sigbus()
945 if (is_prefetch(regs, error_code, address)) in do_sigbus()
948 sanitize_error_code(address, &error_code); in do_sigbus()
950 if (fixup_vdso_exception(regs, X86_TRAP_PF, error_code, address)) in do_sigbus()
953 set_signal_archinfo(address, error_code); in do_sigbus()
962 tsk->comm, tsk->pid, address); in do_sigbus()
967 force_sig_mceerr(BUS_MCEERR_AR, (void __user *)address, lsb); in do_sigbus()
971 force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)address); in do_sigbus()
1007 spurious_kernel_fault(unsigned long error_code, unsigned long address) in spurious_kernel_fault() argument
1029 pgd = init_mm.pgd + pgd_index(address); in spurious_kernel_fault()
1033 p4d = p4d_offset(pgd, address); in spurious_kernel_fault()
1040 pud = pud_offset(p4d, address); in spurious_kernel_fault()
1047 pmd = pmd_offset(pud, address); in spurious_kernel_fault()
1054 pte = pte_offset_kernel(pmd, address); in spurious_kernel_fault()
1128 bool fault_in_kernel_space(unsigned long address) in fault_in_kernel_space() argument
1131 * On 64-bit systems, the vsyscall page is at an address above in fault_in_kernel_space()
1133 * address space. in fault_in_kernel_space()
1135 if (IS_ENABLED(CONFIG_X86_64) && is_vsyscall_vaddr(address)) in fault_in_kernel_space()
1138 return address >= TASK_SIZE_MAX; in fault_in_kernel_space()
1142 * Called for all faults where 'address' is part of the kernel address
1148 unsigned long address) in do_kern_addr_fault() argument
1152 * have no user pages in the kernel portion of the address in do_kern_addr_fault()
1183 if (vmalloc_fault(address) >= 0) in do_kern_addr_fault()
1188 if (is_f00f_bug(regs, hw_error_code, address)) in do_kern_addr_fault()
1192 if (spurious_kernel_fault(hw_error_code, address)) in do_kern_addr_fault()
1207 bad_area_nosemaphore(regs, hw_error_code, address); in do_kern_addr_fault()
1212 * Handle faults in the user portion of the address space. Nothing in here
1222 unsigned long address) in do_user_addr_fault() argument
1237 * corrupts RIP such that it looks like a user address, in do_user_addr_fault()
1241 if (is_errata93(regs, address)) in do_user_addr_fault()
1244 page_fault_oops(regs, error_code, address); in do_user_addr_fault()
1257 pgtable_bad(regs, error_code, address); in do_user_addr_fault()
1261 * pages in the user address space. The odd case here is WRUSS, in do_user_addr_fault()
1273 page_fault_oops(regs, error_code, address); in do_user_addr_fault()
1282 bad_area_nosemaphore(regs, error_code, address); in do_user_addr_fault()
1301 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address); in do_user_addr_fault()
1311 * vsyscall page is at a high address (>PAGE_OFFSET), but is in do_user_addr_fault()
1312 * considered to be part of the user address space. in do_user_addr_fault()
1320 if (is_vsyscall_vaddr(address)) { in do_user_addr_fault()
1321 if (emulate_vsyscall(error_code, regs, address)) in do_user_addr_fault()
1327 * Kernel-mode access to the user address space should only occur in do_user_addr_fault()
1331 * to validate the fault against the address space. in do_user_addr_fault()
1344 bad_area_nosemaphore(regs, error_code, address); in do_user_addr_fault()
1358 vma = find_vma(mm, address); in do_user_addr_fault()
1360 bad_area(regs, error_code, address); in do_user_addr_fault()
1363 if (likely(vma->vm_start <= address)) in do_user_addr_fault()
1366 bad_area(regs, error_code, address); in do_user_addr_fault()
1369 if (unlikely(expand_stack(vma, address))) { in do_user_addr_fault()
1370 bad_area(regs, error_code, address); in do_user_addr_fault()
1380 bad_area_access_error(regs, error_code, address, vma); in do_user_addr_fault()
1397 fault = handle_mm_fault(vma, address, flags, regs); in do_user_addr_fault()
1405 kernelmode_fixup_or_oops(regs, error_code, address, in do_user_addr_fault()
1427 kernelmode_fixup_or_oops(regs, error_code, address, in do_user_addr_fault()
1435 kernelmode_fixup_or_oops(regs, error_code, address, in do_user_addr_fault()
1450 do_sigbus(regs, error_code, address, fault); in do_user_addr_fault()
1452 bad_area_nosemaphore(regs, error_code, address); in do_user_addr_fault()
1461 unsigned long address) in trace_page_fault_entries() argument
1467 trace_page_fault_user(address, regs, error_code); in trace_page_fault_entries()
1469 trace_page_fault_kernel(address, regs, error_code); in trace_page_fault_entries()
1474 unsigned long address) in handle_page_fault() argument
1476 trace_page_fault_entries(regs, error_code, address); in handle_page_fault()
1478 if (unlikely(kmmio_fault(regs, address))) in handle_page_fault()
1481 /* Was the fault on kernel-controlled part of the address space? */ in handle_page_fault()
1482 if (unlikely(fault_in_kernel_space(address))) { in handle_page_fault()
1483 do_kern_addr_fault(regs, error_code, address); in handle_page_fault()
1485 do_user_addr_fault(regs, error_code, address); in handle_page_fault()
1487 * User address page fault handling might have reenabled in handle_page_fault()
1499 unsigned long address = read_cr2(); in DEFINE_IDTENTRY_RAW_ERRORCODE() local
1525 if (kvm_handle_async_pf(regs, (u32)address)) in DEFINE_IDTENTRY_RAW_ERRORCODE()
1531 * be invoked because a kernel fault on a user space address might in DEFINE_IDTENTRY_RAW_ERRORCODE()
1541 handle_page_fault(regs, error_code, address); in DEFINE_IDTENTRY_RAW_ERRORCODE()