linux-stable/arch/x86/include/asm
Youquan Song 278b917f8c x86/mce: Add _ASM_EXTABLE_CPY for copy user access
_ASM_EXTABLE_UA is a general exception entry to record the exception fixup
for all exception spots between kernel and user space access.

To enable recovery from machine checks while coping data from user
addresses it is necessary to be able to distinguish the places that are
looping copying data from those that copy a single byte/word/etc.

Add a new macro _ASM_EXTABLE_CPY and use it in place of _ASM_EXTABLE_UA
in the copy functions.

Record the exception reason number to regs->ax at
ex_handler_uaccess which is used to check MCE triggered.

The new fixup routine ex_handler_copy() is almost an exact copy of
ex_handler_uaccess() The difference is that it sets regs->ax to the trap
number. Following patches use this to avoid trying to copy remaining
bytes from the tail of the copy and possibly hitting the poison again.

New mce.kflags bit MCE_IN_KERNEL_COPYIN will be used by mce_severity()
calculation to indicate that a machine check is recoverable because the
kernel was copying from user space.

Signed-off-by: Youquan Song <youquan.song@intel.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20201006210910.21062-4-tony.luck@intel.com
2020-10-07 11:19:11 +02:00
..
crypto
e820
fpu Merge branch 'work.regset' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2020-08-07 09:29:25 -07:00
numachip
trace x86/entry: Convert reschedule interrupt to IDTENTRY_SYSVEC_SIMPLE 2020-06-11 15:15:16 +02:00
uv The biggest change is the removal of SGI UV1 support, which allowed the 2020-08-03 17:38:43 -07:00
vdso vdso/treewide: Add vdso_data pointer argument to __arch_get_hw_counter() 2020-08-06 10:57:30 +02:00
xen xen: hypercall.h: fix duplicated word 2020-08-03 07:48:39 +02:00
acenv.h
acpi.h
agp.h mm: introduce include/linux/pgtable.h 2020-06-09 09:39:13 -07:00
alternative-asm.h
alternative.h
amd_nb.h x86/mce/amd: Cleanup threshold device remove path 2020-04-14 15:49:51 +02:00
apb_timer.h x86/apb_timer: Drop unused declaration and macro 2020-05-27 13:12:49 +02:00
apic.h x86/entry: Convert various hypervisor vectors to IDTENTRY_SYSVEC 2020-06-11 15:15:15 +02:00
apicdef.h
apm.h
arch_hweight.h
archrandom.h x86/cpu: Use RDRAND and RDSEED mnemonics in archrandom.h 2020-05-18 19:50:47 +02:00
asm-offsets.h
asm-prototypes.h mm: reorder includes after introduction of linux/pgtable.h 2020-06-09 09:39:13 -07:00
asm.h x86/mce: Add _ASM_EXTABLE_CPY for copy user access 2020-10-07 11:19:11 +02:00
atomic.h locking/atomic: Move ATOMIC_INIT into linux/types.h 2020-07-29 16:14:18 +02:00
atomic64_32.h locking/atomics: Flip fallbacks and instrumentation 2020-06-11 08:03:24 +02:00
atomic64_64.h locking/atomics: Flip fallbacks and instrumentation 2020-06-11 08:03:24 +02:00
audit.h x86/audit: Fix a -Wmissing-prototypes warning for ia32_classify_syscall() 2020-05-19 18:03:07 +02:00
barrier.h
bios_ebda.h
bitops.h x86, kcsan: Remove __no_kcsan_or_inline usage 2020-06-15 14:10:08 +02:00
boot.h x86: Add support for ZSTD compressed kernel 2020-07-31 11:49:09 +02:00
bootparam_utils.h
bug.h compiler.h: Move instrumentation_begin()/end() to new <linux/instrumentation.h> header 2020-07-24 13:56:23 +02:00
bugs.h
cache.h
cacheflush.h asm-generic: don't include <linux/mm.h> in cacheflush.h 2020-06-08 11:05:57 -07:00
cacheinfo.h
ce4100.h
checksum.h x86: switch 32bit csum_and_copy_to_user() to user_access_{begin,end}() 2020-05-29 16:11:48 -04:00
checksum_32.h x86: switch 32bit csum_and_copy_to_user() to user_access_{begin,end}() 2020-05-29 16:11:48 -04:00
checksum_64.h x86: switch 32bit csum_and_copy_to_user() to user_access_{begin,end}() 2020-05-29 16:11:48 -04:00
clocksource.h
cmdline.h
cmpxchg.h
cmpxchg_32.h x86: cmpxchg_32.h: Delete duplicated word 2020-07-26 12:47:22 +02:00
cmpxchg_64.h
compat.h signal: refactor copy_siginfo_to_user32 2020-05-05 16:46:09 -04:00
copy_mc_test.h x86, powerpc: Rename memcpy_mcsafe() to copy_mc_to_{user, kernel}() 2020-10-06 11:18:04 +02:00
cpu.h x86/cpu: Reinitialize IA32_FEAT_CTL MSR on BSP during wakeup 2020-06-15 14:18:37 +02:00
cpu_device_id.h x86/cpu: Add a X86_MATCH_INTEL_FAM6_MODEL_STEPPINGS() macro 2020-05-07 13:48:05 +02:00
cpu_entry_area.h x86/entry: Remove DBn stacks 2020-06-11 15:15:23 +02:00
cpufeature.h
cpufeatures.h Misc changes: 2020-08-03 17:08:02 -07:00
cpuidle_haltpoll.h
cpumask.h x86/entry, cpumask: Provide non-instrumented variant of cpu_is_offline() 2020-06-15 14:10:09 +02:00
crash.h
current.h
debugreg.h x86/entry: __always_inline debugreg for noinstr 2020-06-11 15:15:26 +02:00
delay.h x86/delay: Introduce TPAUSE delay 2020-05-07 16:06:20 +02:00
desc.h x86/idt: Consolidate idt functionality 2020-06-11 15:15:26 +02:00
desc_defs.h
device.h x86: Remove dev->archdata.iommu pointer 2020-06-30 11:59:48 +02:00
disabled-features.h
div64.h sched/cputime: Improve cputime_adjust() 2020-06-15 14:10:00 +02:00
dma-mapping.h docs: fix references for DMA*.txt files 2020-06-26 10:01:32 -06:00
dma.h x86/dma: Fix max PFN arithmetic overflow on 32 bit systems 2020-05-28 20:21:32 +02:00
dmi.h
doublefault.h x86/32: Remove CONFIG_DOUBLEFAULT 2020-04-14 14:24:05 +02:00
dwarf2.h x86: remove always-defined CONFIG_AS_CFI_SECTIONS 2020-04-09 00:01:59 +09:00
edac.h
efi.h x86/efi: Remove unused EFI_UV1_MEMMAP code 2020-07-17 16:47:48 +02:00
elf.h kill elf_fpxregs_t 2020-07-27 14:29:23 -04:00
emergency-restart.h
emulate_prefix.h
entry-common.h x86/entry: Use generic syscall exit functionality 2020-07-24 15:04:59 +02:00
espfix.h
exec.h
extable.h x86/mce: Provide method to find out the type of an exception handler 2020-10-07 11:08:59 +02:00
fb.h
fixmap.h locking/seqlock, headers: Untangle the spaghetti monster 2020-08-06 16:13:13 +02:00
floppy.h floppy: use symbolic register names in the x86 port 2020-05-12 19:34:53 +03:00
frame.h
fsgsbase.h x86/ptrace: Fix 32-bit PTRACE_SETREGS vs fsbase and gsbase 2020-07-01 15:27:20 +02:00
ftrace.h Various tracing fixes: 2020-05-14 11:46:52 -07:00
futex.h
gart.h
GEN-for-each-reg.h x86: Simplify retpoline declaration 2020-04-30 20:14:34 +02:00
genapic.h
geode.h
hardirq.h x86/kvm/vmx: Move guest enter/exit into .noinstr.text 2020-07-09 07:08:40 -04:00
highmem.h arch/kmap: define kmap_atomic_prot() for all arch's 2020-06-04 19:06:22 -07:00
hpet.h
hugetlb.h mm/hugetlb: define a generic fallback for arch_clear_hugepage_flags() 2020-06-03 20:09:46 -07:00
hw_breakpoint.h
hw_irq.h x86/entry: Convert reschedule interrupt to IDTENTRY_SYSVEC_SIMPLE 2020-06-11 15:15:16 +02:00
hyperv-tlfs.h ARM: 2020-06-03 15:13:47 -07:00
hypervisor.h
i8259.h
ia32.h
ia32_unistd.h
idtentry.h s390: implement diag318 2020-08-06 12:59:31 -07:00
imr.h
inat.h
inat_types.h
init.h
insn-eval.h
insn.h
inst.h Support for FSGSBASE. Almost 5 years after the first RFC to support it, 2020-08-04 21:16:22 -07:00
intel-family.h x86/cpu: Add Lakefield, Alder Lake and Rocket Lake models to the to Intel CPU family 2020-07-25 12:16:59 +02:00
intel-mid.h x86/platform/intel-mid: Add empty stubs for intel_scu_devices_[create|destroy]() 2020-04-24 11:18:21 +01:00
intel_ds.h
intel_mid_vrtc.h
intel_pconfig.h
intel_pt.h
intel_punit_ipc.h
intel_scu_ipc.h platform/x86: intel_scu_ipc: Add managed function to register SCU IPC 2020-04-24 11:17:44 +01:00
intel_scu_ipc_legacy.h platform/x86: intel_scu_ipc: Introduce new SCU IPC API 2020-04-24 11:17:28 +01:00
intel_telemetry.h platform/x86: intel_pmc_ipc: Convert to MFD 2020-04-24 11:18:44 +01:00
invpcid.h x86/cpu: Use INVPCID mnemonic in invpcid.h 2020-05-12 16:05:30 +02:00
io.h
io_apic.h x86/ioapic: Remove unused "IOAPIC_AUTO" define 2020-07-25 12:00:56 +02:00
io_bitmap.h x86/ioperm: Fix io bitmap invalidation on Xen PV 2020-07-18 12:31:49 +02:00
iomap.h mm: don't include asm/pgtable.h if linux/mm.h is already included 2020-06-09 09:39:13 -07:00
iommu.h
iommu_table.h
iosf_mbi.h media: atomisp: move CCK endpoint address to generic header 2020-07-18 07:17:16 +02:00
irq.h x86/entry: Unbreak __irqentry_text_start/end magic 2020-06-11 15:15:29 +02:00
irq_remapping.h
irq_stack.h x86/entry: Provide helpers for executing on the irqstack 2020-06-11 15:15:07 +02:00
irq_vectors.h
irq_work.h x86/entry: Convert various system vectors 2020-06-11 15:15:14 +02:00
irqdomain.h
irqflags.h x86/entry: __always_inline irqflags for noinstr 2020-06-11 15:15:27 +02:00
ist.h
jailhouse_para.h
jump_label.h
kasan.h
kaslr.h x86/mm: simplify init_trampoline() and surrounding logic 2020-06-09 09:39:13 -07:00
kbdleds.h
Kbuild asm-generic: make more kernel-space headers mandatory 2020-04-02 09:35:25 -07:00
kdebug.h x86/dumpstack: Add log_lvl to __show_regs() 2020-07-22 23:56:53 +02:00
kexec-bzimage64.h
kexec.h
kgdb.h
kmap_types.h
kprobes.h perf/x86: Add perf text poke events for kprobes 2020-06-15 14:09:49 +02:00
kvm_host.h KVM: x86: Specify max TDP level via kvm_configure_mmu() 2020-07-30 18:18:08 -04:00
kvm_page_track.h
kvm_para.h KVM: x86: Use VMCALL and VMMCALL mnemonics in kvm_para.h 2020-07-08 16:21:49 -04:00
kvm_types.h KVM: Move x86's version of struct kvm_mmu_memory_cache to common code 2020-07-09 13:29:42 -04:00
kvm_vcpu_regs.h
kvmclock.h
linkage.h
livepatch.h
local.h
local64.h
mach_timer.h
mach_traps.h
math_emu.h
mc146818rtc.h
mce.h x86/mce: Add _ASM_EXTABLE_CPY for copy user access 2020-10-07 11:19:11 +02:00
mem_encrypt.h x86/mm: Fix -Wmissing-prototypes warnings for arch/x86/mm/init.c 2020-06-17 10:45:46 +02:00
memtype.h x86/mm: Move pgprot2cachemode out of line 2020-04-20 12:39:17 +02:00
microcode.h
microcode_amd.h x86/microcode/AMD: Increase microcode PATCH_MAX_SIZE 2020-04-14 17:34:46 +02:00
microcode_intel.h
misc.h
mmconfig.h
mmu.h mmap locking API: convert mmap_sem comments 2020-06-09 09:39:14 -07:00
mmu_context.h mm: remove unneeded includes of <asm/pgalloc.h> 2020-08-07 11:33:26 -07:00
mmx.h
mmzone.h
mmzone_32.h x86/mm: Drop deprecated DISCONTIGMEM support for 32-bit 2020-05-28 18:34:30 +02:00
mmzone_64.h
module.h arch: split MODULE_ARCH_VERMAGIC definitions out to <asm/vermagic.h> 2020-04-23 10:50:26 +09:00
mpspec.h
mpspec_def.h
mshyperv.h x86/hyperv: Make hv_setup_sched_clock inline 2020-08-11 10:41:15 +00:00
msi.h
msidef.h
msr-index.h Power management updates for 5.9-rc1 2020-08-03 20:28:08 -07:00
msr-trace.h
msr.h
mtrr.h
mwait.h KVM: VMX: Stop context switching MSR_IA32_UMWAIT_CONTROL 2020-06-22 20:54:57 -04:00
nmi.h
nops.h
nospec-branch.h x86/speculation/mds: Mark mds_user_clear_cpu_buffers() __always_inline 2020-06-11 15:14:40 +02:00
numa.h
numa_32.h
olpc.h
olpc_ofw.h
orc_lookup.h
orc_types.h objtool: Remove SAVE/RESTORE hints 2020-04-22 10:53:50 +02:00
page.h
page_32.h
page_32_types.h
page_64.h
page_64_types.h
page_types.h x86/mm: thread pgprot_t through init_memory_mapping() 2020-04-10 15:36:21 -07:00
paravirt.h x86/ioperm: Fix io bitmap invalidation on Xen PV 2020-07-18 12:31:49 +02:00
paravirt_types.h x86/ioperm: Fix io bitmap invalidation on Xen PV 2020-07-18 12:31:49 +02:00
parport.h
pci-direct.h
pci-functions.h
pci.h
pci_x86.h
percpu.h x86/percpu: Remove unused PER_CPU() macro 2020-07-23 11:46:43 +02:00
perf_event.h perf/x86/intel/lbr: Support XSAVES/XRSTORS for LBR context switch 2020-07-08 11:38:56 +02:00
perf_event_p4.h
pgalloc.h asm-generic: pgalloc: provide generic pgd_free() 2020-08-07 11:33:26 -07:00
pgtable-2level.h
pgtable-2level_types.h x86/mm/32: implement arch_sync_kernel_mappings() 2020-06-02 10:59:11 -07:00
pgtable-3level.h mmap locking API: convert mmap_sem comments 2020-06-09 09:39:14 -07:00
pgtable-3level_types.h x86/mm/32: implement arch_sync_kernel_mappings() 2020-06-02 10:59:11 -07:00
pgtable-invert.h
pgtable.h x86/mm/32: Fix -Wmissing prototypes warnings for init.c 2020-06-18 18:04:00 +02:00
pgtable_32.h Merge branch 'uaccess.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2020-06-10 16:02:54 -07:00
pgtable_32_areas.h
pgtable_32_types.h
pgtable_64.h The biggest change is to not sync the vmalloc and ioremap ranges for x86-64 anymore. 2020-08-03 17:25:42 -07:00
pgtable_64_types.h Revert "x86/mm/64: Do not sync vmalloc/ioremap mappings" 2020-08-06 12:02:58 -07:00
pgtable_areas.h
pgtable_types.h x86/hyperv: allocate the hypercall page with only read and execute bits 2020-06-26 00:27:38 -07:00
pkeys.h
platform_sst_audio.h
pm-trace.h
posix_types.h
preempt.h
probe_roms.h
processor-cyrix.h
processor-flags.h
processor.h Support for FSGSBASE. Almost 5 years after the first RFC to support it, 2020-08-04 21:16:22 -07:00
prom.h
proto.h x86/xen: remove 32-bit Xen PV guest support 2020-08-11 08:26:48 +02:00
pti.h
ptrace.h x86/ptrace: Provide pt_regs helper for entry/exit 2020-07-24 15:04:58 +02:00
purgatory.h
pvclock-abi.h
pvclock.h
qrwlock.h
qspinlock.h x86/kvm: Add "nopvspin" parameter to disable PV spinlocks 2020-07-08 16:21:57 -04:00
qspinlock_paravirt.h
realmode.h
reboot.h
reboot_fixups.h
required-features.h
resctrl.h x86/cpu: Move resctrl CPUID code to resctrl/ 2020-05-06 17:51:21 +02:00
rmwcc.h
seccomp.h
sections.h
segment.h x86/xen: remove 32-bit Xen PV guest support 2020-08-11 08:26:48 +02:00
serial.h
set_memory.h x86/{mce,mm}: Unmap the entire page if the whole page is affected and poisoned 2020-06-11 15:19:17 +02:00
setup.h x86/mm: simplify init_trampoline() and surrounding logic 2020-06-09 09:39:13 -07:00
setup_arch.h
shmparam.h
sigcontext.h
sigframe.h
sighandling.h Merge branch 'x86-cleanups-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2020-03-31 11:04:05 -07:00
signal.h x86/entry: Use generic syscall exit functionality 2020-07-24 15:04:59 +02:00
simd.h
smap.h x86,smap: Fix smap_{save,restore}() alternatives 2020-04-30 20:14:31 +02:00
smp.h x86/headers: Remove APIC headers from <asm/smp.h> 2020-08-06 16:13:09 +02:00
sparsemem.h x86/mm: Drop unused MAX_PHYSADDR_BITS 2020-07-24 09:53:06 +02:00
spec-ctrl.h
special_insns.h x86/cpu: Refactor sync_core() for readability 2020-07-27 12:42:06 +02:00
spinlock.h
spinlock_types.h x86/spinlock: Remove obsolete ticket spinlock macros and types 2020-05-28 21:18:40 +02:00
sta2x11.h
stackprotector.h x86/stackprotector: Pre-initialize canary for secondary CPUs 2020-06-18 13:09:17 +02:00
stacktrace.h x86: add missing const qualifiers for log_lvl 2020-06-09 09:39:12 -07:00
string.h
string_32.h
string_64.h x86, powerpc: Rename memcpy_mcsafe() to copy_mc_to_{user, kernel}() 2020-10-06 11:18:04 +02:00
suspend.h
suspend_32.h
suspend_64.h
svm.h KVM: nSVM: remove trailing padding for struct vmcb_control_area 2020-06-01 04:25:59 -04:00
swiotlb.h
switch_to.h x86/mm: remove vmalloc faulting 2020-06-02 10:59:12 -07:00
sync_bitops.h
sync_core.h x86/cpu: Refactor sync_core() for readability 2020-07-27 12:42:06 +02:00
syscall.h Merge branch 'x86-cleanups-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2020-03-31 11:04:05 -07:00
syscall_wrapper.h
syscalls.h
sysfb.h
text-patching.h x86/int3: Ensure that poke_int3_handler() is not traced 2020-06-11 15:14:52 +02:00
thread_info.h x86/entry: Use generic syscall entry function 2020-07-24 15:04:59 +02:00
time.h
timer.h
timex.h
tlb.h
tlbbatch.h
tlbflush.h x86/tlb: Restrict access to tlbstate 2020-04-26 18:52:33 +02:00
topology.h x86, sched: check for counters overflow in frequency invariant accounting 2020-06-15 14:10:02 +02:00
trace_clock.h
trapnr.h x86/traps: Split trap numbers out in a separate header 2020-06-11 15:14:42 +02:00
traps.h x86/entry: Convert various system vectors 2020-06-11 15:15:14 +02:00
tsc.h A set of locking fixes and updates: 2020-08-10 19:07:44 -07:00
uaccess.h x86, powerpc: Rename memcpy_mcsafe() to copy_mc_to_{user, kernel}() 2020-10-06 11:18:04 +02:00
uaccess_32.h
uaccess_64.h x86, powerpc: Rename memcpy_mcsafe() to copy_mc_to_{user, kernel}() 2020-10-06 11:18:04 +02:00
umip.h
unaligned.h
unistd.h
unwind.h x86/unwind/orc: Fix premature unwind stoppage due to IRET frames 2020-04-25 12:22:29 +02:00
unwind_hints.h objtool: Remove SAVE/RESTORE hints 2020-04-22 10:53:50 +02:00
uprobes.h
user.h
user32.h
user_32.h
user_64.h
vdso.h
vermagic.h arch: split MODULE_ARCH_VERMAGIC definitions out to <asm/vermagic.h> 2020-04-23 10:50:26 +09:00
vga.h
vgtod.h
virtext.h
vm86.h
vmalloc.h
vmware.h
vmx.h KVM: nVMX: Tweak handling of failure code for nested VM-Enter failure 2020-05-15 12:07:31 -04:00
vmxfeatures.h
vsyscall.h
vvar.h
word-at-a-time.h
x86_init.h x86/kvm: Handle async page faults directly through do_page_fault() 2020-05-19 15:53:57 +02:00
xor.h
xor_32.h
xor_64.h
xor_avx.h x86: remove always-defined CONFIG_AS_AVX 2020-04-09 00:01:59 +09:00