Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp3983551pxb; Mon, 4 Oct 2021 14:24:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKnc9++7ToBqb1A7R73146F9EgJxT0+Vv0uENWofvUJ2r7VKOwX5EtQGwLGt5oreXRhEbv X-Received: by 2002:a17:90a:16:: with SMTP id 22mr39905916pja.25.1633382670401; Mon, 04 Oct 2021 14:24:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633382670; cv=none; d=google.com; s=arc-20160816; b=uJu9q2vQxSZuceODZ52A/dSOg04q/E5BvzQy9UGpzMB3a1qdo3e5BdZBHpIYzQTkmE f0HgGvVNM/w0XPBxsS4+APul9tmKbYXnNukF5g0uaKrXpE8ov/vm8D5SyN/Z5xbXOBJL xn8OkjRI/bhyoGPD4UU0zM9m03j1rJ26bY29Wgp0S8AdnQGSXvbgLo73ArVMGrC+25fM gyOPTLaDJ+RO7pgfFsOpiQ4e6UXtgjt4AlWoYUl7eubEID6yuP2TMKTY8dMAEyJoIVxD wKxNygbaAhROBR/iJi9pn2EogGBizAICBKu/v0BDCSwQaE0/NeBI/o+Yx9gTmQ5tgWdk anuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=t5oFXzd9NO2Az00QqLJd6tvZzXL1bZFKKlcbzRlLMyU=; b=QRFT/T0QNSId4M1Ox/fSOxIUKosT0/TLF4ucJU1YyojC8qDxElp43Kvp5issg7fNUb FRcoU9IrJZwwlJ9Ds/rapYV7xWe2p4qv8h4xtPikLZx5MErw7HfkyC+tN+TE1eeTfKL2 KaHAglR6j4bmzISTEuhJb2v/3zBLJoiiPxGs1j7or9pKjO1ixyThryd33y8FWgIHOCod YZzq3JHFkydDguQowEeA63cONmH7mc/RfBCX1jKtAXOJH04q/p5galpvbExKbge27/gc 6UZwSD6UXW8YNP4tSvyAuMxmpdKAdEQFo/12fYoJMyMIYbFkufoNyqqzsKFNnd6Efr94 nHTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bp7yNDau; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w1si18256698plk.70.2021.10.04.14.24.17; Mon, 04 Oct 2021 14:24:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bp7yNDau; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237528AbhJDNeG (ORCPT + 99 others); Mon, 4 Oct 2021 09:34:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:47354 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237081AbhJDNbq (ORCPT ); Mon, 4 Oct 2021 09:31:46 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F19966321E; Mon, 4 Oct 2021 13:14:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1633353259; bh=JRoqL4otUIGnStRHpXKpJPWH28/NtpXgHSdIf/lXCvE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bp7yNDauNR59ecg6mAFRRR5TlisLaBeu6MNMzLwSLOGCET9DMWDeaxwjsgsEEbjzf MojANW3lvaP28XYDT28IYUaAm84/lvJ2pdNznqDZW571z4/YfrrOzTt6n0ZkvKoodT 4kPQZ6aGLr1WDsSM/0iQDoMCPgDJYrPhQjEDzdrg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Gonda , Marc Orr , Tom Lendacky , Brijesh Singh , Sean Christopherson , Paolo Bonzini Subject: [PATCH 5.14 056/172] KVM: SEV: Pin guest memory for write for RECEIVE_UPDATE_DATA Date: Mon, 4 Oct 2021 14:51:46 +0200 Message-Id: <20211004125046.804042551@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004125044.945314266@linuxfoundation.org> References: <20211004125044.945314266@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sean Christopherson commit 50c038018d6be20361e8a2890262746a4ac5b11f upstream. Require the target guest page to be writable when pinning memory for RECEIVE_UPDATE_DATA. Per the SEV API, the PSP writes to guest memory: The result is then encrypted with GCTX.VEK and written to the memory pointed to by GUEST_PADDR field. Fixes: 15fb7de1a7f5 ("KVM: SVM: Add KVM_SEV_RECEIVE_UPDATE_DATA command") Cc: stable@vger.kernel.org Cc: Peter Gonda Cc: Marc Orr Cc: Tom Lendacky Cc: Brijesh Singh Signed-off-by: Sean Christopherson Message-Id: <20210914210951.2994260-2-seanjc@google.com> Reviewed-by: Brijesh Singh Reviewed-by: Peter Gonda Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/svm/sev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/x86/kvm/svm/sev.c +++ b/arch/x86/kvm/svm/sev.c @@ -1465,7 +1465,7 @@ static int sev_receive_update_data(struc /* Pin guest memory */ guest_page = sev_pin_memory(kvm, params.guest_uaddr & PAGE_MASK, - PAGE_SIZE, &n, 0); + PAGE_SIZE, &n, 1); if (IS_ERR(guest_page)) { ret = PTR_ERR(guest_page); goto e_free_trans;