diff options
| author | Ackerley Tng <ackerleytng@google.com> | 2026-05-22 15:46:10 -0700 |
|---|---|---|
| committer | Sean Christopherson <seanjc@google.com> | 2026-05-26 09:56:36 -0700 |
| commit | 97cd21d57e9bd2da79845178d9250cfd19289cd4 (patch) | |
| tree | ff4fb7b88963ceef90ea1c3e31a15a3bb5064269 /arch | |
| parent | 138f5f9cbe374ff87084f1d32181d2a4a2d924e8 (diff) | |
| download | linux-next-history-97cd21d57e9bd2da79845178d9250cfd19289cd4.tar.gz | |
KVM: SEV: Mark source page dirty when writing back CPUID data on failure
When writing back CPUID data (provided by trusted firmware) to the source
page on failure, mark the page/folio as dirty so that the data isn't lost
in the unlikely scenario the page is reclaimed before its read by
userspace.
Fixes: 2a62345b3052 ("KVM: guest_memfd: GUP source pages prior to populating guest memory")
Signed-off-by: Ackerley Tng <ackerleytng@google.com>
Link: https://patch.msgid.link/20260522-fix-sev-gmem-post-populate-v2-5-3f196bfad5a1@google.com
[sean: use set_page_dirty(), massage changelog]
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'arch')
| -rw-r--r-- | arch/x86/kvm/svm/sev.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c index 0e7f8b5cd4cb4..1d513778d88d9 100644 --- a/arch/x86/kvm/svm/sev.c +++ b/arch/x86/kvm/svm/sev.c @@ -2382,6 +2382,7 @@ static int sev_gmem_post_populate(struct kvm *kvm, gfn_t gfn, kvm_pfn_t pfn, void *dst_vaddr = kmap_local_pfn(pfn); memcpy(src_vaddr, dst_vaddr, PAGE_SIZE); + set_page_dirty(src_page); kunmap_local(dst_vaddr); kunmap_local(src_vaddr); |
