~ubuntu-kernel/ubuntu/+source/linux/+git/mantic:master-prep

Last commit made on 2024-04-30
Get this branch:
git clone -b master-prep https://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/mantic
Members of Ubuntu Kernel Repositories can upload to this branch. Log in for directions.

Branch merges

Branch information

Recent commits

bc21d71... by Yuxuan Luo

UBUNTU: [Config] Set CONFIG_BHI to enabled (auto)

Adjusting the config to have BHI mitigations enabled (for now we do use
the auto mode, this differs from upstream).

CVE-2024-2201
Signed-off-by: Yuxuan Luo <email address hidden>
Acked-by: Roxana Nicolescu <email address hidden>
Acked-by: Stefan Bader <email address hidden>
Signed-off-by: Stefan Bader <email address hidden>

3590479... by Daniel Sneddon <email address hidden>

KVM: x86: Add BHI_NO

commit ed2e8d49b54d677f3123668a21a57822d679651f upstream.

Intel processors that aren't vulnerable to BHI will set
MSR_IA32_ARCH_CAPABILITIES[BHI_NO] = 1;. Guests may use this BHI_NO bit to
determine if they need to implement BHI mitigations or not. Allow this bit
to be passed to the guests.

Signed-off-by: Daniel Sneddon <email address hidden>
Signed-off-by: Pawan Gupta <email address hidden>
Signed-off-by: Daniel Sneddon <email address hidden>
Signed-off-by: Thomas Gleixner <email address hidden>
Reviewed-by: Alexandre Chartre <email address hidden>
Reviewed-by: Josh Poimboeuf <email address hidden>
Signed-off-by: Daniel Sneddon <email address hidden>
Signed-off-by: Greg Kroah-Hartman <email address hidden>

CVE-2024-2201
(backported from commit 1c42ff893a8fb802dd90ca06af928826fdf0d16b linux-6.6.y)
[smb: Context adjustments in arch/x86/kvm/x86.c]
Signed-off-by: Stefan Bader <email address hidden>
Acked-by: Roxana Nicolescu <email address hidden>
Signed-off-by: Stefan Bader <email address hidden>

aeb6d79... by Pawan Gupta <email address hidden>

x86/bhi: Mitigate KVM by default

commit 95a6ccbdc7199a14b71ad8901cb788ba7fb5167b upstream.

BHI mitigation mode spectre_bhi=auto does not deploy the software
mitigation by default. In a cloud environment, it is a likely scenario
where userspace is trusted but the guests are not trusted. Deploying
system wide mitigation in such cases is not desirable.

Update the auto mode to unconditionally mitigate against malicious
guests. Deploy the software sequence at VMexit in auto mode also, when
hardware mitigation is not available. Unlike the force =on mode,
software sequence is not deployed at syscalls in auto mode.

Suggested-by: Alexandre Chartre <email address hidden>
Signed-off-by: Pawan Gupta <email address hidden>
Signed-off-by: Daniel Sneddon <email address hidden>
Signed-off-by: Thomas Gleixner <email address hidden>
Reviewed-by: Alexandre Chartre <email address hidden>
Reviewed-by: Josh Poimboeuf <email address hidden>
Signed-off-by: Daniel Sneddon <email address hidden>
Signed-off-by: Greg Kroah-Hartman <email address hidden>

CVE-2024-2201
(backported from commit 1c42ff893a8fb802dd90ca06af928826fdf0d16b linux-6.6.y)
[smb: context in cpufeatures.h]
Signed-off-by: Stefan Bader <email address hidden>
Acked-by: Roxana Nicolescu <email address hidden>
Signed-off-by: Stefan Bader <email address hidden>

2735a27... by Pawan Gupta <email address hidden>

x86/bhi: Add BHI mitigation knob

commit ec9404e40e8f36421a2b66ecb76dc2209fe7f3ef upstream.

Branch history clearing software sequences and hardware control
BHI_DIS_S were defined to mitigate Branch History Injection (BHI).

Add cmdline spectre_bhi={on|off|auto} to control BHI mitigation:

 auto - Deploy the hardware mitigation BHI_DIS_S, if available.
 on - Deploy the hardware mitigation BHI_DIS_S, if available,
        otherwise deploy the software sequence at syscall entry and
 VMexit.
 off - Turn off BHI mitigation.

