KVM: SVM: Fix SEV LAUNCH_SECRET command
PATCH 1/1 KVM: SVM: Fix SEV LAUNCH_SECRET command
The SEV LAUNCH_SECRET command fails with error code 'invalid param' because we missed filling the guest and header system physical address while issuing the command.
Fixes 9f5b5b950aa9 (KVM: SVM: Add support for SEV LAUNCH_SECRET command)
Cc Paolo Bonzini <[email protected]>
Cc "Radim Krčmář" <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Tom Lendacky <[email protected]>
Cc Joerg Roedel <[email protected]>
Signed-off-by Brijesh Singh <[email protected]>
--- arch/x86/kvm/svm.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
arch/x86/kvm/svm.c +7 -3
@@ -6599,7 +6599,7 @@ static int sev_launch_secret(struct kvm *kvm, struct kvm_sev_cmd *argp)struct page **pages;void *blob, *hdr;unsigned long n; -int ret; +int ret, offset;if (!sev_guest (kvm))return -ENOTTY ;
@@ -6625,6 +6625,10 @@ static int sev_launch_secret(struct kvm *kvm, struct kvm_sev_cmd *argp)if (!data) goto e_unpin_memory; + offset = params.guest_uaddr & (PAGE_SIZE -1 ); + data->guest_address =__sme_page_pa (pages[0 ]) + offset; + data->guest_len = params.guest_len; + blob =psp_copy_user_blob (params.trans_uaddr, params.trans_len);if (IS_ERR (blob)) { ret =PTR_ERR (blob);
@@ -6639,8 +6643,8 @@ static int sev_launch_secret(struct kvm *kvm, struct kvm_sev_cmd *argp) ret =PTR_ERR (hdr); goto e_free_blob; } - data->trans_address =__psp_pa (blob); - data->trans_len = params.trans_len; + data->hdr_address =__psp_pa (hdr); + data->hdr_len = params.hdr_len; data->handle = sev->handle; ret =sev_issue_cmd (kvm,SEV_CMD_LAUNCH_UPDATE_SECRET , data, &argp->error);
Signature · 1 line
2.14.3