Bug 2167288 (CVE-2023-0045)

Summary: CVE-2023-0045 kernel: Bypassing Spectre-BTI User Space Mitigations
Product: [Other] Security Response Reporter: Sandipan Roy <saroy>
Component: vulnerabilityAssignee: Nobody <nobody>
Status: NEW --- QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: unspecifiedCC: acaringi, bhu, chwhite, ddepaula, debarbos, dfreiber, dvlasenk, ezulian, fhrbata, hartsjc, hkrzesin, jarod, jburrell, jfaracco, jferlan, jforbes, jlelli, joe.lawrence, jshortt, jstancek, jwyatt, kcarcia, kernel-mgr, kyoshida, lgoncalv, lleshchi, lzampier, nmurray, ptalbert, qzhao, rogbas, rvrbovsk, scweaver, swood, tyberry, vkumar, walters, williams
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
A flaw was found in the Linux kernel. This issue occurs due to a failure mitigating the Spectre-BTI attack (using the kernel API), as IBPB is not issued during the syscall until the next schedule, leaving the system vulnerable.
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2167419, 2167421, 2167418, 2167420    
Bug Blocks: 2167265    

Description Sandipan Roy 2023-02-06 06:25:57 UTC
The Linux kernel does not correctly mitigate SMT attacks, as discovered
through a strange pattern in the kernel API using STIBP as a mitigation[1
<https://docs.kernel.org/userspace-api/spec_ctrl.html>], leaving the
process exposed for a short period of time after a syscall. The kernel also
does not issue an IBPB immediately during the syscall.
The ib_prctl_set [2
<https://elixir.bootlin.com/linux/v5.15.56/source/arch/x86/kernel/cpu/bugs.c#L1467>]function
updates the Thread Information Flags (TIFs) for the task and updates the
SPEC_CTRL MSR on the function __speculation_ctrl_update [3
<https://elixir.bootlin.com/linux/v5.15.56/source/arch/x86/kernel/process.c#L557>],
but the IBPB is only issued on the next schedule, when the TIF bits are
checked. This leaves the victim vulnerable to values already injected on
the BTB, prior to the prctl syscall.
The behavior is only corrected after a reschedule of the task happens.
Furthermore, the kernel entrance (due to the syscall itself), does not
issue an IBPB in the default scenarios (i.e., when the kernel protects
itself via retpoline or eIBRS).