The default is auto mode which does not deploy the software sequence
mitigation. This is because of the hardening done in the syscall
dispatch path, which is the likely target of BHI.

Signed-off-by: Pawan Gupta <email address hidden>
Signed-off-by: Daniel Sneddon <email address hidden>
Signed-off-by: Thomas Gleixner <email address hidden>
Reviewed-by: Alexandre Chartre <email address hidden>
Reviewed-by: Josh Poimboeuf <email address hidden>
Signed-off-by: Daniel Sneddon <email address hidden>
Signed-off-by: Greg Kroah-Hartman <email address hidden>

CVE-2024-2201
(backported from commit d414b401f9539858574a19af4ffc0fc0d53bfb8f linux-6.6.y)
[smb: context in cpufeatures.h]
Signed-off-by: Stefan Bader <email address hidden>
Acked-by: Roxana Nicolescu <email address hidden>
Signed-off-by: Stefan Bader <email address hidden>

c238e99... by Pawan Gupta <email address hidden>

x86/bhi: Enumerate Branch History Injection (BHI) bug

commit be482ff9500999f56093738f9219bbabc729d163 upstream.

Mitigation for BHI is selected based on the bug enumeration. Add bits
needed to enumerate BHI bug.

Signed-off-by: Pawan Gupta <email address hidden>
Signed-off-by: Daniel Sneddon <email address hidden>
Signed-off-by: Thomas Gleixner <email address hidden>
Reviewed-by: Alexandre Chartre <email address hidden>
Reviewed-by: Josh Poimboeuf <email address hidden>
Signed-off-by: Daniel Sneddon <email address hidden>
Signed-off-by: Greg Kroah-Hartman <email address hidden>

CVE-2024-2201
(backported from commit 118794d0a572c7a8514dc774e68b59d41857b81c linux-6.6.y)
[smb: context in cpufeatures.h]
Signed-off-by: Stefan Bader <email address hidden>
Acked-by: Roxana Nicolescu <email address hidden>
Signed-off-by: Stefan Bader <email address hidden>

4a29d3a... by Daniel Sneddon <email address hidden>

x86/bhi: Define SPEC_CTRL_BHI_DIS_S

commit 0f4a837615ff925ba62648d280a861adf1582df7 upstream.

Newer processors supports a hardware control BHI_DIS_S to mitigate
Branch History Injection (BHI). Setting BHI_DIS_S protects the kernel
from userspace BHI attacks without having to manually overwrite the
branch history.

Define MSR_SPEC_CTRL bit BHI_DIS_S and its enumeration CPUID.BHI_CTRL.
Mitigation is enabled later.

Signed-off-by: Daniel Sneddon <email address hidden>
Signed-off-by: Pawan Gupta <email address hidden>
Signed-off-by: Daniel Sneddon <email address hidden>
Signed-off-by: Thomas Gleixner <email address hidden>
Reviewed-by: Alexandre Chartre <email address hidden>
Reviewed-by: Josh Poimboeuf <email address hidden>
Signed-off-by: Daniel Sneddon <email address hidden>
Signed-off-by: Greg Kroah-Hartman <email address hidden>

CVE-2024-2201
(backported from commit c6e3d590d0514612d96c572cba66ae0cb4b505a2 linux-6.6.y)
[smb: context in cpufeatures.h, reverse_cpuid.h implementation taken
      from merge commit]
Signed-off-by: Stefan Bader <email address hidden>
Acked-by: Roxana Nicolescu <email address hidden>
Signed-off-by: Stefan Bader <email address hidden>

cd6dfd3... by Pawan Gupta <email address hidden>

x86/bhi: Add support for clearing branch history at syscall entry

commit 7390db8aea0d64e9deb28b8e1ce716f5020c7ee5 upstream.

Branch History Injection (BHI) attacks may allow a malicious application to
influence indirect branch prediction in kernel by poisoning the branch
history. eIBRS isolates indirect branch targets in ring0. The BHB can
still influence the choice of indirect branch predictor entry, and although
branch predictor entries are isolated between modes when eIBRS is enabled,
the BHB itself is not isolated between modes.

