summaryrefslogtreecommitdiffstats
path: root/arch/x86/coco
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-09-27 08:44:12 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2026-09-27 08:44:12 -0700
commitefb44d93a620c294c049db37c810c8ab7ee1122d (patch)
tree095d326e3948f0fc217652bfb3545702831c8f49 /arch/x86/coco
parent673dab7eac1618b6622bbee9eb2aaa47817631e3 (diff)
parentb8d1d5b63a8ef532038eebd9d97d406860385668 (diff)
downloadlinux-stable-efb44d93a620c294c049db37c810c8ab7ee1122d.tar.gz
linux-stable-efb44d93a620c294c049db37c810c8ab7ee1122d.zip
Merge tag 'x86-urgent-2026-09-27' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fixes from Ingo Molnar: - Fix preemption bugs in the SVSM vTPM guest implementation (Melody Wang) - Fix MCE-triggered hardware debug register corruption on task migration (Masami Hiramatsu) * tag 'x86-urgent-2026-09-27' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/mce: Fix hardware debug register corruption on task migration x86/sev: Make vTPM SVSM calls preemption-safe
Diffstat (limited to 'arch/x86/coco')
-rw-r--r--arch/x86/coco/sev/svsm.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/arch/x86/coco/sev/svsm.c b/arch/x86/coco/sev/svsm.c
index 916d62cd1..2d493d55f 100644
--- a/arch/x86/coco/sev/svsm.c
+++ b/arch/x86/coco/sev/svsm.c
@@ -74,6 +74,14 @@ int svsm_perform_call_protocol(struct svsm_call *call)
flags = native_local_irq_save();
+ /*
+ * 'caa' is a per-CPU variable. To avoid using a stale or incorrect
+ * 'caa' if the task is preempted or migrated to another CPU after it
+ * is fetched, always fetch 'caa' and then issue the SVSM call with
+ * interrupts disabled. This ensures the correct 'caa' is used.
+ */
+ call->caa = svsm_get_caa();
+
ghcb = __sev_get_ghcb(&state);
do {
@@ -321,7 +329,6 @@ int snp_svsm_vtpm_send_command(u8 *buffer)
{
struct svsm_call call = {};
- call.caa = svsm_get_caa();
call.rax = SVSM_VTPM_CALL(SVSM_VTPM_CMD);
call.rcx = __pa(buffer);
@@ -345,7 +352,6 @@ bool snp_svsm_vtpm_probe(void)
if (!snp_vmpl)
return false;
- call.caa = svsm_get_caa();
call.rax = SVSM_VTPM_CALL(SVSM_VTPM_QUERY);
if (svsm_perform_call_protocol(&call))