Skip to content

Commit 854c57f

Browse files
ashkalrabonzini
authored andcommitted
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 <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent d4d3c84 commit 854c57f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/x86/kvm/svm/sev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,8 +642,8 @@ static int __sev_dbg_decrypt(struct kvm *kvm, unsigned long src_paddr,
642642
* Its safe to read more than we are asked, caller should ensure that
643643
* destination has enough space.
644644
*/
645-
src_paddr = round_down(src_paddr, 16);
646645
offset = src_paddr & 15;
646+
src_paddr = round_down(src_paddr, 16);
647647
sz = round_up(sz + offset, 16);
648648

649649
return __sev_issue_dbg_cmd(kvm, src_paddr, dst_paddr, sz, err, false);

0 commit comments

Comments
 (0)