Alder Lake and new processors supports a hardware control BHI_DIS_S to
mitigate BHI. For older processors Intel has released a software sequence
to clear the branch history on parts that don't support BHI_DIS_S. Add
support to execute the software sequence at syscall entry and VMexit to
overwrite the branch history.

For now, branch history is not cleared at interrupt entry, as malicious
applications are not believed to have sufficient control over the
registers, since previous register state is cleared at interrupt
entry. Researchers continue to poke at this area and it may become
necessary to clear at interrupt entry as well in the future.

This mitigation is only defined here. It is enabled later.

Signed-off-by: Pawan Gupta <email address hidden>
Co-developed-by: Daniel Sneddon <email address hidden>
Signed-off-by: Daniel Sneddon <email address hidden>
Signed-off-by: Thomas Gleixner <email address hidden>
Reviewed-by: Alexandre Chartre <email address hidden>
Reviewed-by: Josh Poimboeuf <email address hidden>
Signed-off-by: Daniel Sneddon <email address hidden>
Signed-off-by: Greg Kroah-Hartman <email address hidden>

CVE-2024-2201
(backported from commit eb36b0dce2138581bc6b5e39d0273cb4c96ded81 linux-6.6.y)
[smb: context adjustments in syscall.h]
Signed-off-by: Stefan Bader <email address hidden>
Acked-by: Roxana Nicolescu <email address hidden>
Signed-off-by: Stefan Bader <email address hidden>

d4fc929... by Linus Torvalds <email address hidden>

x86/syscall: Don't force use of indirect calls for system calls

commit 1e3ad78334a69b36e107232e337f9d693dcc9df2 upstream.

Make <asm/syscall.h> build a switch statement instead, and the compiler can
either decide to generate an indirect jump, or - more likely these days due
to mitigations - just a series of conditional branches.

Yes, the conditional branches also have branch prediction, but the branch
prediction is much more controlled, in that it just causes speculatively
running the wrong system call (harmless), rather than speculatively running
possibly wrong random less controlled code gadgets.

This doesn't mitigate other indirect calls, but the system call indirection
is the first and most easily triggered case.

Signed-off-by: Linus Torvalds <email address hidden>
Signed-off-by: Daniel Sneddon <email address hidden>
Signed-off-by: Thomas Gleixner <email address hidden>
Reviewed-by: Josh Poimboeuf <email address hidden>
Signed-off-by: Daniel Sneddon <email address hidden>
Signed-off-by: Greg Kroah-Hartman <email address hidden>

CVE-2024-2201
(cherry picked from commit eb0f175b34287f886019b86ac2f410df331d2c34 linux-6.6.y)
Signed-off-by: Stefan Bader <email address hidden>
Acked-by: Roxana Nicolescu <email address hidden>
Signed-off-by: Stefan Bader <email address hidden>

7b4f21f... by Josh Poimboeuf <email address hidden>

x86/bugs: Change commas to semicolons in 'spectre_v2' sysfs file

commit 0cd01ac5dcb1e18eb18df0f0d05b5de76522a437 upstream.

Change the format of the 'spectre_v2' vulnerabilities sysfs file
slightly by converting the commas to semicolons, so that mitigations for
future variants can be grouped together and separated by commas.

Signed-off-by: Josh Poimboeuf <email address hidden>
Signed-off-by: Daniel Sneddon <email address hidden>
Signed-off-by: Thomas Gleixner <email address hidden>
Signed-off-by: Daniel Sneddon <email address hidden>
Signed-off-by: Greg Kroah-Hartman <email address hidden>

CVE-2024-2201
(cherry picked from commit 108feca9e47df1bed26ac7b04306587d9ebccda3 linux-6.6.y)
Signed-off-by: Stefan Bader <email address hidden>
Acked-by: Roxana Nicolescu <email address hidden>
Signed-off-by: Stefan Bader <email address hidden>

c6db4d6... by Stefan Bader

Revert "minmax: add umin(a, b) and umax(a, b)"

BugLink: https://bugs.launchpad.net/bugs/2060446

This reverts commit 8d582aac6cd6dfdf58f2905178537a2298518c8c. Patchset
breaks compilation on armhf.

Signed-off-by: Stefan Bader <email address hidden>