1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00
linux/arch/x86/kernel
Xin Li (Intel) dc81e556f2 x86/fred: Clear WFE in missing-ENDBRANCH #CPs
An indirect branch instruction sets the CPU indirect branch tracker
(IBT) into WAIT_FOR_ENDBRANCH (WFE) state and WFE stays asserted
across the instruction boundary.  When the decoder finds an
inappropriate instruction while WFE is set ENDBR, the CPU raises a #CP
fault.

For the "kernel IBT no ENDBR" selftest where #CPs are deliberately
triggered, the WFE state of the interrupted context needs to be
cleared to let execution continue.  Otherwise when the CPU resumes
from the instruction that just caused the previous #CP, another
missing-ENDBRANCH #CP is raised and the CPU enters a dead loop.

This is not a problem with IDT because it doesn't preserve WFE and
IRET doesn't set WFE.  But FRED provides space on the entry stack
(in an expanded CS area) to save and restore the WFE state, thus the
WFE state is no longer clobbered, so software must clear it.

Clear WFE to avoid dead looping in ibt_clear_fred_wfe() and the
!ibt_fatal code path when execution is allowed to continue.

Clobbering WFE in any other circumstance is a security-relevant bug.

[ dhansen: changelog rewording ]

Fixes: a5f6c2ace9 ("x86/shstk: Add user control-protection fault handler")
Signed-off-by: Xin Li (Intel) <xin@zytor.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Dave Hansen <dave.hansen@linux.intel.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/all/20241113175934.3897541-1-xin%40zytor.com
2024-12-29 10:18:10 +01:00
..
acpi A set of updates for the interrupt subsystem: 2024-11-19 15:54:19 -08:00
apic A set of updates for the interrupt subsystem: 2024-11-19 15:54:19 -08:00
cpu hyperv-fixes for v6.13-rc4 2024-12-18 09:55:55 -08:00
fpu x86/pkeys: Ensure updated PKRU value is XRSTOR'd 2024-12-02 15:25:29 -08:00
kprobes x86/kprobes: Cleanup kprobes on ftrace code 2024-11-07 01:16:59 +09:00
.gitignore
alternative.c x86/module: prepare module loading for ROX allocations of text 2024-11-07 14:25:16 -08:00
amd_gart_64.c change alloc_pages name in dma_map_ops to avoid name conflicts 2024-04-25 20:55:53 -07:00
amd_nb.c x86/amd_nb: Add new PCI ID for AMD family 1Ah model 20h 2024-10-07 21:04:28 +02:00
aperture_64.c x86/pci: Use PCI_HEADER_TYPE_* instead of literals 2023-12-01 15:00:43 -06:00
apm_32.c x86/apm_32: Remove dead function apm_get_battery_status() 2024-02-21 19:38:03 +01:00
asm-offsets.c x86/bugs: Rename CONFIG_CALL_DEPTH_TRACKING => CONFIG_MITIGATION_CALL_DEPTH_TRACKING 2024-01-10 10:52:28 +01:00
asm-offsets_32.c x86/stackprotector/32: Make the canary into a regular percpu variable 2021-03-08 13:19:05 +01:00
asm-offsets_64.c x86: Fixup asm-offsets duplicate 2022-10-17 16:41:06 +02:00
audit_64.c x86/audit: Fix -Wmissing-variable-declarations warning for ia32_xyz_class 2023-08-30 10:11:16 +02:00
bootflag.c
callthunks.c x86/xen: remove hypercall page 2024-12-17 08:23:42 +01:00
cet.c x86/fred: Clear WFE in missing-ENDBRANCH #CPs 2024-12-29 10:18:10 +01:00
cfi.c cfi: Flip headers 2023-12-15 16:25:55 -08:00
check.c
cpuid.c x86/cpuid: make cpuid_class a static const structure 2023-08-05 08:31:41 +02:00
crash.c x86/mm: Add callbacks to prepare encrypted memory for kexec 2024-06-17 17:46:02 +02:00
crash_dump_32.c vmcore: convert copy_oldmem_page() to take an iov_iter 2022-04-29 14:37:59 -07:00
crash_dump_64.c use less confusing names for iov_iter direction initializers 2022-11-25 13:01:55 -05:00
devicetree.c of/fdt: add dt_phys arg to early_init_dt_scan and early_init_dt_verify 2024-10-29 15:32:45 -05:00
doublefault_32.c x86: Avoid missing-prototype warnings for doublefault code 2023-05-18 11:56:18 -07:00
dumpstack.c x86/dumpstack: Use uniform "Oops: " prefix for die() messages 2024-03-27 08:45:19 +01:00
dumpstack_32.c x86/percpu: Move irq_stack variables next to current_task 2022-10-17 16:41:05 +02:00
dumpstack_64.c x86/percpu: Move irq_stack variables next to current_task 2022-10-17 16:41:05 +02:00
e820.c x86/mm: Make e820__end_ram_pfn() cover E820_TYPE_ACPI ranges 2024-06-17 17:46:08 +02:00
early-quirks.c drm/intel/pciids: rename i915_pciids.h to just pciids.h 2024-10-29 16:14:04 +02:00
early_printk.c x86/earlyprintk: Clean up pciserial 2022-08-29 12:19:25 +02:00
ebda.c
eisa.c x86/EISA: Dereference memory directly instead of using readl() 2024-08-29 15:57:09 +02:00
espfix_64.c x86/fred: No ESPFIX needed when FRED is enabled 2024-01-31 22:01:51 +01:00
fred.c x86/entry: Set FRED RSP0 on return to userspace instead of context switch 2024-08-25 19:23:00 +02:00
ftrace.c - The series "zram: optimal post-processing target selection" from 2024-11-23 09:58:07 -08:00
ftrace_32.S x86/headers: Replace #include <asm/export.h> with #include <linux/export.h> 2023-10-03 10:38:07 +02:00
ftrace_64.S x86/headers: Replace #include <asm/export.h> with #include <linux/export.h> 2023-10-03 10:38:07 +02:00
head32.c x86/microcode/32: Move early loading after paging enable 2023-10-18 22:15:01 +02:00
head64.c x86/boot/64: Strip percpu address space when setting up GDT descriptors 2024-08-25 16:07:51 +02:00
head_32.S x86/cleanups changes for v6.10: 2024-05-13 18:21:24 -07:00
head_64.S objtool: Detect non-relocated text references 2024-10-17 15:13:06 -07:00
hpet.c x86/apic/msi: Use DOMAIN_BUS_GENERIC_MSI for HPET/IO-APIC domain search 2024-02-25 18:53:08 +01:00
hw_breakpoint.c x86/amd: Cache debug register values in percpu variables 2023-01-31 20:09:26 +01:00
i8237.c
i8253.c x86/i8253: Disable PIT timer 0 when not in use 2024-08-02 18:27:05 +02:00
i8259.c x86/i8259: Skip probing when ACPI/MADT advertises PCAT compatibility 2023-10-27 20:36:49 +02:00
ibt_selftest.S x86/ibt: Convert IBT selftest to asm 2023-08-17 17:07:09 +02:00
idt.c x86/irq: Install posted MSI notification handler 2024-04-30 00:54:42 +02:00
io_delay.c
ioport.c
irq.c x86/irq: Factor out common code for checking pending interrupts 2024-04-30 00:54:43 +02:00
irq_32.c x86/percpu: Move irq_stack variables next to current_task 2022-10-17 16:41:05 +02:00
irq_64.c fix missing vmalloc.h includes 2024-04-25 20:55:49 -07:00
irq_work.c x86/apic: Wrap IPI calls into helper functions 2023-08-09 12:00:55 -07:00
irqflags.S x86/headers: Replace #include <asm/export.h> with #include <linux/export.h> 2023-10-03 10:38:07 +02:00
irqinit.c x86/fred: Invoke FRED initialization code to enable FRED 2024-01-31 22:03:36 +01:00
itmt.c sysctl: treewide: constify the ctl_table argument of proc_handlers 2024-07-24 20:59:29 +02:00
jailhouse.c xen: allow mapping ACPI data using a different physical address 2024-09-12 08:25:07 +02:00
jump_label.c jump_label: make initial NOP patching the special case 2022-06-24 09:48:55 +02:00
kdebugfs.c x86/boot: Fix memremap of setup_indirect structures 2022-03-09 12:49:44 +01:00
kexec-bzimage64.c - Sumanth Korikkar has taught s390 to allocate hotplug-time page frames 2024-03-14 17:43:30 -07:00
kgdb.c x86/kgdb: Fix a kerneldoc warning when build with W=1 2023-09-24 11:00:13 +02:00
ksysfs.c x86/boot: Fix memremap of setup_indirect structures 2022-03-09 12:49:44 +01:00
kvm.c x86/kvm: Override default caching mode for SEV-SNP and TDX 2024-10-20 07:07:02 -04:00
kvmclock.c kvmclock: Unexport kvmclock clocksource 2024-02-07 17:05:21 +01:00
ldt.c x86/bugs: Rename CONFIG_PAGE_TABLE_ISOLATION => CONFIG_MITIGATION_PAGE_TABLE_ISOLATION 2024-01-10 10:52:28 +01:00
machine_kexec_32.c x86/kexec: Set_[gi]dt() -> native_[gi]dt_invalidate() in machine_kexec_*.c 2021-05-21 12:36:45 +02:00
machine_kexec_64.c x86/kexec: Add EFI config table identity mapping for kexec kernel 2024-08-05 16:09:31 +02:00
Makefile x86: Ignore stack unwinding in KCOV 2024-08-08 17:36:35 +02:00
mmconf-fam10h_64.c xen: allow mapping ACPI data using a different physical address 2024-09-12 08:25:07 +02:00
module.c x86/module: prepare module loading for ROX allocations of text 2024-11-07 14:25:16 -08:00
mpparse.c x86/mpparse: Cleanup apic_printk()s 2024-08-07 18:13:28 +02:00
msr.c x86/MSR: make msr_class a static const structure 2023-08-05 08:31:42 +02:00
nmi.c x86/nmi: Upgrade NMI backtrace stall checks & messages 2024-03-26 10:07:59 +01:00
nmi_selftest.c x86/apic: Wrap IPI calls into helper functions 2023-08-09 12:00:55 -07:00
paravirt-spinlocks.c x86/paravirt: Add new features for paravirt patching 2021-03-11 19:51:49 +01:00
paravirt.c x86/paravirt: Fix incorrect virt spinlock setting on bare metal 2024-08-07 20:04:38 +02:00
pci-dma.c x86: always initialize xen-swiotlb when xen-pcifront is enabling 2023-07-31 17:54:27 +02:00
pcspeaker.c
perf_regs.c - Remove all uses of TIF_IA32 and TIF_X32 and reclaim the two bits in the end 2020-12-14 13:45:26 -08:00
platform-quirks.c x86/quirks: Include linux/pnp.h for arch_pnpbios_disabled() 2023-05-18 11:56:18 -07:00
pmem.c x86/pmem: Fix platform-device leak in error path 2022-06-20 18:01:16 +02:00
probe_roms.c x86/sev: Skip ROM range scans and validation for SEV-SNP guests 2024-03-26 15:22:35 +01:00
process.c x86/smp: Add smp_ops.stop_this_cpu() callback 2024-06-17 17:46:20 +02:00
process.h x86: Snapshot thread flags 2021-12-01 00:06:43 +01:00
process_32.c x86/fpu: Clean up FPU switching in the middle of task switching 2023-10-20 11:24:22 +02:00
process_64.c x86/mm: Cleanup prctl_enable_tagged_addr() nr_bits error checking 2024-07-02 11:33:44 -07:00
ptrace.c x86: Add PTRACE interface for shadow stack 2023-08-02 15:01:51 -07:00
pvclock.c locking/atomic: treewide: use raw_atomic*_<op>() 2023-06-05 09:57:20 +02:00
quirks.c x86, powerpc: Rename memcpy_mcsafe() to copy_mc_to_{user, kernel}() 2020-10-06 11:18:04 +02:00
reboot.c x86/reboot: emergency callbacks are now registered by common KVM code 2024-10-06 03:55:37 -04:00
reboot_fixups_32.c
relocate_kernel_32.S x86/kexec: Disable RET on kexec 2022-07-09 13:12:32 +02:00
relocate_kernel_64.S x86: Fix build regression with CONFIG_KEXEC_JUMP enabled 2024-12-09 10:13:28 -08:00
resource.c x86/PCI: Tidy E820 removal messages 2022-12-10 10:33:11 -06:00
rethook.c x86,rethook: Fix arch_rethook_trampoline() to generate a complete pt_regs 2022-03-28 19:38:51 -07:00
rtc.c x86/rtc: Remove unused intel-mid.h 2024-04-03 08:24:48 -07:00
setup.c x86/fred: Enable FRED right after init_mem_mapping() 2024-08-13 21:59:21 +02:00
setup_percpu.c x86/asm: Add DB flag to 32-bit percpu GDT entry 2023-12-20 10:57:51 +01:00
sev_verify_cbit.S x86/boot: Use 32-bit XOR to clear registers 2024-03-01 12:47:37 +01:00
shstk.c uprobe: Add uretprobe syscall to speed up return probe 2024-06-12 08:44:28 +09:00
signal.c x86/pkeys: Update PKRU to enable all pkeys before XSAVE 2024-08-02 14:12:21 +02:00
signal_32.c x86/syscall/compat: Remove ia32_unistd.h 2024-03-22 09:37:09 +01:00
signal_64.c x86/pkeys: Restore altstack access in sigreturn() 2024-08-02 14:12:21 +02:00
smp.c - Sumanth Korikkar has taught s390 to allocate hotplug-time page frames 2024-03-14 17:43:30 -07:00
smpboot.c x86/cpu: Enable SD_ASYM_PACKING for PKG domain on AMD 2024-10-25 20:43:22 +02:00
stacktrace.c x86: remove __range_not_ok() 2022-02-25 09:36:05 +01:00
static_call.c x86/static-call: provide a way to do very early static-call updates 2024-12-13 09:28:32 +01:00
step.c x86/msr: Prepare for including <linux/percpu.h> into <asm/msr.h> 2024-03-04 12:01:39 +01:00
sys_ia32.c x86: switch to kernel_clone() 2020-08-20 13:12:58 +02:00
sys_x86_64.c arch/x86: teach arch_get_unmapped_area_vmflags to handle hugetlb mappings 2024-11-06 20:11:10 -08:00
tboot.c mm: remove rb tree. 2022-09-26 19:46:16 -07:00
time.c x86: stop playing stack games in profile_pc() 2024-06-28 14:27:22 -07:00
tls.c x86/gsseg: Move load_gs_index() to its own new header file 2023-01-12 13:06:36 +01:00
tls.h
trace.c trace/osnoise: Fix an ifdef comment 2021-10-25 23:02:36 -04:00
trace_clock.c
tracepoint.c x86/traceponit: Fix comment about irq vector tracepoints 2022-05-26 22:03:52 -04:00
traps.c x86/traps: move kmsan check after instrumentation_begin 2024-10-28 21:40:39 -07:00
tsc.c seqlock, treewide: Switch to non-raw seqcount_latch interface 2024-11-05 12:55:35 +01:00
tsc_msr.c x86/tsc_msr: Switch to new Intel CPU model defines 2024-04-29 10:31:34 +02:00
tsc_sync.c x86/tsc: Trust initial offset in architectural TSC-adjust MSRs 2024-04-29 23:27:16 +02:00
umip.c x86/umip: Downgrade warning messages to debug loglevel 2021-09-25 13:23:28 +02:00
unwind_frame.c x86: kmsan: don't instrument stack walking functions 2022-10-03 14:03:25 -07:00
unwind_guess.c x86/unwind: Recover kretprobe trampoline entry 2021-09-30 21:24:07 -04:00
unwind_orc.c x86/unwind/orc: Fix unwind for newly forked tasks 2024-10-17 15:13:07 -07:00
uprobes.c uprobe: Add uretprobe syscall to speed up return probe 2024-06-12 08:44:28 +09:00
verify_cpu.S x86: Prepare asm files for straight-line-speculation 2021-12-08 12:25:37 +01:00
vm86_32.c x86/32: Remove lazy GS macros 2022-04-14 14:09:43 +02:00
vmcore_info_32.c crash: split vmcoreinfo exporting code out from crash_core.c 2024-02-23 17:48:22 -08:00
vmcore_info_64.c crash: split vmcoreinfo exporting code out from crash_core.c 2024-02-23 17:48:22 -08:00
vmlinux.lds.S x86/xen: remove hypercall page 2024-12-17 08:23:42 +01:00
vsmp_64.c x86/apic: Remove unused phys_pkg_id() callback 2024-02-15 22:07:38 +01:00
x86_init.c xen: allow mapping ACPI data using a different physical address 2024-09-12 08:25:07 +02:00