Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp743057imm; Thu, 13 Sep 2018 07:07:33 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZA8Z3woZ2BhsEFPEtZdT0IEgvluAIizpzlr0VwHHiodxTDwPkhrYjRjwTQoB4absHjwEUK X-Received: by 2002:a62:7f0c:: with SMTP id a12-v6mr7569627pfd.257.1536847653041; Thu, 13 Sep 2018 07:07:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536847653; cv=none; d=google.com; s=arc-20160816; b=yOaIT0aOWp+kVQw7CaMmDbR1F2FBNF36ig7JRlXMv/dMXCpZIZEUyinD1dbzdanb9k 5zIByA1WnNUsBSDM5zXhQ5YmEv69U86CaE3SUWuh+8LcVrX/T/qRqOnZnL1raKJ0s753 BhoGQnquZzzyrIi1p0cKC33RnQ4XNHtD0fEL9Ou/rlQx2FuUI7HIFUPeiBNDV8nhHxxS iMNBw3jzriZ7k8qNMqdhA9lb0LEp6g541GElAHQ7I1CBi50JX9nzp7E9Abui2slExx1H N+LeSBn7Ha2NNkam9GZhY603LipDOzbqoKEGT1hs2qL60ZoOZBbSXxFS6gtOCC9oH4A7 V1AQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=uOfg+l5lhbt/X+bm5ZENav5OI4aY/1qNvdTuxw1ShWU=; b=F1+dvRS5Uqcf+cIXFPiUpCJaGJ1hyNZSwsv1DOBX6kP09WTcGOSYBYDiD1Rqq9WC7/ fBi+msSYl7LS4q7ikq+Y+suQHDR6eGT3OdlVC/hUYBzqKbSnt/w4pMYtK5nx+FrZA2qA jJY/xeUr+eoluz5whQAK2jFWYrP5HaArom81AgJcHhM9DvrKMHe2hRUySfrCxxJTn2b3 kq+oeZO3zcYcJ3NFOhFSnWybrQB+eUe4N5+wo0WeFRidj/FHzLuOGSdpYEVrIjqDVNdf md0ghq9dx2vZy3q1BqDwVQ4qAEYhLLX5O5gcwyGgYsDH3Db0Vf2NWVQyqQg6iwwI1P2A PRdQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z19-v6si4324950pgi.388.2018.09.13.07.07.17; Thu, 13 Sep 2018 07:07:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732270AbeIMTQt (ORCPT + 99 others); Thu, 13 Sep 2018 15:16:49 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:35694 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729096AbeIMTQs (ORCPT ); Thu, 13 Sep 2018 15:16:48 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id DFF49D3A; Thu, 13 Sep 2018 14:07:08 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juergen Gross , Jan Beulich , Boris Ostrovsky Subject: [PATCH 4.18 192/197] x86/xen: dont write ptes directly in 32-bit PV guests Date: Thu, 13 Sep 2018 15:32:21 +0200 Message-Id: <20180913131849.239171518@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180913131841.568116777@linuxfoundation.org> References: <20180913131841.568116777@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Juergen Gross commit f7c90c2aa4004808dff777ba6ae2c7294dd06851 upstream. In some cases 32-bit PAE PV guests still write PTEs directly instead of using hypercalls. This is especially bad when clearing a PTE as this is done via 32-bit writes which will produce intermediate L1TF attackable PTEs. Change the code to use hypercalls instead. Signed-off-by: Juergen Gross Reviewed-by: Jan Beulich Signed-off-by: Boris Ostrovsky Signed-off-by: Greg Kroah-Hartman --- arch/x86/xen/mmu_pv.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) --- a/arch/x86/xen/mmu_pv.c +++ b/arch/x86/xen/mmu_pv.c @@ -434,14 +434,13 @@ static void xen_set_pud(pud_t *ptr, pud_ static void xen_set_pte_atomic(pte_t *ptep, pte_t pte) { trace_xen_mmu_set_pte_atomic(ptep, pte); - set_64bit((u64 *)ptep, native_pte_val(pte)); + __xen_set_pte(ptep, pte); } static void xen_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { trace_xen_mmu_pte_clear(mm, addr, ptep); - if (!xen_batched_set_pte(ptep, native_make_pte(0))) - native_pte_clear(mm, addr, ptep); + __xen_set_pte(ptep, native_make_pte(0)); } static void xen_pmd_clear(pmd_t *pmdp) @@ -1571,7 +1570,7 @@ static void __init xen_set_pte_init(pte_ pte = __pte_ma(((pte_val_ma(*ptep) & _PAGE_RW) | ~_PAGE_RW) & pte_val_ma(pte)); #endif - native_set_pte(ptep, pte); + __xen_set_pte(ptep, pte); } /* Early in boot, while setting up the initial pagetable, assume