Skip to content

5.4 backport of recent mds improvement patches

Nikolay Borisov stable 2 versions In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest7 patches 4 repliesIn review
  2. v17 patches 1 replySuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7x86/asm: Add _ASM_RIP() macro for x86-64 (%rip) suffixarch/x86/include/asm/asm.h+5 -13 replies
2/7x86/bugs: Add asm helpers for executing VERWarch/x86/entry/Makefile arch/x86/entry/entry.S arch/x86/include/asm/cpufeatures.h +1 more+39 -20 replies
3/7x86/entry_64: Add VERW just before userspace transitionarch/x86/entry/entry_64.S arch/x86/entry/entry_64_compat.S arch/x86/include/asm/irqflags.h+12 -00 replies
4/7x86/entry_32: Add VERW just before userspace transitionarch/x86/entry/entry_32.S+3 -00 replies
5/7x86/bugs: Use ALTERNATIVE() instead of mds_user_clear static keyDocumentation/x86/mds.rst arch/x86/entry/common.c arch/x86/include/asm/nospec-branch.h +3 more+34 -380 replies
6/7KVM/VMX: Use BT+JNC, i.e. EFLAGS.CF to select VMRESUME vs. VMLAUNCHarch/x86/kvm/vmx/run_flags.h arch/x86/kvm/vmx/vmenter.S+8 -50 replies
7/7KVM/VMX: Move VERW closer to VMentry for MDS mitigationarch/x86/kvm/vmx/vmenter.S arch/x86/kvm/vmx/vmx.c+11 -40 replies

Reviews trailers per patch

2 of 7 patches have a Reviewed-by or Acked-by.

PatchNikolay BorisovSean Christopherson
1/7
2/7
3/7
4/7
5/7
6/7R-b
7/7A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/7] 5.4 backport of recent mds improvement patches

Here's the recently merged mds improvement patches adapted to latest stable tree. I've only compile tested them, but since I have also done similar backports for older kernels I'm sure they should work.
The main difference is in the definition of the CLEAR_CPU_BUFFERS macro since 5.4 doesn't contains the alternative relocation handling logic hence the verw instruction is moved out of the alternative definition and instead we have a jump which skips the verw instruction there. That way the relocation will be handled by the toolchain rather than the kernel.

Since I don't know if I will have time to work on the other branches this patchset can be used as basis for the rest of the stable kernels. The main difference would be which bit is used for CLEAR_CPU_BUFFERS. For kernel 6.6 the 2nd patch can be used verbatim from upstrem (unlike this modified version) since the alternative relocation did land in v6.5. However, even if used as-is from this patchset it's not a problem.

V2:

Added upstream commit id to individual patches.

H. Peter Anvin (Intel) (1):
x86/asm: Add _ASM_RIP() macro for x86-64 (%rip) suffix

Pawan Gupta (5):
x86/bugs: Add asm helpers for executing VERW x86/entry_64: Add VERW just before userspace transition x86/entry_32: Add VERW just before userspace transition x86/bugs: Use ALTERNATIVE() instead of mds_user_clear static key KVM/VMX: Move VERW closer to VMentry for MDS mitigation

Sean Christopherson (1):
KVM/VMX: Use BT+JNC, i.e. EFLAGS.CF to select VMRESUME vs. VMLAUNCH

 Documentation/x86/mds.rst            | 38 ++++++++++++++++++++--------
 arch/x86/entry/Makefile              |  2 +-
 arch/x86/entry/common.c              |  2 --
 arch/x86/entry/entry.S               | 23 +++++++++++++++++
 arch/x86/entry/entry_32.S            |  3 +++
 arch/x86/entry/entry_64.S            | 10 ++++++++
 arch/x86/entry/entry_64_compat.S     |  1 +
 arch/x86/include/asm/asm.h           |  6 ++++-
 arch/x86/include/asm/cpufeatures.h   |  2 +-
 arch/x86/include/asm/irqflags.h      |  1 +
 arch/x86/include/asm/nospec-branch.h | 26 ++++++++++---------
 arch/x86/kernel/cpu/bugs.c           | 15 +++++------
 arch/x86/kernel/nmi.c                |  3 ---
 arch/x86/kvm/vmx/run_flags.h         |  7 +++--
 arch/x86/kvm/vmx/vmenter.S           |  9 ++++---
 arch/x86/kvm/vmx/vmx.c               | 12 ++++++---
 16 files changed, 111 insertions(+), 49 deletions(-)
 create mode 100644 arch/x86/entry/entry.S

--
2.34.1