<div dir="ltr"><div>LGTM</div><div><br></div><div>Acked-by: Andy Whitcroft <<a href="mailto:apw@canonical.com">apw@canonical.com</a>></div><div><br></div><div>-apw<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Apr 16, 2024 at 3:54 PM Stefan Bader <<a href="mailto:stefan.bader@canonical.com">stefan.bader@canonical.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">[Impact]<br>
Native BHI attack, a Spectre v2 variant, allows local unprivileged attackers to<br>
obtain kernel memory information without the help of unprivileged eBPF, negating<br>
to the previous belief that unprivileged eBPF is the only real-world source of<br>
such an attack. Also, this vulnerability affects KVM as well.<br>
<br>
[Backport]<br>
In order to minimize effort with future upstream stable ports I only<br>
used patches from linux-5.15.y which have not yet picked up. This<br>
allowed the BHI set from linux-5.15.y to be applied with just 4 simple<br>
context changes.<br>
<br>
The missing prerequisite commits are:<br>
1. 1d30800c0c0a (“x86/bugs: Use sysfs_emit()”)<br>
  This one solves the conflict in [1/8] 0cd01ac5dcb1 (“x86/bugs: Change commas<br>
  to semicolons in 'spectre_v2' sysfs file”) by substitute sprintf() with<br>
  sysfs_emit()<br>
2. eefe5e668209 (“KVM: x86: Advertise CPUID.(EAX=7,ECX=2):EDX[5:0] to userspace“)<br>
  This commit introduced CPUID_7_2_EDX, a flag used by [4/8] 0f4a837615ff<br>
  (“x86/bhi: Define SPEC_CTRL_BHI_DIS_S“)<br>
3. 047c72299061 (“KVM: x86: Update KVM-only leaf handling to allow for 100% KVM-only leafs”)<br>
  This one introduced kvm_cpu_cap_init_kvm_defined(), solving a build error<br>
  caused by the commit above. No functional change as noted by the commit<br>
  message, safe to backport.<br>
4. 3de7708607e5 ("KVM: x86: Use a switch statement and macros in<br>
                  __feature_translate()")<br>
  This changes __feature_translate in reverse-cpuid.h to use macros and<br>
  by that allows ("x86/bhi: Define SPEC_CTRL_BHI_DIS_S") to be applied<br>
  without changes.<br>
<br>
[Test]<br>
Compiled only.<br>
<br>
[Where things could go wrong]<br>
This patch is more about enabling CPU features and reducing branch history<br>
exposed, therefore, that the system is able to boot and run should denote that<br>
it is not introducing any regression.<br>
<br>
For KVM, the most significant impact is the performance regression due to system<br>
call substitution since branch prediction probably won't perform as fast as the<br>
previous version for users who do not care about the mitigation.<br>
For this reason we are right now only enable this in auto mode which<br>
means only if firmware supports it.<br>
<br>
Borislav Petkov (1):<br>
  x86/bugs: Use sysfs_emit()<br>
<br>
Daniel Sneddon (2):<br>
  x86/bhi: Define SPEC_CTRL_BHI_DIS_S<br>
  KVM: x86: Add BHI_NO<br>
<br>
Jim Mattson (2):<br>
  KVM: x86: Advertise CPUID.(EAX=7,ECX=2):EDX[5:0] to userspace<br>
  KVM: x86: Use a switch statement and macros in __feature_translate()<br>
<br>
Josh Poimboeuf (1):<br>
  x86/bugs: Change commas to semicolons in 'spectre_v2' sysfs file<br>
<br>
Linus Torvalds (1):<br>
  x86/syscall: Don't force use of indirect calls for system calls<br>
<br>
Pawan Gupta (4):<br>
  x86/bhi: Add support for clearing branch history at syscall entry<br>
  x86/bhi: Enumerate Branch History Injection (BHI) bug<br>
  x86/bhi: Add BHI mitigation knob<br>
  x86/bhi: Mitigate KVM by default<br>
<br>
Sean Christopherson (1):<br>
  KVM: x86: Update KVM-only leaf handling to allow for 100% KVM-only<br>
    leafs<br>
<br>
Stefan Bader (1):<br>
  UBUNTU: [Config] Set CONFIG_BHI to enabled (auto)<br>
<br>
 Documentation/admin-guide/hw-vuln/spectre.rst |  51 +++-<br>
 .../admin-guide/kernel-parameters.txt         |  12 +<br>
 arch/x86/Kconfig                              |  25 ++<br>
 arch/x86/entry/common.c                       |   6 +-<br>
 arch/x86/entry/entry_64.S                     |  61 +++++<br>
 arch/x86/entry/entry_64_compat.S              |   3 +<br>
 arch/x86/entry/syscall_32.c                   |  21 +-<br>
 arch/x86/entry/syscall_64.c                   |  19 +-<br>
 arch/x86/entry/syscall_x32.c                  |  10 +-<br>
 arch/x86/include/asm/cpufeatures.h            |  12 +<br>
 arch/x86/include/asm/msr-index.h              |   9 +-<br>
 arch/x86/include/asm/nospec-branch.h          |  17 ++<br>
 arch/x86/include/asm/syscall.h                |  10 +-<br>
 arch/x86/kernel/cpu/bugs.c                    | 218 +++++++++++++-----<br>
 arch/x86/kernel/cpu/common.c                  |  24 +-<br>
 arch/x86/kernel/cpu/scattered.c               |   1 +<br>
 arch/x86/kvm/cpuid.c                          |  29 ++-<br>
 arch/x86/kvm/reverse_cpuid.h                  |  45 +++-<br>
 arch/x86/kvm/vmx/vmenter.S                    |   2 +<br>
 arch/x86/kvm/x86.c                            |   3 +-<br>
 debian.master/config/annotations              |   3 +<br>
 21 files changed, 470 insertions(+), 111 deletions(-)<br>
<br>
-- <br>
2.34.1<br>
<br>
<br>
-- <br>
kernel-team mailing list<br>
<a href="mailto:kernel-team@lists.ubuntu.com" target="_blank">kernel-team@lists.ubuntu.com</a><br>
<a href="https://lists.ubuntu.com/mailman/listinfo/kernel-team" rel="noreferrer" target="_blank">https://lists.ubuntu.com/mailman/listinfo/kernel-team</a><br>
</blockquote></div>