Linux 5.4.217
Greg Kroah-Hartman
maintainerI'm announcing the release of the 5.4.217 kernel.
All users of the 5.4 kernel series must upgrade.
The updated 5.4.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-5.4.y
and can be browsed at the normal kernel.org git web browser:
https://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary
thanks,
greg k-h
------------
Documentation/admin-guide/kernel-parameters.txt | 13 Documentation/process/code-of-conduct-interpretation.rst | 2 Makefile | 2 arch/x86/entry/calling.h | 68 ++ arch/x86/entry/entry_32.S | 2 arch/x86/entry/entry_64.S | 34 + arch/x86/entry/entry_64_compat.S | 11 arch/x86/include/asm/cpu_device_id.h | 132 +++++ arch/x86/include/asm/cpufeatures.h | 13 arch/x86/include/asm/intel-family.h | 6 arch/x86/include/asm/msr-index.h | 10 arch/x86/include/asm/nospec-branch.h | 54 +- arch/x86/kernel/cpu/amd.c | 21 arch/x86/kernel/cpu/bugs.c | 365 +++++++++++---- arch/x86/kernel/cpu/common.c | 61 +- arch/x86/kernel/cpu/match.c | 13 arch/x86/kernel/cpu/scattered.c | 1 arch/x86/kernel/process.c | 2 arch/x86/kvm/svm.c | 1 arch/x86/kvm/vmx/nested.c | 32 - arch/x86/kvm/vmx/run_flags.h | 8 arch/x86/kvm/vmx/vmenter.S | 161 +++--- arch/x86/kvm/vmx/vmx.c | 72 +- arch/x86/kvm/vmx/vmx.h | 5 arch/x86/kvm/x86.c | 4 drivers/base/cpu.c | 8 drivers/cpufreq/acpi-cpufreq.c | 1 drivers/cpufreq/amd_freq_sensitivity.c | 1 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 2 drivers/idle/intel_idle.c | 43 + fs/xfs/libxfs/xfs_attr.c | 2 fs/xfs/libxfs/xfs_attr_leaf.c | 4 fs/xfs/libxfs/xfs_attr_leaf.h | 26 - fs/xfs/libxfs/xfs_attr_remote.c | 85 ++- fs/xfs/libxfs/xfs_attr_remote.h | 2 fs/xfs/libxfs/xfs_da_btree.h | 17 fs/xfs/libxfs/xfs_da_format.c | 1 fs/xfs/libxfs/xfs_da_format.h | 59 -- fs/xfs/libxfs/xfs_dir2.h | 2 fs/xfs/libxfs/xfs_dir2_priv.h | 19 fs/xfs/libxfs/xfs_format.h | 7 fs/xfs/xfs_attr_inactive.c | 146 +----- fs/xfs/xfs_file.c | 7 fs/xfs/xfs_inode.c | 25 - fs/xfs/xfs_reflink.c | 3 fs/xfs/xfs_super.c | 48 - include/linux/cpu.h | 2 include/linux/kvm_host.h | 2 include/linux/mod_devicetable.h | 4 scripts/Makefile.extrawarn | 1 tools/arch/x86/include/asm/cpufeatures.h | 2 51 files changed, 1055 insertions(+), 557 deletions(-)
Alexandre Chartre (2):
x86/bugs: Report AMD retbleed vulnerability
x86/bugs: Add AMD retbleed= boot parameter
Andrew Cooper (1):
x86/cpu/amd: Enumerate BTC_NO
Christoph Hellwig (3):
xfs: fix misuse of the XFS_ATTR_INCOMPLETE flag
xfs: fix IOCB_NOWAIT handling in xfs_file_dio_aio_read
xfs: move incore structures out of xfs_da_format.h
Daniel Sneddon (1):
x86/speculation: Add RSB VM Exit protections
Darrick J. Wong (7):
xfs: introduce XFS_MAX_FILEOFF
xfs: truncate should remove all blocks, not just to the end of the page cache
xfs: fix s_maxbytes computation on 32-bit kernels
xfs: refactor remote attr value buffer invalidation
xfs: fix memory corruption during remote attr value buffer invalidation
xfs: streamline xfs_attr3_leaf_inactive
xfs: fix uninitialized variable in xfs_attr3_leaf_inactive
Greg Kroah-Hartman (2):
Revert "drm/amdgpu: use dirty framebuffer helper" Linux 5.4.217
Josh Poimboeuf (9):
x86/speculation: Fix RSB filling with CONFIG_RETPOLINE=n x86/speculation: Fix firmware entry SPEC_CTRL handling x86/speculation: Fix SPEC_CTRL write on SMT state change x86/speculation: Use cached host SPEC_CTRL value for guest entry/exit x86/speculation: Remove x86_spec_ctrl_mask
KVM: VMX: Flatten __vmx_vcpu_run()
KVM: VMX: Prevent guest RSB poisoning attacks with eIBRS
KVM: VMX: Fix IBRS handling after vmexit
x86/speculation: Fill RSB on vmexit for IBRS
Mark Gross (1):
x86/cpu: Add a steppings field to struct x86_cpu_id
Nathan Chancellor (1):
x86/speculation: Use DECLARE_PER_CPU for x86_spec_ctrl_current
Pawan Gupta (4):
x86/speculation: Add spectre_v2=ibrs option to support Kernel IBRS x86/bugs: Add Cannon lake to RETBleed affected CPU list x86/speculation: Disable RRSBA behavior
x86/bugs: Warn when "ibrs" mitigation is selected on Enhanced IBRS parts
Peter Zijlstra (11):
x86/kvm/vmx: Make noinstr clean
x86/cpufeatures: Move RETPOLINE flags to word 11
x86/bugs: Keep a per-CPU IA32_SPEC_CTRL value
x86/entry: Remove skip_r11rcx
x86/entry: Add kernel IBRS implementation
x86/bugs: Optimize SPEC_CTRL MSR writes
x86/bugs: Split spectre_v2_select_mitigation() and spectre_v2_user_select_mitigation() x86/bugs: Report Intel retbleed vulnerability
intel_idle: Disable IBRS during long idle
x86/speculation: Change FILL_RETURN_BUFFER to work with objtool x86/common: Stamp out the stepping madness
Sami Tolvanen (1):
Makefile.extrawarn: Move -Wcast-function-type-strict to W=1
Shuah Khan (1):
docs: update mediator information in CoC docs
Thadeu Lima de Souza Cascardo (3):
Revert "x86/speculation: Add RSB VM Exit protections" Revert "x86/cpu: Add a steppings field to struct x86_cpu_id"
KVM: VMX: Convert launched argument to flags
Thomas Gleixner (2):
x86/devicetable: Move x86 specific macro out of generic code x86/cpu: Add consistent CPU match macros
Uros Bizjak (2):
KVM/VMX: Use TEST %REG,%REG instead of CMP $0,%REG in vmenter.S KVM/nVMX: Use __vmx_vcpu_run in nested_vmx_check_vmentry_hw
YueHaibing (1):
xfs: remove unused variable 'done'
Greg Kroah-Hartman
maintainerDocumentation/admin-guide/kernel-parameters.txt +13 -0
@@ -4298,6 +4298,18 @@ retain_initrd [RAM] Keep initrd memory after extraction + retbleed= [X86] Control mitigation of RETBleed (Arbitrary + Speculative Code Execution with Return Instructions) + vulnerability. + + off - unconditionally disable + auto - automatically select a migitation + + Selecting 'auto' will choose a mitigation method at run + time according to the CPU. + + Not specifying this option is equivalent to retbleed=auto. + rfkill.default_state= 0 "airplane mode". All wifi, bluetooth, wimax, gps, fm, etc. communication is blocked by default.
@@ -4541,6 +4553,7 @@ eibrs - enhanced IBRS eibrs,retpoline - enhanced IBRS + Retpolines eibrs,lfence - enhanced IBRS + LFENCE + ibrs - use IBRS to protect kernel Not specifying this option is equivalent to spectre_v2=auto.
Documentation/process/code-of-conduct-interpretation.rst +1 -1
@@ -51,7 +51,7 @@ the Technical Advisory Board (TAB) or other maintainers if you're uncertain how to handle situations that come up. It will not be considered a violation report unless you want it to be. If you are uncertain about approaching the TAB or any other maintainers, please -reach out to our conflict mediator, Mishi Choudhary <[email protected]>. +reach out to our conflict mediator, Joanna Lee <[email protected]>. In the end, "be kind to each other" is really what the end goal is for everybody. We know everyone is human and we all fail at times, but the
Makefile +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 VERSION = 5 PATCHLEVEL = 4 -SUBLEVEL = 216 +SUBLEVEL = 217 EXTRAVERSION = NAME = Kleptomaniac Octopus
arch/x86/entry/calling.h +59 -9
98 lines not on this page · raw message
arch/x86/entry/entry_32.S +0 -2
@@ -750,7 +750,6 @@ ENTRY(__switch_to_asm) movl %ebx, PER_CPU_VAR(stack_canary)+stack_canary_offset #endif -#ifdef CONFIG_RETPOLINE /* * When switching from a shallower to a deeper call stack * the RSB may either underflow or use entries populated
@@ -759,7 +758,6 @@ ENTRY(__switch_to_asm) * speculative execution to prevent attack. */ FILL_RETURN_BUFFER %ebx, RSB_CLEAR_LOOPS, X86_FEATURE_RSB_CTXSW -#endif /* restore callee-saved registers */ popfl
arch/x86/entry/entry_64.S +29 -5
@@ -172,6 +172,10 @@ GLOBAL(entry_SYSCALL_64_after_hwframe) /* IRQs are off. */ movq %rax, %rdi movq %rsp, %rsi + + /* clobbers %rax, make sure it is after saving the syscall nr */ + IBRS_ENTER + call do_syscall_64 /* returns with IRQs disabled */ TRACE_IRQS_IRETQ /* we're about to change IF */
@@ -248,8 +252,8 @@ GLOBAL(entry_SYSCALL_64_after_hwframe) * perf profiles. Nothing jumps here. */ syscall_return_via_sysret: - /* rcx and r11 are already restored (see code above) */ - POP_REGS pop_rdi=0 skip_r11rcx=1 + IBRS_EXIT + POP_REGS pop_rdi=0 /* * Now all regs are restored except RSP and RDI.
@@ -301,7 +305,6 @@ ENTRY(__switch_to_asm) movq %rbx, PER_CPU_VAR(fixed_percpu_data) + stack_canary_offset #endif -#ifdef CONFIG_RETPOLINE /* * When switching from a shallower to a deeper call stack * the RSB may either underflow or use entries populated
@@ -310,7 +313,6 @@ ENTRY(__switch_to_asm) * speculative execution to prevent attack. */ FILL_RETURN_BUFFER %r12, RSB_CLEAR_LOOPS, X86_FEATURE_RSB_CTXSW -#endif /* restore callee-saved registers */ popq %r15
@@ -622,6 +624,7 @@ GLOBAL(retint_user) TRACE_IRQS_IRETQ GLOBAL(swapgs_restore_regs_and_return_to_usermode) + IBRS_EXIT #ifdef CONFIG_DEBUG_ENTRY /* Assert that pt_regs indicates user mode. */ testb $3, CS(%rsp)
@@ -1248,7 +1251,13 @@ ENTRY(paranoid_entry) */ FENCE_SWAPGS_KERNEL_ENTRY - ret + /* + * Once we have CR3 and %GS setup save and set SPEC_CTRL. Just like + * CR3 above, keep the old value in a callee saved register. + */ + IBRS_ENTER save_reg=%r15 + + RET END(paranoid_entry) /*
@@ -1276,12 +1285,20 @@ ENTRY(paranoid_exit) jmp .Lparanoid_exit_restore .Lparanoid_exit_no_swapgs: TRACE_IRQS_IRETQ_DEBUG + + /* + * Must restore IBRS state before both CR3 and %GS since we need access + * to the per-CPU x86_spec_ctrl_shadow variable. + */ + IBRS_EXIT save_reg=%r15 + /* Always restore stashed CR3 value (see paranoid_entry) */ RESTORE_CR3 scratch_reg=%rbx save_reg=%r14 .Lparanoid_exit_restore: jmp restore_regs_and_return_to_kernel END(paranoid_exit) + /* * Save all registers in pt_regs, and switch GS if needed. */
@@ -1301,6 +1318,7 @@ ENTRY(error_entry) FENCE_SWAPGS_USER_ENTRY /* We have user CR3. Change to kernel CR3. */ SWITCH_TO_KERNEL_CR3 scratch_reg=%rax + IBRS_ENTER .Lerror_entry_from_usermode_after_swapgs: /* Put us onto the real thread stack. */
@@ -1356,6 +1374,7 @@ ENTRY(error_entry) SWAPGS FENCE_SWAPGS_USER_ENTRY SWITCH_TO_KERNEL_CR3 scratch_reg=%rax + IBRS_ENTER /* * Pretend that the exception came from user mode: set up pt_regs
@@ -1461,6 +1480,8 @@ ENTRY(nmi) PUSH_AND_CLEAR_REGS rdx=(%rdx) ENCODE_FRAME_POINTER + IBRS_ENTER + /* * At this point we no longer need to worry about stack damage * due to nesting -- we're on the normal thread stack and we're
@@ -1684,6 +1705,9 @@ end_repeat_nmi: movq $-1, %rsi call do_nmi + /* Always restore stashed SPEC_CTRL value (see paranoid_entry) */ + IBRS_EXIT save_reg=%r15 + /* Always restore stashed CR3 value (see paranoid_entry) */ RESTORE_CR3 scratch_reg=%r15 save_reg=%r14
arch/x86/entry/entry_64_compat.S +10 -1
@@ -4,7 +4,6 @@ * * Copyright 2000-2002 Andi Kleen, SuSE Labs. */ -#include "calling.h" #include <asm/asm-offsets.h> #include <asm/current.h> #include <asm/errno.h>
@@ -17,6 +16,8 @@ #include <linux/linkage.h> #include <linux/err.h> +#include "calling.h" + .section .entry.text, "ax" /*
@@ -106,6 +107,8 @@ ENTRY(entry_SYSENTER_compat) xorl %r15d, %r15d /* nospec r15 */ cld + IBRS_ENTER + /* * SYSENTER doesn't filter flags, so we need to clear NT and AC * ourselves. To save a few cycles, we can check whether
@@ -253,6 +256,8 @@ GLOBAL(entry_SYSCALL_compat_after_hwframe) */ TRACE_IRQS_OFF + IBRS_ENTER + movq %rsp, %rdi call do_fast_syscall_32 /* XEN PV guests always use IRET path */
@@ -267,6 +272,9 @@ sysret32_from_system_call: */ STACKLEAK_ERASE TRACE_IRQS_ON /* User mode traces as IRQs on. */ + + IBRS_EXIT + movq RBX(%rsp), %rbx /* pt_regs->rbx */ movq RBP(%rsp), %rbp /* pt_regs->rbp */ movq EFLAGS(%rsp), %r11 /* pt_regs->flags (in r11) */
@@ -408,6 +416,7 @@ ENTRY(entry_INT80_compat) * gate turned them off. */ TRACE_IRQS_OFF + IBRS_ENTER movq %rsp, %rdi call do_int80_syscall_32
arch/x86/include/asm/cpu_device_id.h +128 -4
157 lines not on this page · raw message
arch/x86/include/asm/cpufeatures.h +9 -4
@@ -203,8 +203,8 @@#define X86_FEATURE_PROC_FEEDBACK ( 7*32+ 9)/* AMD ProcFeedbackInterface */ #define X86_FEATURE_SME ( 7*32+10)/* AMD Secure Memory Encryption */ #define X86_FEATURE_PTI ( 7*32+11)/* Kernel Page Table Isolation enabled */ -#define X86_FEATURE_RETPOLINE ( 7*32+12)/* "" Generic Retpoline mitigation for Spectre variant 2 */ -#define X86_FEATURE_RETPOLINE_LFENCE ( 7*32+13)/* "" Use LFENCE for Spectre variant 2 */ +#define X86_FEATURE_KERNEL_IBRS ( 7*32+12)/* "" Set/clear IBRS on kernel entry/exit */ +#define X86_FEATURE_RSB_VMEXIT ( 7*32+13)/* "" Fill RSB on VM-Exit */ #define X86_FEATURE_INTEL_PPIN ( 7*32+14)/* Intel Processor Inventory Number */ #define X86_FEATURE_CDP_L2 ( 7*32+15)/* Code and Data Prioritization L2 */ #define X86_FEATURE_MSR_SPEC_CTRL ( 7*32+16)/* "" MSR SPEC_CTRL is implemented */
@@ -286,7 +286,10 @@#define X86_FEATURE_CQM_MBM_LOCAL (11*32+ 3)/* LLC Local MBM monitoring */ #define X86_FEATURE_FENCE_SWAPGS_USER (11*32+ 4)/* "" LFENCE in user entry SWAPGS path */ #define X86_FEATURE_FENCE_SWAPGS_KERNEL (11*32+ 5)/* "" LFENCE in kernel entry SWAPGS path */ -#define X86_FEATURE_RSB_VMEXIT_LITE (11*32+ 6)/* "" Fill RSB on VM exit when EIBRS is enabled */ +#define X86_FEATURE_RRSBA_CTRL (11*32+11)/* "" RET prediction control */ +#define X86_FEATURE_RETPOLINE (11*32+12)/* "" Generic Retpoline mitigation for Spectre variant 2 */ +#define X86_FEATURE_RETPOLINE_LFENCE (11*32+13)/* "" Use LFENCE for Spectre variant 2 */ +#define X86_FEATURE_RSB_VMEXIT_LITE (11*32+17)/* "" Fill RSB on VM exit when EIBRS is enabled */ /* Intel-defined CPU features, CPUID level 0x00000007:1 (EAX), word 12 */ #define X86_FEATURE_AVX512_BF16 (12*32+ 5)/* AVX512 BFLOAT16 instructions */
@@ -303,6 +306,7 @@#define X86_FEATURE_AMD_SSBD (13*32+24)/* "" Speculative Store Bypass Disable */ #define X86_FEATURE_VIRT_SSBD (13*32+25)/* Virtualized Speculative Store Bypass Disable */ #define X86_FEATURE_AMD_SSB_NO (13*32+26)/* "" Speculative Store Bypass is fixed in hardware. */ +#define X86_FEATURE_BTC_NO (13*32+29)/* "" Not vulnerable to Branch Type Confusion */ /* Thermal and Power Management Leaf, CPUID level 0x00000006 (EAX), word 14 */ #define X86_FEATURE_DTHERM (14*32+ 0)/* Digital Thermal Sensor */
@@ -407,7 +411,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_MMIO_UNKNOWN X86_BUG(26)/* CPU is too old and its MMIO Stale Data status is unknown */ +#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(28)/* CPU is too old and its MMIO Stale Data status is unknown */ #endif /* _ASM_X86_CPUFEATURES_H */
arch/x86/include/asm/intel-family.h +6 -0
@@ -35,6 +35,9 @@* The #define line may optionally include a comment including platform names. */ +/* Wildcard match for FAM6 so X86_MATCH_INTEL_FAM6_MODEL(ANY) works */ +#define INTEL_FAM6_ANY X86_MODEL_ANY +#define INTEL_FAM6_CORE_YONAH 0x0E#define INTEL_FAM6_CORE2_MEROM 0x0F
@@ -126,6 +129,9 @@#define INTEL_FAM6_XEON_PHI_KNL 0x57/* Knights Landing */ #define INTEL_FAM6_XEON_PHI_KNM 0x85/* Knights Mill */ +/* Family 5 */ +#define INTEL_FAM5_QUARK_X1000 0x09/* Quark X1000 SoC */ +/* Useful macros */ #define INTEL_CPU_FAM_ANY (_family, _model, _driver_data) \ { \
arch/x86/include/asm/msr-index.h +10 -0
@@ -47,6 +47,8 @@#define SPEC_CTRL_STIBP BIT(SPEC_CTRL_STIBP_SHIFT)/* STIBP mask */ #define SPEC_CTRL_SSBD_SHIFT 2/* Speculative Store Bypass Disable bit */ #define SPEC_CTRL_SSBD BIT(SPEC_CTRL_SSBD_SHIFT)/* Speculative Store Bypass Disable */ +#define SPEC_CTRL_RRSBA_DIS_S_SHIFT 6/* Disable RRSBA behavior */ +#define SPEC_CTRL_RRSBA_DIS_S BIT(SPEC_CTRL_RRSBA_DIS_S_SHIFT)#define MSR_IA32_PRED_CMD 0x00000049/* Prediction Command */ #define PRED_CMD_IBPB BIT(0)/* Indirect Branch Prediction Barrier */
@@ -82,6 +84,7 @@#define MSR_IA32_ARCH_CAPABILITIES 0x0000010a#define ARCH_CAP_RDCL_NO BIT(0)/* Not susceptible to Meltdown */ #define ARCH_CAP_IBRS_ALL BIT(1)/* Enhanced IBRS support */ +#define ARCH_CAP_RSBA BIT(2)/* RET may use alternative branch predictors */ #define ARCH_CAP_SKIP_VMENTRY_L1DFLUSH BIT(3)/* Skip L1D flush on vmentry */ #define ARCH_CAP_SSB_NO BIT(4)/* * Not susceptible to Speculative Store Bypass
@@ -129,6 +132,13 @@* bit available to control VERW * behavior. */ +#define ARCH_CAP_RRSBA BIT(19)/* +* Indicates RET may use predictors +* other than the RSB. With eIBRS +* enabled predictions in kernel mode +* are restricted to targets in +* kernel. +*/ #define ARCH_CAP_PBRSB_NO BIT(24)/* * Not susceptible to Post-Barrier * Return Stack Buffer Predictions.
arch/x86/include/asm/nospec-branch.h +27 -27
116 lines not on this page · raw message
arch/x86/kernel/cpu/amd.c +15 -6
@@ -894,12 +894,21 @@ static void init_amd_zn(struct cpuinfo_x86 *c) node_reclaim_distance =32 ;#endif -/* -* Fix erratum 1076: CPB feature bit not being set in CPUID. -* Always set it, except when running under a hypervisor. -*/ -if (!cpu_has (c,X86_FEATURE_HYPERVISOR ) && !cpu_has (c,X86_FEATURE_CPB )) -set_cpu_cap (c,X86_FEATURE_CPB ); +/* Fix up CPUID bits, but only if not virtualised. */ +if (!cpu_has (c,X86_FEATURE_HYPERVISOR )) { + +/* Erratum 1076: CPB feature bit not being set in CPUID. */ +if (!cpu_has (c,X86_FEATURE_CPB )) +set_cpu_cap (c,X86_FEATURE_CPB ); + +/* +* Zen3 (Fam19 model < 0x10) parts are not susceptible to +* Branch Type Confusion, but predate the allocation of the +* BTC_NO bit. +*/ +if (c->x86 ==0x19 && !cpu_has (c,X86_FEATURE_BTC_NO )) +set_cpu_cap (c,X86_FEATURE_BTC_NO ); + } }static void init_amd (struct cpuinfo_x86 *c)
arch/x86/kernel/cpu/bugs.c +291 -74
600 lines not on this page · raw message
arch/x86/kernel/cpu/common.c +39 -22
93 lines not on this page · raw message
arch/x86/kernel/cpu/match.c +9 -4
@@ -16,12 +16,17 @@* respective wildcard entries. * * A typical table entry would be to match a specific CPU -* { X86_VENDOR_INTEL, 6, 0x12 } -* or to match a specific CPU feature -* { X86_FEATURE_MATCH(X86_FEATURE_FOOBAR) } +* +* X86_MATCH_VENDOR_FAM_MODEL_FEATURE(INTEL, 6, INTEL_FAM6_BROADWELL, +* X86_FEATURE_ANY, NULL); * * Fields can be wildcarded with %X86_VENDOR_ANY, %X86_FAMILY_ANY, -* %X86_MODEL_ANY, %X86_FEATURE_ANY or 0 (except for vendor) +* %X86_MODEL_ANY, %X86_FEATURE_ANY (except for vendor) +* +* asm/cpu_device_id.h contains a set of useful macros which are shortcuts +* for various common selections. The above can be shortened to: +* +* X86_MATCH_INTEL_FAM6_MODEL(BROADWELL, NULL); * * Arrays used to match for this should also be declared using * MODULE_DEVICE_TABLE(x86cpu, ...)
arch/x86/kernel/cpu/scattered.c +1 -0
@@ -26,6 +26,7 @@ struct cpuid_bit {static const struct cpuid_bit cpuid_bits[] = { {X86_FEATURE_APERFMPERF ,CPUID_ECX ,0 ,0x00000006 ,0 }, {X86_FEATURE_EPB ,CPUID_ECX ,3 ,0x00000006 ,0 }, + {X86_FEATURE_RRSBA_CTRL ,CPUID_EDX ,2 ,0x00000007 ,2 }, {X86_FEATURE_CQM_LLC ,CPUID_EDX ,1 ,0x0000000f ,0 }, {X86_FEATURE_CQM_OCCUP_LLC ,CPUID_EDX ,0 ,0x0000000f ,1 }, {X86_FEATURE_CQM_MBM_TOTAL ,CPUID_EDX ,1 ,0x0000000f ,1 },
arch/x86/kernel/process.c +1 -1
@@ -449,7 +449,7 @@ static __always_inline void __speculation_ctrl_update(unsigned long tifp, }if (updmsr) -wrmsrl (MSR_IA32_SPEC_CTRL , msr); +write_spec_ctrl_current (msr, false); }static unsigned long speculation_ctrl_update_tif (struct task_struct *tsk)
arch/x86/kvm/svm.c +1 -0
@@ -47,6 +47,7 @@#include <asm/kvm_para.h> #include <asm/irq_remapping.h> #include <asm/spec-ctrl.h> +#include <asm/cpu_device_id.h> #include <asm/virtext.h> #include "trace.h"
arch/x86/kvm/vmx/nested.c +3 -29
@@ -11,6 +11,7 @@#include "mmu.h" #include "nested.h" #include "trace.h" +#include "vmx.h" #include "x86.h" static bool __read_mostly enable_shadow_vmcs =1 ;
@@ -2863,35 +2864,8 @@ static int nested_vmx_check_vmentry_hw(struct kvm_vcpu *vcpu) vmx->loaded_vmcs->host_state.cr4 = cr4; } - asm( -"sub $%c[wordsize], %%" _ASM_SP"\n\t" /* temporarily adjust RSP for CALL */ -"cmp %%" _ASM_SP", %c[host_state_rsp](%[loaded_vmcs]) \n\t" -"je 1f \n\t" - __ex("vmwrite %%" _ASM_SP ", %[HOST_RSP]") "\n\t" -"mov %%" _ASM_SP", %c[host_state_rsp](%[loaded_vmcs]) \n\t" -"1: \n\t" -"add $%c[wordsize], %%" _ASM_SP"\n\t" /* un-adjust RSP */ - -/* Check if vmlaunch or vmresume is needed */ -"cmpb $0, %c[launched](%[loaded_vmcs])\n\t" - -/* -* VMLAUNCH and VMRESUME clear RFLAGS.{CF,ZF} on VM-Exit, set -* RFLAGS.CF on VM-Fail Invalid and set RFLAGS.ZF on VM-Fail -* Valid. vmx_vmenter() directly "returns" RFLAGS, and so the -* results of VM-Enter is captured via CC_{SET,OUT} to vm_fail. -*/ -"call vmx_vmenter\n\t" - -CC_SET (be) - : ASM_CALL_CONSTRAINT, CC_OUT(be) (vm_fail) - : [HOST_RSP]"r"((unsigned long)HOST_RSP), - [loaded_vmcs]"r"(vmx->loaded_vmcs), - [launched]"i"(offsetof(struct loaded_vmcs, launched)), - [host_state_rsp]"i"(offsetof(struct loaded_vmcs, host_state.rsp)), - [wordsize]"i"(sizeof(ulong)) - : "memory" - ); + vm_fail =__vmx_vcpu_run (vmx, (unsigned long *)&vcpu->arch.regs, +__vmx_vcpu_run_flags (vmx));if (vmx->msr_autoload.host.nr)vmcs_write32 (VM_EXIT_MSR_LOAD_COUNT , vmx->msr_autoload.host.nr);
arch/x86/kvm/vmx/run_flags.h new file +8 -0
@@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __KVM_X86_VMX_RUN_FLAGS_H +#define __KVM_X86_VMX_RUN_FLAGS_H + +#define VMX_RUN_VMRESUME (1 << 0) +#define VMX_RUN_SAVE_SPEC_CTRL (1 << 1) + +#endif /* __KVM_X86_VMX_RUN_FLAGS_H */
arch/x86/kvm/vmx/vmenter.S +75 -86
232 lines not on this page · raw message
arch/x86/kvm/vmx/vmx.c +47 -25
114 lines not on this page · raw message
arch/x86/kvm/vmx/vmx.h +5 -0
@@ -10,6 +10,7 @@#include "capabilities.h" #include "ops.h" #include "vmcs.h" +#include "run_flags.h" extern const u32 vmx_msr_index[];extern u64 host_efer;
@@ -336,6 +337,10 @@ void vmx_set_virtual_apic_mode(struct kvm_vcpu *vcpu);struct shared_msr_entry *find_msr_entry (struct vcpu_vmx *vmx,u32 msr);void pt_update_intercept_for_msr (struct vcpu_vmx *vmx);void vmx_update_host_rsp (struct vcpu_vmx *vmx,unsigned long host_rsp); +void vmx_spec_ctrl_restore_host (struct vcpu_vmx *vmx,unsigned int flags); +unsigned int __vmx_vcpu_run_flags (struct vcpu_vmx *vmx); +bool __vmx_vcpu_run (struct vcpu_vmx *vmx,unsigned long *regs, +unsigned int flags);#define POSTED_INTR_ON 0#define POSTED_INTR_SN 1
arch/x86/kvm/x86.c +2 -2
@@ -10329,9 +10329,9 @@ void kvm_arch_end_assignment(struct kvm *kvm) }EXPORT_SYMBOL_GPL (kvm_arch_end_assignment); -bool kvm_arch_has_assigned_device (struct kvm *kvm) +bool noinstr kvm_arch_has_assigned_device(struct kvm *kvm) { -return atomic_read (&kvm->arch.assigned_device_count); +return arch_atomic_read (&kvm->arch.assigned_device_count); }EXPORT_SYMBOL_GPL (kvm_arch_has_assigned_device);
drivers/base/cpu.c +8 -0
@@ -574,6 +574,12 @@ ssize_t __weak cpu_show_mmio_stale_data(struct device *dev,return sysfs_emit (buf,"Not affected\n" ); } +ssize_t __weak cpu_show_retbleed (struct device *dev, +struct device_attribute *attr,char *buf) +{ +return sysfs_emit (buf,"Not affected\n" ); +} + static DEVICE_ATTR(meltdown, 0444, cpu_show_meltdown, NULL); static DEVICE_ATTR(spectre_v1, 0444, cpu_show_spectre_v1, NULL); static DEVICE_ATTR(spectre_v2, 0444, cpu_show_spectre_v2, NULL);
@@ -584,6 +590,7 @@ static DEVICE_ATTR(tsx_async_abort, 0444, cpu_show_tsx_async_abort, NULL); static DEVICE_ATTR(itlb_multihit, 0444, cpu_show_itlb_multihit, NULL); static DEVICE_ATTR(srbds, 0444, cpu_show_srbds, NULL); static DEVICE_ATTR(mmio_stale_data, 0444, cpu_show_mmio_stale_data, NULL); +static DEVICE_ATTR(retbleed, 0444, cpu_show_retbleed, NULL);static struct attribute *cpu_root_vulnerabilities_attrs[] = { &dev_attr_meltdown.attr,
@@ -596,6 +603,7 @@ static struct attribute *cpu_root_vulnerabilities_attrs[] = { &dev_attr_itlb_multihit.attr, &dev_attr_srbds.attr, &dev_attr_mmio_stale_data.attr, + &dev_attr_retbleed.attr, NULL };
drivers/cpufreq/acpi-cpufreq.c +1 -0
@@ -30,6 +30,7 @@#include <asm/msr.h> #include <asm/processor.h> #include <asm/cpufeature.h> +#include <asm/cpu_device_id.h> MODULE_AUTHOR ("Paul Diefenbaugh, Dominik Brodowski" );MODULE_DESCRIPTION ("ACPI Processor P-States Driver" );
drivers/cpufreq/amd_freq_sensitivity.c +1 -0
@@ -18,6 +18,7 @@#include <asm/msr.h> #include <asm/cpufeature.h> +#include <asm/cpu_device_id.h> #include "cpufreq_ondemand.h"
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +0 -2
@@ -35,7 +35,6 @@#include <linux/pci.h> #include <linux/pm_runtime.h> #include <drm/drm_crtc_helper.h> -#include <drm/drm_damage_helper.h> #include <drm/drm_edid.h> #include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_fb_helper.h>
@@ -496,7 +495,6 @@ bool amdgpu_display_ddc_probe(struct amdgpu_connector *amdgpu_connector,static const struct drm_framebuffer_funcs amdgpu_fb_funcs = { .destroy = drm_gem_fb_destroy, .create_handle = drm_gem_fb_create_handle, - .dirty = drm_atomic_helper_dirtyfb, }; uint32_t amdgpu_display_supported_domains(struct amdgpu_device *adev,
drivers/idle/intel_idle.c +37 -6
108 lines not on this page · raw message
fs/xfs/libxfs/xfs_attr.c +1 -1
@@ -1007,7 +1007,7 @@ xfs_attr_node_addname(* The INCOMPLETE flag means that we will find the "old" * attr, not the "new" one. */ - args->flags |=XFS_ATTR_INCOMPLETE ; + args->op_flags |=XFS_DA_OP_INCOMPLETE ; state =xfs_da_state_alloc (); state->args = args; state->mp = mp;
fs/xfs/libxfs/xfs_attr_leaf.c +2 -2
@@ -2345,8 +2345,8 @@ xfs_attr3_leaf_lookup_int(* If we are looking for INCOMPLETE entries, show only those. * If we are looking for complete entries, show only those. */ -if ((args->flags &XFS_ATTR_INCOMPLETE ) != - (entry->flags &XFS_ATTR_INCOMPLETE )) { +if (!!(args->op_flags &XFS_DA_OP_INCOMPLETE ) != + !!(entry->flags &XFS_ATTR_INCOMPLETE )) {continue ; }if (entry->flags &XFS_ATTR_LOCAL ) {
fs/xfs/libxfs/xfs_attr_leaf.h +20 -6
@@ -17,13 +17,27 @@ struct xfs_inode;struct xfs_trans ;/* -* Used to keep a list of "remote value" extents when unlinking an inode. +* Incore version of the attribute leaf header. */ -typedef struct xfs_attr_inactive_list { -xfs_dablk_t valueblk;/* block number of value bytes */ -int valuelen;/* number of bytes in value */ -}xfs_attr_inactive_list_t ; - +struct xfs_attr3_icleaf_hdr { +uint32_t forw; +uint32_t back; +uint16_t magic; +uint16_t count; +uint16_t usedbytes; +/* +* Firstused is 32-bit here instead of 16-bit like the on-disk variant +* to support maximum fsb size of 64k without overflow issues throughout +* the attr code. Instead, the overflow condition is handled on +* conversion to/from disk. +*/ +uint32_t firstused; +__u8 holes; +struct { +uint16_t base; +uint16_t size; + } freemap[XFS_ATTR_LEAF_MAPSIZE ]; +};/*======================================================================== * Function prototypes for the kernel.
fs/xfs/libxfs/xfs_attr_remote.c +60 -25
126 lines not on this page · raw message
fs/xfs/libxfs/xfs_attr_remote.h +2 -0
@@ -11,5 +11,7 @@ int xfs_attr3_rmt_blocks(struct xfs_mount *mp, int attrlen);int xfs_attr_rmtval_get (struct xfs_da_args *args);int xfs_attr_rmtval_set (struct xfs_da_args *args);int xfs_attr_rmtval_remove (struct xfs_da_args *args); +int xfs_attr_rmtval_stale (struct xfs_inode *ip,struct xfs_bmbt_irec *map, +xfs_buf_flags_t incore_flags);#endif /* __XFS_ATTR_REMOTE_H__ */
fs/xfs/libxfs/xfs_da_btree.h +16 -1
@@ -82,6 +82,7 @@ typedef struct xfs_da_args {#define XFS_DA_OP_OKNOENT 0x0008/* lookup/add op, ENOENT ok, else die */ #define XFS_DA_OP_CILOOKUP 0x0010/* lookup to return CI name if found */ #define XFS_DA_OP_ALLOCVAL 0x0020/* lookup to alloc buffer if found */ +#define XFS_DA_OP_INCOMPLETE 0x0040/* lookup INCOMPLETE attr keys */ #define XFS_DA_OP_FLAGS \ { XFS_DA_OP_JUSTCHECK, "JUSTCHECK" }, \
@@ -89,7 +90,8 @@ typedef struct xfs_da_args { { XFS_DA_OP_ADDNAME, "ADDNAME" }, \ { XFS_DA_OP_OKNOENT, "OKNOENT" }, \ { XFS_DA_OP_CILOOKUP, "CILOOKUP" }, \ - { XFS_DA_OP_ALLOCVAL, "ALLOCVAL" } + { XFS_DA_OP_ALLOCVAL, "ALLOCVAL" }, \ + { XFS_DA_OP_INCOMPLETE, "INCOMPLETE" }/* * Storage for holding state during Btree searches and split/join ops.
@@ -124,6 +126,19 @@ typedef struct xfs_da_state {/* for dirv2 extrablk is data */ } xfs_da_state_t; +/* +* In-core version of the node header to abstract the differences in the v2 and +* v3 disk format of the headers. Callers need to convert to/from disk format as +* appropriate. +*/ +struct xfs_da3_icnode_hdr { +uint32_t forw; +uint32_t back; +uint16_t magic; +uint16_t count; +uint16_t level; +}; +/* * Utility macros to aid in logging changed structure fields. */
fs/xfs/libxfs/xfs_da_format.c +1 -0
@@ -13,6 +13,7 @@#include "xfs_mount.h" #include "xfs_inode.h" #include "xfs_dir2.h" +#include "xfs_dir2_priv.h" /* * Shortform directory ops
fs/xfs/libxfs/xfs_da_format.h +0 -59
89 lines not on this page · raw message
fs/xfs/libxfs/xfs_dir2.h +2 -0
@@ -18,6 +18,8 @@ struct xfs_dir2_sf_entry;struct xfs_dir2_data_hdr ;struct xfs_dir2_data_entry ;struct xfs_dir2_data_unused ; +struct xfs_dir3_icfree_hdr ; +struct xfs_dir3_icleaf_hdr ;extern struct xfs_name xfs_name_dotdot;
fs/xfs/libxfs/xfs_dir2_priv.h +19 -0
@@ -8,6 +8,25 @@struct dir_context ; +/* +* In-core version of the leaf and free block headers to abstract the +* differences in the v2 and v3 disk format of the headers. +*/ +struct xfs_dir3_icleaf_hdr { +uint32_t forw; +uint32_t back; +uint16_t magic; +uint16_t count; +uint16_t stale; +}; + +struct xfs_dir3_icfree_hdr { +uint32_t magic; +uint32_t firstdb; +uint32_t nvalid; +uint32_t nused; +}; +/* xfs_dir2.c */ extern int xfs_dir2_grow_inode (struct xfs_da_args *args,int space,xfs_dir2_db_t *dbp);
fs/xfs/libxfs/xfs_format.h +7 -0
@@ -1540,6 +1540,13 @@ typedef struct xfs_bmdr_block {#define BMBT_BLOCKCOUNT_BITLEN 21#define BMBT_STARTOFF_MASK ((1ULL << BMBT_STARTOFF_BITLEN) - 1) +#define BMBT_BLOCKCOUNT_MASK ((1ULL << BMBT_BLOCKCOUNT_BITLEN) - 1) + +/* +* bmbt records have a file offset (block) field that is 54 bits wide, so this +* is the largest xfs_fileoff_t that we ever expect to see. +*/ +#define XFS_MAX_FILEOFF (BMBT_STARTOFF_MASK + BMBT_BLOCKCOUNT_MASK) typedef struct xfs_bmbt_rec { __be64 l0, l1;
fs/xfs/xfs_attr_inactive.c +41 -105
196 lines not on this page · raw message
fs/xfs/xfs_file.c +6 -1
@@ -187,7 +187,12 @@ xfs_file_dio_aio_read(file_accessed (iocb->ki_filp); -xfs_ilock (ip,XFS_IOLOCK_SHARED ); +if (iocb->ki_flags &IOCB_NOWAIT ) { +if (!xfs_ilock_nowait (ip,XFS_IOLOCK_SHARED )) +return -EAGAIN ; + }else { +xfs_ilock (ip,XFS_IOLOCK_SHARED ); + } ret =iomap_dio_rw (iocb, to, &xfs_iomap_ops,NULL );xfs_iunlock (ip,XFS_IOLOCK_SHARED );
fs/xfs/xfs_inode.c +12 -13
@@ -1513,10 +1513,8 @@ xfs_itruncate_extents_flags(struct xfs_mount *mp = ip->i_mount;struct xfs_trans *tp = *tpp;xfs_fileoff_t first_unmap_block; -xfs_fileoff_t last_block;xfs_filblks_t unmap_len;int error =0 ; -int done =0 ;ASSERT (xfs_isilocked (ip,XFS_ILOCK_EXCL )); ASSERT(!atomic_read(&VFS_I(ip)->i_count) ||
@@ -1536,21 +1534,22 @@ xfs_itruncate_extents_flags(* the end of the file (in a crash where the space is allocated * but the inode size is not yet updated), simply remove any * blocks which show up between the new EOF and the maximum -* possible file size. If the first block to be removed is -* beyond the maximum file size (ie it is the same as last_block), -* then there is nothing to do. +* possible file size. +* +* We have to free all the blocks to the bmbt maximum offset, even if +* the page cache can't scale that far. */ first_unmap_block =XFS_B_TO_FSB (mp, (xfs_ufsize_t )new_size); - last_block =XFS_B_TO_FSB (mp, mp->m_super->s_maxbytes); -if (first_unmap_block == last_block) +if (first_unmap_block >=XFS_MAX_FILEOFF ) { +WARN_ON_ONCE (first_unmap_block >XFS_MAX_FILEOFF );return 0 ; + } -ASSERT (first_unmap_block < last_block); - unmap_len = last_block - first_unmap_block +1 ; -while (!done) { + unmap_len =XFS_MAX_FILEOFF - first_unmap_block +1 ; +while (unmap_len >0 ) {ASSERT (tp->t_firstblock ==NULLFSBLOCK ); - error =xfs_bunmapi (tp, ip, first_unmap_block, unmap_len, flags, -XFS_ITRUNC_MAX_EXTENTS , &done); + error =__xfs_bunmapi (tp, ip, first_unmap_block, &unmap_len, + flags,XFS_ITRUNC_MAX_EXTENTS );if (error) goto out;
@@ -1570,7 +1569,7 @@ xfs_itruncate_extents_flags(if (whichfork ==XFS_DATA_FORK ) {/* Remove all pending CoW reservations. */ error =xfs_reflink_cancel_cow_blocks (ip, &tp, - first_unmap_block, last_block, true); + first_unmap_block,XFS_MAX_FILEOFF , true);if (error) goto out;
fs/xfs/xfs_reflink.c +2 -1
@@ -1544,7 +1544,8 @@ xfs_reflink_clear_inode_flag(* We didn't find any shared blocks so turn off the reflink flag. * First, get rid of any leftover CoW mappings. */ - error =xfs_reflink_cancel_cow_blocks (ip, tpp,0 ,NULLFILEOFF , true); + error =xfs_reflink_cancel_cow_blocks (ip, tpp,0 ,XFS_MAX_FILEOFF , + true);if (error)return error;
fs/xfs/xfs_super.c +21 -27
66 lines not on this page · raw message
include/linux/cpu.h +2 -0
@@ -68,6 +68,8 @@ extern ssize_t cpu_show_srbds(struct device *dev, struct device_attribute *attr,extern ssize_t cpu_show_mmio_stale_data (struct device *dev,struct device_attribute *attr,char *buf); +extern ssize_t cpu_show_retbleed (struct device *dev, +struct device_attribute *attr,char *buf); extern __printf(4, 5) struct device *cpu_device_create(struct device *parent, void *drvdata,
include/linux/kvm_host.h +1 -1
@@ -955,7 +955,7 @@ static inline void kvm_arch_end_assignment(struct kvm *kvm) { } -static inline bool kvm_arch_has_assigned_device (struct kvm *kvm) +static __always_inline bool kvm_arch_has_assigned_device(struct kvm *kvm) {return false; }
include/linux/mod_devicetable.h +1 -3
@@ -672,9 +672,7 @@ struct x86_cpu_id {__u16 steppings; }; -#define X86_FEATURE_MATCH (x) \ - { X86_VENDOR_ANY, X86_FAMILY_ANY, X86_MODEL_ANY, x } - +/* Wild cards for x86_cpu_id::vendor, family, model and feature */ #define X86_VENDOR_ANY 0xffff#define X86_FAMILY_ANY 0#define X86_MODEL_ANY 0
scripts/Makefile.extrawarn +1 -0
@@ -50,6 +50,7 @@ KBUILD_CFLAGS += -Wno-sign-compare KBUILD_CFLAGS += -Wno-format-zero-length KBUILD_CFLAGS += $(call cc-disable-warning, pointer-to-enum-cast) KBUILD_CFLAGS += $(call cc-disable-warning, unaligned-access) +KBUILD_CFLAGS += $(call cc-disable-warning, cast-function-type-strict) endif endif
tools/arch/x86/include/asm/cpufeatures.h +1 -1
@@ -284,7 +284,7 @@#define X86_FEATURE_CQM_MBM_LOCAL (11*32+ 3)/* LLC Local MBM monitoring */ #define X86_FEATURE_FENCE_SWAPGS_USER (11*32+ 4)/* "" LFENCE in user entry SWAPGS path */ #define X86_FEATURE_FENCE_SWAPGS_KERNEL (11*32+ 5)/* "" LFENCE in kernel entry SWAPGS path */ -#define X86_FEATURE_RSB_VMEXIT_LITE (11*32+ 6)/* "" Fill RSB on VM-Exit when EIBRS is enabled */ +#define X86_FEATURE_RSB_VMEXIT_LITE (11*32+17)/* "" Fill RSB on VM-Exit when EIBRS is enabled */ /* Intel-defined CPU features, CPUID level 0x00000007:1 (EAX), word 12 */ #define X86_FEATURE_AVX512_BF16 (12*32+ 5)/* AVX512 BFLOAT16 instructions */