Lines Matching +full:check +full:- +full:cfi +full:- +full:x86_64

50 #include <asm/text-patching.h>
65 #include <asm/insn-eval.h>
68 #include <asm/cfi.h>
73 #include <asm/processor-flags.h>
94 * Check for UD1 or UD2, accounting for Address Size Override Prefixes.
152 tsk->thread.error_code = error_code; in do_trap_no_signal()
153 tsk->thread.trap_nr = trapnr; in do_trap_no_signal()
169 tsk->thread.error_code = error_code; in do_trap_no_signal()
170 tsk->thread.trap_nr = trapnr; in do_trap_no_signal()
172 return -1; in do_trap_no_signal()
182 tsk->comm, task_pid_nr(tsk), type, desc, in show_signal()
183 regs->ip, regs->sp, error_code); in show_signal()
184 print_vma_addr(KERN_CONT " in ", regs->ip); in show_signal()
224 * This address is usually regs->ip, but when an uprobe moved the code out
225 * of line then regs->ip points to the XOL code which would confuse
227 * a trap happened in XOL code then uprobe maps regs->ip back to the
262 ud_type = decode_bug(regs->ip, &imm); in handle_bug()
280 if (regs->flags & X86_EFLAGS_IF) in handle_bug()
283 if (report_bug(regs->ip, regs) == BUG_TRAP_TYPE_WARN || in handle_bug()
285 regs->ip += LEN_UD2; in handle_bug()
289 pr_crit("%s at %pS\n", report_ubsan_failure(regs, imm), (void *)regs->ip); in handle_bug()
291 if (regs->flags & X86_EFLAGS_IF) in handle_bug()
343 char *str = "alignment check"; in DEFINE_IDTENTRY_ERRORCODE()
356 do_trap(X86_TRAP_AC, SIGBUS, "alignment check", regs, in DEFINE_IDTENTRY_ERRORCODE()
368 const char *name = stack_type_name(info->type); in handle_stack_overflow()
371 name, (void *)fault_address, info->begin, info->end); in handle_stack_overflow()
381 * Runs on an IST stack for x86_64 and on a special task stack for x86_32.
383 * On x86_64, this is more or less a normal kernel entry. Notwithstanding the
389 * while the stack is read-only are, in fact, recoverable.
413 * If IRET takes a non-IST fault on the espfix64 stack, then we in DEFINE_IDTENTRY_DF()
426 if (((long)regs->sp >> P4D_SHIFT) == ESPFIX_PGD_ENTRY && in DEFINE_IDTENTRY_DF()
427 regs->cs == __KERNEL_CS && in DEFINE_IDTENTRY_DF()
428 regs->ip == (unsigned long)native_irq_return_iret) in DEFINE_IDTENTRY_DF()
430 struct pt_regs *gpregs = (struct pt_regs *)this_cpu_read(cpu_tss_rw.x86_tss.sp0) - 1; in DEFINE_IDTENTRY_DF()
431 unsigned long *p = (unsigned long *)regs->sp; in DEFINE_IDTENTRY_DF()
434 * regs->sp points to the failing IRET frame on the in DEFINE_IDTENTRY_DF()
436 * in gpregs->ss through gpregs->ip. in DEFINE_IDTENTRY_DF()
439 gpregs->ip = p[0]; in DEFINE_IDTENTRY_DF()
440 gpregs->cs = p[1]; in DEFINE_IDTENTRY_DF()
441 gpregs->flags = p[2]; in DEFINE_IDTENTRY_DF()
442 gpregs->sp = p[3]; in DEFINE_IDTENTRY_DF()
443 gpregs->ss = p[4]; in DEFINE_IDTENTRY_DF()
444 gpregs->orig_ax = 0; /* Missing (lost) #GP error code */ in DEFINE_IDTENTRY_DF()
457 regs->ip = (unsigned long)asm_exc_general_protection; in DEFINE_IDTENTRY_DF()
458 regs->sp = (unsigned long)&gpregs->orig_ax; in DEFINE_IDTENTRY_DF()
468 tsk->thread.error_code = error_code; in DEFINE_IDTENTRY_DF()
469 tsk->thread.trap_nr = X86_TRAP_DF; in DEFINE_IDTENTRY_DF()
475 * take any non-IST exception while too close to the bottom of in DEFINE_IDTENTRY_DF()
479 * According to the SDM (footnote in 6.15 under "Interrupt 14 - in DEFINE_IDTENTRY_DF()
480 * Page-Fault Exception (#PF): in DEFINE_IDTENTRY_DF()
543 * out whether any part of the access to that address was non-canonical.
552 if (copy_from_kernel_nofault(insn_buf, (void *)regs->ip, in get_kernel_gp_address()
561 if (*addr == -1UL) in get_kernel_gp_address()
566 * Check that: in get_kernel_gp_address()
567 * - the operand is not in the kernel half in get_kernel_gp_address()
568 * - the last byte of the operand is not in the user canonical half in get_kernel_gp_address()
571 *addr + insn.opnd_bytes - 1 > __VIRTUAL_MASK) in get_kernel_gp_address()
582 struct thread_struct *t = &current->thread; in fixup_iopl_exception()
586 if (!IS_ENABLED(CONFIG_X86_IOPL_IOPERM) || t->iopl_emul != 3) in fixup_iopl_exception()
598 if (!t->iopl_warn && printk_ratelimit()) { in fixup_iopl_exception()
600 current->comm, task_pid_nr(current), ip); in fixup_iopl_exception()
603 t->iopl_warn = 1; in fixup_iopl_exception()
606 regs->ip += 1; in fixup_iopl_exception()
625 * in *before* interrupts are re-enabled. in try_fixup_enqcmd_gp()
640 if (!mm_valid_pasid(current->mm)) in try_fixup_enqcmd_gp()
643 pasid = current->mm->pasid; in try_fixup_enqcmd_gp()
649 if (current->pasid_activated) in try_fixup_enqcmd_gp()
653 current->pasid_activated = 1; in try_fixup_enqcmd_gp()
668 current->thread.error_code = error_code; in gp_try_fixup_and_notify()
669 current->thread.trap_nr = trapnr; in gp_try_fixup_and_notify()
673 * from kprobe_running(), we have to be non-preemptible. in gp_try_fixup_and_notify()
685 current->thread.error_code = error_code; in gp_user_force_sig_segv()
686 current->thread.trap_nr = trapnr; in gp_user_force_sig_segv()
729 snprintf(desc, sizeof(desc), "segment-related " GPFSTR); in DEFINE_IDTENTRY_ERRORCODE()
735 (hint == GP_NON_CANONICAL) ? "probably for non-canonical address" in DEFINE_IDTENTRY_ERRORCODE()
740 * KASAN is interested only in the non-canonical case, clear it in DEFINE_IDTENTRY_ERRORCODE()
818 * Help handler running on a per-cpu (IST or entry trampoline) stack
824 struct pt_regs *regs = (struct pt_regs *)this_cpu_read(pcpu_hot.top_of_stack) - 1; in sync_regs()
838 * In the SYSCALL entry path the RSP value comes from user-space - don't in vc_switch_off_ist()
847 * From here on the RSP value is trusted. Now check whether entry in vc_switch_off_ist()
849 * use the fall-back stack instead in this case. in vc_switch_off_ist()
851 sp = regs->sp; in vc_switch_off_ist()
860 * Found a safe stack - switch to it as if the entry didn't happen via in vc_switch_off_ist()
864 sp = ALIGN_DOWN(sp, 8) - sizeof(*regs_ret); in vc_switch_off_ist()
885 new_stack = (struct pt_regs *)__this_cpu_read(cpu_tss_rw.x86_tss.sp0) - 1; in fixup_bad_iret()
888 __memcpy(&tmp.ip, (void *)bad_regs->sp, 5*8); in fixup_bad_iret()
905 * code that can be single-stepped in the SYSENTER entry path, then in is_sysenter_singlestep()
906 * assume that this is a useless single-step trap due to SYSENTER in is_sysenter_singlestep()
912 return (regs->ip - (unsigned long)__begin_SYSENTER_singlestep_region) < in is_sysenter_singlestep()
913 (unsigned long)__end_SYSENTER_singlestep_region - in is_sysenter_singlestep()
916 return (regs->ip - (unsigned long)entry_SYSENTER_compat) < in is_sysenter_singlestep()
917 (unsigned long)__end_entry_SYSENTER_compat - in is_sysenter_singlestep()
931 * Certain debug exceptions may clear bits 0-3. The remaining in debug_read_clear_dr6()
947 * Our handling of the processor debug registers is non-trivial.
951 * only set watchpoints on userspace addresses. Therefore the in-kernel
975 * consumed - hw_breakpoint_handler(), single_stop_cont(). in notify_debug()
978 * for signals - ptrace_triggered(), kgdb_hw_overflow_handler(). in notify_debug()
1014 * it for userspace, but we just took a kernel #DB, so re-set in exc_debug_kernel()
1041 * The kernel doesn't use TF single-step outside of: in exc_debug_kernel()
1043 * - Kprobes, consumed through kprobe_debug_handler() in exc_debug_kernel()
1044 * - KGDB, consumed through notify_debug() in exc_debug_kernel()
1052 regs->flags &= ~X86_EFLAGS_TF; in exc_debug_kernel()
1090 current->thread.virtual_dr6 = (dr6 & DR_STEP); in exc_debug_user()
1122 dr6 |= current->thread.virtual_dr6; in exc_debug_user()
1166 struct fpu *fpu = &task->thread.fpu; in math_error()
1177 task->thread.error_code = 0; in math_error()
1178 task->thread.trap_nr = trapnr; in math_error()
1192 task->thread.trap_nr = trapnr; in math_error()
1193 task->thread.error_code = 0; in math_error()
1272 case -EPERM: in handle_xfd_event()
1275 case -EFAULT: in handle_xfd_event()
1312 * to kill the task than getting stuck in a never-ending in DEFINE_IDTENTRY()
1350 * never generated on accesses to normal, TD-private memory that has been
1357 * IRET will re-enable NMIs and nested NMI will corrupt the NMI stack.
1360 * the NMI entry code. Entry code paths do not access TD-shared memory,
1374 * the interrupt-disabled region before TDGETVEINFO, a #DF (fault
1387 * NMIs/Machine-checks/Interrupts will be in a disabled state in DEFINE_IDTENTRY()
1425 /* Init GHCB memory pages when running as an SEV-ES guest */ in trap_init()