[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170914102043.hzb256hysmw4ypdy@pd.tnic>
Date: Thu, 14 Sep 2017 12:20:43 +0200
From: Borislav Petkov <bp@...e.de>
To: Brijesh Singh <brijesh.singh@....com>
Cc: linux-kernel@...r.kernel.org, x86@...nel.org, kvm@...r.kernel.org,
Thomas Gleixner <tglx@...utronix.de>,
Joerg Roedel <joro@...tes.org>,
"Michael S . Tsirkin" <mst@...hat.com>,
Paolo Bonzini <pbonzini@...hat.com>,
\"Radim Krčmář\" <rkrcmar@...hat.com>,
Tom Lendacky <thomas.lendacky@....com>
Subject: Re: [RFC Part2 PATCH v3 17/26] KVM: SVM: Add support for SEV
LAUNCH_MEASURE command
On Mon, Jul 24, 2017 at 03:02:54PM -0500, Brijesh Singh wrote:
> The command is used to retrieve the measurement of memory encrypted
> through the LAUNCH_UPDATE_DATA command. This measurement can be used
> for attestation purposes.
>
> Signed-off-by: Brijesh Singh <brijesh.singh@....com>
> ---
> arch/x86/kvm/svm.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 52 insertions(+)
>
> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
> index 91b070f..9b672eb 100644
> --- a/arch/x86/kvm/svm.c
> +++ b/arch/x86/kvm/svm.c
> @@ -5957,6 +5957,54 @@ static int sev_launch_update_data(struct kvm *kvm, struct kvm_sev_cmd *argp)
> return ret;
> }
>
> +static int sev_launch_measure(struct kvm *kvm, struct kvm_sev_cmd *argp)
> +{
> + struct sev_data_launch_measure *data = NULL;
> + struct kvm_sev_launch_measure params;
> + void *addr = NULL;
> + int ret;
> +
> + if (!sev_guest(kvm))
> + return -ENOTTY;
> +
> + if (copy_from_user(¶ms, (void *)argp->data,
> + sizeof(struct kvm_sev_launch_measure)))
> + return -EFAULT;
> +
> + data = kzalloc(sizeof(*data), GFP_KERNEL);
> + if (!data)
> + return -ENOMEM;
> +
> + if (params.address && params.length) {
Same notes as before: check userspace data and make data a stack var.
Thx.
--
Regards/Gruss,
Boris.
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)
--
Powered by blists - more mailing lists