diff options
author | Sean Christopherson <seanjc@google.com> | 2025-09-19 15:32:09 -0700 |
---|---|---|
committer | Sean Christopherson <seanjc@google.com> | 2025-09-23 08:55:18 -0700 |
commit | bd5f500d23170e5bde59ce97da523048b66a8183 (patch) | |
tree | f10fe78679c9a2e8ddd0dd6b74726150c59639de /tools/docs/parse-headers.py | |
parent | e0ff302b79c54567eb6b8f609e76c633978ff06d (diff) |
KVM: SEV: Read save fields from GHCB exactly once
Wrap all reads of GHCB save fields with READ_ONCE() via a KVM-specific
GHCB get() utility to help guard against TOCTOU bugs. Using READ_ONCE()
doesn't completely prevent such bugs, e.g. doesn't prevent KVM from
redoing get() after checking the initial value, but at least addresses
all potential TOCTOU issues in the current KVM code base.
To prevent unintentional use of the generic helpers, take only @svm for
the kvm_ghcb_get_xxx() helpers and retrieve the ghcb instead of explicitly
passing it in.
Opportunistically reduce the indentation of the macro-defined helpers and
clean up the alignment.
Fixes: 4e15a0ddc3ff ("KVM: SEV: snapshot the GHCB before accessing it")
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
Link: https://lore.kernel.org/r/20250919223258.1604852-3-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'tools/docs/parse-headers.py')
0 files changed, 0 insertions, 0 deletions