]> git.ipfire.org Git - thirdparty/linux.git/commit
KVM: SEV: Use READ_ONCE() when reading entries/indices from PSC buffer
authorSean Christopherson <seanjc@google.com>
Fri, 1 May 2026 20:22:35 +0000 (13:22 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 29 May 2026 18:25:29 +0000 (20:25 +0200)
commitc8cc238093ca6c99267032f6cfe78f59389f3157
treeae7749e898b104245f073e2c16b4f7272fb04839
parent121d88de56bc5c0ba0ce2f6381af67f948a7e7c1
KVM: SEV: Use READ_ONCE() when reading entries/indices from PSC buffer

Use READ_ONCE() when reading entries/indices from the guest-accessible
Page State Change buffer to defend against TOCTOU bugs.

Don't bother with READ_ONCE()/WRITE_ONCE() for cases where KVM is writing
(and not consuming the result!), as the guest isn't supposed to touch the
buffer while it's being processed.  I.e. using READ_ONCE() is all about
protecting against misbehaving guests.

Fixes: 9b54e248d264 ("KVM: SEV: Add support to handle Page State Change VMGEXIT")
Cc: stable@vger.kernel.org
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-ID: <20260501202250.2115252-11-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/svm/sev.c