x86 fixes
Subsystems (8)
Linus,
Please pull the latest x86/urgent git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-urgent-2022-08-28
# HEAD: 00da0cb385d05a89226e150a102eb49d8abb0359 Documentation/ABI: Mention retbleed vulnerability info file for sysfs
Misc fixes:
- Fix PAT on Xen, which caused i915 driver failures
- Fix compat INT 80 entry crash on Xen PV guests
- Fix 'MMIO Stale Data' mitigation status reporting on older Intel CPUs
- Fix RSB stuffing regressions
- Fix ORC unwinding on ftrace trampolines
- Add Intel Raptor Lake CPU model number
- Fix (work around) a SEV-SNP bootloader bug providing bogus values in boot_params->cc_blob_address, by ignoring the value on !SEV-SNP bootups.
- Fix SEV-SNP early boot failure
- Fix the objtool list of noreturn functions and annotate snp_abort(), which bug confused objtool on gcc-12.
- Fix the documentation for retbleed
Thanks,
Ingo
------------------>
Borislav Petkov (1):
x86/sev: Mark snp_abort() noreturn
Chen Zhongjin (1):
x86/unwind/orc: Unwind ftrace trampolines with correct ORC entry
Jan Beulich (1):
x86/PAT: Have pat_enabled() properly reflect state when running on Xen
Juergen Gross (1):
x86/entry: Fix entry_INT80_compat for Xen PV guests
Michael Roth (1):
x86/boot: Don't propagate uninitialized boot_params->cc_blob_address
Pawan Gupta (1):
x86/bugs: Add "unknown" reporting for MMIO Stale Data
Peter Zijlstra (2):
x86/nospec: Unwreck the RSB stuffing
x86/nospec: Fix i386 RSB stuffing
Salvatore Bonaccorso (1):
Documentation/ABI: Mention retbleed vulnerability info file for sysfs
Tom Lendacky (1):
x86/sev: Don't use cc_platform_has() for early SEV-SNP calls
Tony Luck (1):
x86/cpu: Add new Raptor Lake CPU model number
Documentation/ABI/testing/sysfs-devices-system-cpu | 1 + .../hw-vuln/processor_mmio_stale_data.rst | 14 ++++ arch/x86/boot/compressed/misc.h | 12 ++- arch/x86/boot/compressed/sev.c | 8 ++ arch/x86/entry/entry_64_compat.S | 2 +- arch/x86/include/asm/cpufeatures.h | 5 +- arch/x86/include/asm/intel-family.h | 2 + arch/x86/include/asm/nospec-branch.h | 92 ++++++++++++---------- arch/x86/include/asm/sev.h | 2 +- arch/x86/kernel/cpu/bugs.c | 14 +++- arch/x86/kernel/cpu/common.c | 42 ++++++---- arch/x86/kernel/sev.c | 18 ++++- arch/x86/kernel/unwind_orc.c | 15 ++-- arch/x86/mm/pat/memtype.c | 10 ++- tools/objtool/check.c | 34 ++++---- 15 files changed, 183 insertions(+), 88 deletions(-)
Documentation/ABI/testing/sysfs-devices-system-cpu +1 -0
@@ -523,6 +523,7 @@ What: /sys/devices/system/cpu/vulnerabilities /sys/devices/system/cpu/vulnerabilities/tsx_async_abort /sys/devices/system/cpu/vulnerabilities/itlb_multihit /sys/devices/system/cpu/vulnerabilities/mmio_stale_data + /sys/devices/system/cpu/vulnerabilities/retbleed Date: January 2018 Contact: Linux kernel mailing list <[email protected]> Description: Information about CPU vulnerabilities
Documentation/admin-guide/hw-vuln/processor_mmio_stale_data.rst +14 -0
@@ -230,6 +230,20 @@ The possible values in this file are: * - 'Mitigation: Clear CPU buffers' - The processor is vulnerable and the CPU buffer clearing mitigation is enabled. + * - 'Unknown: No mitigations' + - The processor vulnerability status is unknown because it is + out of Servicing period. Mitigation is not attempted. + +Definitions: +------------ + +Servicing period: The process of providing functional and security updates to +Intel processors or platforms, utilizing the Intel Platform Update (IPU) +process or other similar mechanisms. + +End of Servicing Updates (ESU): ESU is the date at which Intel will no +longer provide Servicing, such as through IPU or other similar update +processes. ESU dates will typically be aligned to end of quarter. If the processor is vulnerable then the following information is appended to the above information:
arch/x86/boot/compressed/misc.h +11 -1
@@ -132,7 +132,17 @@ void snp_set_page_private(unsigned long paddr);void snp_set_page_shared (unsigned long paddr);void sev_prep_identity_maps (unsigned long top_level_pgt);#else -static inline void sev_enable (struct boot_params *bp) { } +static inline void sev_enable (struct boot_params *bp) +{ +/* +* bp->cc_blob_address should only be set by boot/compressed kernel. +* Initialize it to 0 unconditionally (thus here in this stub too) to +* ensure that uninitialized values from buggy bootloaders aren't +* propagated. +*/ +if (bp) + bp->cc_blob_address =0 ; +}static inline void sev_es_shutdown_ghcb (void ) { }static inline bool sev_es_check_ghcb_fault (unsigned long address) {
arch/x86/boot/compressed/sev.c +8 -0
@@ -276,6 +276,14 @@ void sev_enable(struct boot_params *bp)struct msr m;bool snp; +/* +* bp->cc_blob_address should only be set by boot/compressed kernel. +* Initialize it to 0 to ensure that uninitialized values from +* buggy bootloaders aren't propagated. +*/ +if (bp) + bp->cc_blob_address =0 ; +/* * Setup/preliminary detection of SNP. This will be sanity-checked * against CPUID/MSR values later.
arch/x86/entry/entry_64_compat.S +1 -1
@@ -311,7 +311,7 @@ SYM_CODE_START(entry_INT80_compat) * Interrupts are off on entry. */ ASM_CLAC /* Do this early to minimize exposure */ - SWAPGS + ALTERNATIVE "swapgs", "", X86_FEATURE_XENPV /* * User tracing code (ptrace or signal handlers) might assume that
arch/x86/include/asm/cpufeatures.h +3 -2
@@ -457,7 +457,8 @@#define X86_BUG_ITLB_MULTIHIT X86_BUG(23)/* CPU may incur MCE during certain page attribute changes */ #define X86_BUG_SRBDS X86_BUG(24)/* CPU may leak RNG bits if not mitigated */ #define X86_BUG_MMIO_STALE_DATA X86_BUG(25)/* CPU is affected by Processor MMIO Stale Data vulnerabilities */ -#define X86_BUG_RETBLEED X86_BUG(26)/* CPU is affected by RETBleed */ -#define X86_BUG_EIBRS_PBRSB X86_BUG(27)/* EIBRS is vulnerable to Post Barrier RSB Predictions */ +#define X86_BUG_MMIO_UNKNOWN X86_BUG(26)/* CPU is too old and its MMIO Stale Data status is unknown */ +#define X86_BUG_RETBLEED X86_BUG(27)/* CPU is affected by RETBleed */ +#define X86_BUG_EIBRS_PBRSB X86_BUG(28)/* EIBRS is vulnerable to Post Barrier RSB Predictions */ #endif /* _ASM_X86_CPUFEATURES_H */
arch/x86/include/asm/intel-family.h +2 -0
@@ -27,6 +27,7 @@* _X - regular server parts * _D - micro server parts * _N,_P - other mobile parts +* _S - other client parts * * Historical OPTDIFFs: *
@@ -112,6 +113,7 @@#define INTEL_FAM6_RAPTORLAKE 0xB7#define INTEL_FAM6_RAPTORLAKE_P 0xBA +#define INTEL_FAM6_RAPTORLAKE_S 0xBF/* "Small Core" Processors (Atom) */
arch/x86/include/asm/nospec-branch.h +51 -41
112 lines not on this page · raw message
arch/x86/include/asm/sev.h +1 -1
@@ -195,7 +195,7 @@ void snp_set_memory_shared(unsigned long vaddr, unsigned int npages);void snp_set_memory_private (unsigned long vaddr,unsigned int npages);void snp_set_wakeup_secondary_cpu (void );bool snp_init (struct boot_params *bp); -void snp_abort (void ); +void __init __noreturn snp_abort (void );int snp_issue_guest_request (u64 exit_code,struct snp_req_data *input,unsigned long *fw_err);#else static inline void sev_es_ist_enter (struct pt_regs *regs) { }
arch/x86/kernel/cpu/bugs.c +12 -2
@@ -433,7 +433,8 @@ static void __init mmio_select_mitigation(void)u64 ia32_cap;if (!boot_cpu_has_bug (X86_BUG_MMIO_STALE_DATA ) || -cpu_mitigations_off ()) { +boot_cpu_has_bug (X86_BUG_MMIO_UNKNOWN ) || +cpu_mitigations_off ()) { mmio_mitigation =MMIO_MITIGATION_OFF ;return ; }
@@ -538,6 +539,8 @@ static void __init md_clear_update_mitigation(void)pr_info ("TAA: %s\n" , taa_strings[taa_mitigation]);if (boot_cpu_has_bug (X86_BUG_MMIO_STALE_DATA ))pr_info ("MMIO Stale Data: %s\n" , mmio_strings[mmio_mitigation]); +else if (boot_cpu_has_bug (X86_BUG_MMIO_UNKNOWN )) +pr_info ("MMIO Stale Data: Unknown: No mitigations\n" ); }static void __init md_clear_select_mitigation (void )
@@ -2275,6 +2278,9 @@ static ssize_t tsx_async_abort_show_state(char *buf)static ssize_t mmio_stale_data_show_state (char *buf) { +if (boot_cpu_has_bug (X86_BUG_MMIO_UNKNOWN )) +return sysfs_emit (buf,"Unknown: No mitigations\n" ); +if (mmio_mitigation ==MMIO_MITIGATION_OFF )return sysfs_emit (buf,"%s\n" , mmio_strings[mmio_mitigation]);
@@ -2421,6 +2427,7 @@ static ssize_t cpu_show_common(struct device *dev, struct device_attribute *attrreturn srbds_show_state (buf);case X86_BUG_MMIO_STALE_DATA : +case X86_BUG_MMIO_UNKNOWN :return mmio_stale_data_show_state (buf);case X86_BUG_RETBLEED :
@@ -2480,7 +2487,10 @@ ssize_t cpu_show_srbds(struct device *dev, struct device_attribute *attr, char *ssize_t cpu_show_mmio_stale_data (struct device *dev,struct device_attribute *attr,char *buf) { -return cpu_show_common (dev, attr, buf,X86_BUG_MMIO_STALE_DATA ); +if (boot_cpu_has_bug (X86_BUG_MMIO_UNKNOWN )) +return cpu_show_common (dev, attr, buf,X86_BUG_MMIO_UNKNOWN ); +else +return cpu_show_common (dev, attr, buf,X86_BUG_MMIO_STALE_DATA ); }ssize_t cpu_show_retbleed (struct device *dev,struct device_attribute *attr,char *buf)
arch/x86/kernel/cpu/common.c +27 -15
77 lines not on this page · raw message
arch/x86/kernel/sev.c +15 -3
@@ -701,7 +701,13 @@ static void __init early_set_pages_state(unsigned long paddr, unsigned int npagevoid __init early_snp_set_memory_private (unsigned long vaddr,unsigned long paddr,unsigned int npages) { -if (!cc_platform_has (CC_ATTR_GUEST_SEV_SNP )) +/* +* This can be invoked in early boot while running identity mapped, so +* use an open coded check for SNP instead of using cc_platform_has(). +* This eliminates worries about jump tables or checking boot_cpu_data +* in the cc_platform_has() function. +*/ +if (!(sev_status &MSR_AMD64_SEV_SNP_ENABLED ))return ;/*
@@ -717,7 +723,13 @@ void __init early_snp_set_memory_private(unsigned long vaddr, unsigned long paddvoid __init early_snp_set_memory_shared (unsigned long vaddr,unsigned long paddr,unsigned int npages) { -if (!cc_platform_has (CC_ATTR_GUEST_SEV_SNP )) +/* +* This can be invoked in early boot while running identity mapped, so +* use an open coded check for SNP instead of using cc_platform_has(). +* This eliminates worries about jump tables or checking boot_cpu_data +* in the cc_platform_has() function. +*/ +if (!(sev_status &MSR_AMD64_SEV_SNP_ENABLED ))return ;/* Invalidate the memory pages before they are marked shared in the RMP table. */
@@ -2100,7 +2112,7 @@ bool __init snp_init(struct boot_params *bp)return true; } -void __init snp_abort (void ) +void __init __noreturn snp_abort (void ) {sev_es_terminate (SEV_TERM_SET_GEN ,GHCB_SNP_UNSUPPORTED ); }
arch/x86/kernel/unwind_orc.c +10 -5
@@ -93,22 +93,27 @@ static struct orc_entry *orc_find(unsigned long ip);static struct orc_entry *orc_ftrace_find (unsigned long ip) {struct ftrace_ops *ops; -unsigned long caller; +unsigned long tramp_addr, offset; ops =ftrace_ops_trampoline (ip);if (!ops)return NULL ; +/* Set tramp_addr to the start of the code copied by the trampoline */ if (ops->flags &FTRACE_OPS_FL_SAVE_REGS ) - caller = (unsigned long )ftrace_regs_call; + tramp_addr = (unsigned long )ftrace_regs_caller;else - caller = (unsigned long )ftrace_call; + tramp_addr = (unsigned long )ftrace_caller; + +/* Now place tramp_addr to the location within the trampoline ip is at */ + offset = ip - ops->trampoline; + tramp_addr += offset;/* Prevent unlikely recursion */ -if (ip == caller) +if (ip == tramp_addr)return NULL ; -return orc_find (caller); +return orc_find (tramp_addr); }#else static struct orc_entry *orc_ftrace_find (unsigned long ip)
arch/x86/mm/pat/memtype.c +9 -1
@@ -62,6 +62,7 @@static bool __read_mostly pat_bp_initialized;static bool __read_mostly pat_disabled = !IS_ENABLED (CONFIG_X86_PAT ); +static bool __initdata pat_force_disabled = !IS_ENABLED (CONFIG_X86_PAT );static bool __read_mostly pat_bp_enabled;static bool __read_mostly pat_cm_initialized;
@@ -86,6 +87,7 @@ void pat_disable(const char *msg_reason)static int __init nopat (char *str) {pat_disable ("PAT support disabled via boot option." ); + pat_force_disabled = true;return 0 ; }early_param ("nopat" , nopat);
@@ -272,7 +274,7 @@ static void pat_ap_init(u64 pat)wrmsrl (MSR_IA32_CR_PAT , pat); } -void init_cache_modes (void ) +void __init init_cache_modes (void ) {u64 pat =0 ;
@@ -313,6 +315,12 @@ void init_cache_modes(void)*/ pat =PAT (0 ,WB ) |PAT (1 ,WT ) |PAT (2 ,UC_MINUS ) |PAT (3 ,UC ) |PAT (4 ,WB ) |PAT (5 ,WT ) |PAT (6 ,UC_MINUS ) |PAT (7 ,UC ); + }else if (!pat_force_disabled &&cpu_feature_enabled (X86_FEATURE_HYPERVISOR )) { +/* +* Clearly PAT is enabled underneath. Allow pat_enabled() to +* reflect this. +*/ + pat_bp_enabled = true; }__init_cache_modes (pat);
tools/objtool/check.c +18 -16
@@ -162,32 +162,34 @@ static bool __dead_end_function(struct objtool_file *file, struct symbol *func,/* * Unfortunately these have to be hard coded because the noreturn -* attribute isn't provided in ELF data. +* attribute isn't provided in ELF data. Keep 'em sorted. */ static const char *const global_noreturns[] = { +"__invalid_creds" , +"__module_put_and_kthread_exit" , +"__reiserfs_panic" ,"__stack_chk_fail" , -"panic" , +"__ubsan_handle_builtin_unreachable" , +"cpu_bringup_and_idle" , +"cpu_startup_entry" ,"do_exit" , +"do_group_exit" ,"do_task_dead" , -"kthread_exit" , -"make_task_dead" , -"__module_put_and_kthread_exit" , +"ex_handler_msr_mce" , +"fortify_panic" ,"kthread_complete_and_exit" , -"__reiserfs_panic" , +"kthread_exit" , +"kunit_try_catch_throw" ,"lbug_with_loc" , -"fortify_panic" , -"usercopy_abort" ,"machine_real_restart" , +"make_task_dead" , +"panic" ,"rewind_stack_and_make_dead" , -"kunit_try_catch_throw" , -"xen_start_kernel" , -"cpu_bringup_and_idle" , -"do_group_exit" , +"sev_es_terminate" , +"snp_abort" ,"stop_this_cpu" , -"__invalid_creds" , -"cpu_startup_entry" , -"__ubsan_handle_builtin_unreachable" , -"ex_handler_msr_mce" , +"usercopy_abort" , +"xen_start_kernel" , };if (!func)
The pull request you sent on Sun, 28 Aug 2022 16:57:20 +0200:
The pull request you sent on Sun, 28 Aug 2022 16:57:20 +0200:
Quoted 1 line
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.gitx86-urgent-2022-08-28
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/2f23a7c914317ac0b2a7e2bbe48dc00213652f98
Thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/prtracker.html