summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAshish Kalra <ashish.kalra@amd.com>2020-11-10 22:42:05 +0000
committerPaolo Bonzini <pbonzini@redhat.com>2020-11-16 13:59:09 -0500
commit854c57f02bc718b0653bc467073b4541b8155a36 (patch)
tree9100a41610163adc63a20c20888102b4c0187096
parentd4d3c84d77e3dac68efecebdf488af8f4e156611 (diff)
downloadlinux-854c57f02bc718b0653bc467073b4541b8155a36.tar.bz2
KVM: SVM: Fix offset computation bug in __sev_dbg_decrypt().
Fix offset computation in __sev_dbg_decrypt() to include the source paddr before it is rounded down to be aligned to 16 bytes as required by SEV API. This fixes incorrect guest memory dumps observed when using qemu monitor. Signed-off-by: Ashish Kalra <ashish.kalra@amd.com> Message-Id: <20201110224205.29444-1-Ashish.Kalra@amd.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--arch/x86/kvm/svm/sev.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
index c0b14106258a..566f4d18185b 100644
--- a/arch/x86/kvm/svm/sev.c
+++ b/arch/x86/kvm/svm/sev.c
@@ -642,8 +642,8 @@ static int __sev_dbg_decrypt(struct kvm *kvm, unsigned long src_paddr,
* Its safe to read more than we are asked, caller should ensure that
* destination has enough space.
*/
- src_paddr = round_down(src_paddr, 16);
offset = src_paddr & 15;
+ src_paddr = round_down(src_paddr, 16);
sz = round_up(sz + offset, 16);
return __sev_issue_dbg_cmd(kvm, src_paddr, dst_paddr, sz, err, false);