Lines Matching +full:fail +full:- +full:safe

1 // SPDX-License-Identifier: GPL-2.0-only
12 #include <asm/insn-eval.h>
29 return (unsigned long)&x->fixup + x->fixup; in ex_fixup_addr()
35 if (e->data & EX_FLAG_CLEAR_AX) in ex_handler_default()
36 regs->ax = 0; in ex_handler_default()
37 if (e->data & EX_FLAG_CLEAR_DX) in ex_handler_default()
38 regs->dx = 0; in ex_handler_default()
40 regs->ip = ex_fixup_addr(e); in ex_handler_default()
46 * and it's a page crosser into a non-existent page.
48 * This happens when we optimistically load a pathname a word-at-a-time
61 const unsigned long mask = sizeof(long) - 1; in ex_handler_zeropad()
66 len = next_ip - regs->ip; in ex_handler_zeropad()
70 if (insn_decode(&insn, (void *) regs->ip, len, INSN_MODE_KERN)) in ex_handler_zeropad()
100 regs->ax = trapnr; in ex_handler_fault()
107 regs->ax = trapnr | SGX_ENCLS_FAULT_FLAG; in ex_handler_sgx()
112 * Handler for when we fail to restore a task's FPU state. We should never get
113 * here because the FPU state of a task using the FPU (task->thread.fpu.state)
116 * These caused XRSTOR to fail when switching to the task, leaking the FPU
124 regs->ip = ex_fixup_addr(fixup); in ex_handler_fprestore()
134 * On x86-64, we end up being imprecise with 'access_ok()', and allow
135 * non-canonical user addresses to make the range comparisons simpler,
145 /* Is it in the "user space" part of the non-canonical space? */ in gp_fault_address_ok()
150 fault_address -= PAGE_SIZE; in gp_fault_address_ok()
162 "General protection fault in user access. Non-canonical address?"); in ex_handler_uaccess()
169 …WARN_ONCE(trapnr == X86_TRAP_GP, "General protection fault in user access. Non-canonical address?"… in ex_handler_copy()
174 struct pt_regs *regs, bool wrmsr, bool safe, int reg) in ex_handler_msr() argument
176 if (__ONCE_LITE_IF(!safe && wrmsr)) { in ex_handler_msr()
178 (unsigned int)regs->cx, (unsigned int)regs->dx, in ex_handler_msr()
179 (unsigned int)regs->ax, regs->ip, (void *)regs->ip); in ex_handler_msr()
183 if (__ONCE_LITE_IF(!safe && !wrmsr)) { in ex_handler_msr()
185 (unsigned int)regs->cx, regs->ip, (void *)regs->ip); in ex_handler_msr()
191 regs->ax = 0; in ex_handler_msr()
192 regs->dx = 0; in ex_handler_msr()
195 if (safe) in ex_handler_msr()
196 *pt_regs_nr(regs, reg) = -EIO; in ex_handler_msr()
222 regs->cx = imm * regs->cx + *pt_regs_nr(regs, reg); in ex_handler_ucopy_len()
230 return e ? FIELD_GET(EX_DATA_TYPE_MASK, e->data) : EX_TYPE_NONE; in ex_get_fixup_type()
240 if (unlikely(SEGMENT_IS_PNP_CODE(regs->cs))) { in fixup_exception()
253 e = search_exception_tables(regs->ip); in fixup_exception()
257 type = FIELD_GET(EX_DATA_TYPE_MASK, e->data); in fixup_exception()
258 reg = FIELD_GET(EX_DATA_REG_MASK, e->data); in fixup_exception()
259 imm = FIELD_GET(EX_DATA_IMM_MASK, e->data); in fixup_exception()
293 regs->sp += sizeof(long); in fixup_exception()
325 if (!xen_pv_domain() && regs->cs != __KERNEL_CS) in early_fixup_exception()
326 goto fail; in early_fixup_exception()
337 * result in a hard-to-debug panic. in early_fixup_exception()
342 if (fixup_exception(regs, trapnr, regs->orig_ax, 0)) in early_fixup_exception()
346 if (report_bug(regs->ip, regs) == BUG_TRAP_TYPE_WARN) { in early_fixup_exception()
348 regs->ip += LEN_UD2; in early_fixup_exception()
359 fail: in early_fixup_exception()
361 (unsigned)trapnr, (unsigned long)regs->cs, regs->ip, in early_fixup_exception()
362 regs->orig_ax, read_cr2()); in early_fixup_exception()