mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
Introduce a new Kconfig option to block speculation into lock protected critical regions. The Kconfig option is enabled by default, but the mitigation won't be engaged unless it's explicitly enabled in the command line using `spec-ctrl=lock-harden`. Convert the spinlock acquire macros into always-inline functions, and introduce a speculation barrier after the lock has been taken. Note the speculation barrier is not placed inside the implementation of the spin lock functions, as to prevent speculation from falling through the call to the lock functions resulting in the barrier also being skipped. trylock variants are protected using a construct akin to the existing evaluate_nospec(). This patch only implements the speculation barrier for x86. Note spin locks are the only locking primitive taken care in this change, further locking primitives will be adjusted by separate changes. This is part of XSA-453 / CVE-2024-2193 Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Reviewed-by: Jan Beulich <jbeulich@suse.com>