From nobody Thu Mar 28 20:39:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1562147101; cv=none; d=zoho.com; s=zohoarc; b=FgU9v7um7ETViKRx6VMIp7j7NoAiZPxkNKWbYcFM4QZPXbdFhihpGmwgFsuQ1cJhFql65uHwbiz6jrrsiQy5K2iIAHZemXu6uIAn/eJRvs4tKOxwnLOzQKdpc5IdeXqy05tffzYjzLBcWLg4QZ+xorutIFCuZHmUXXoFMOO6bEQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1562147101; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=J8dR0XpcNJrmBpMCcbndh3MU011J8a46rDpnTNnXwYU=; b=habg7up5Yn65cxIy77mHXme9rOW6McEt2+d2gUTcOeix6LDSYMyjO0l3MNQnqzoU4f93K9vi7wUgTYMP3GwgPtlzQGOGR1BasRDsB5G+f9ixdpWr67AHkYRJPWSQIZYl/uFYNUqH5ORgAMuOsU83PD7YttLImhdQzhtC1NmVhm4= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1562147101005803.593136965564; Wed, 3 Jul 2019 02:45:01 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hibnm-0002qZ-NZ; Wed, 03 Jul 2019 09:43:46 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hibnl-0002qT-I3 for xen-devel@lists.xenproject.org; Wed, 03 Jul 2019 09:43:45 +0000 Received: from esa3.hc3370-68.iphmx.com (unknown [216.71.145.155]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 0bd12d4f-9d77-11e9-8980-bc764e045a96; Wed, 03 Jul 2019 09:43:44 +0000 (UTC) X-Inumbo-ID: 0bd12d4f-9d77-11e9-8980-bc764e045a96 Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=roger.pau@citrix.com; spf=Pass smtp.mailfrom=roger.pau@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa3.hc3370-68.iphmx.com: no sender authenticity information available from domain of roger.pau@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="roger.pau@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa3.hc3370-68.iphmx.com: domain of roger.pau@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="roger.pau@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ~all" Received-SPF: None (esa3.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: dfxBY5OlyMg3r00Z3HrHB9J8Pj0ij5eERtf4MygBtPdRIxyZvFWbhc5kYlj7fpBXkn9ATs4Son 3MtK7+WwcNIixAHM9+sGunyrRl6jcqv/iPCBMlifnkQwfzx+Wjwz+Y3MWnwIb6YKlGUaNDxVsq EPeFATEwmVbbR5r3Rxa6hHfKUExRMFebKVRgWKesfpVJhoXHSVbW8eabTY0WdgibkjVs2GCfrp nxzKFwP0Y+psdrF6gXxURLz9pWVdxCK6lhXAE9LEVVVBcmt206xixHzoA74P1ybhu11DGIrpUL plQ= X-SBRS: 2.7 X-MesageID: 2547509 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.63,446,1557201600"; d="scan'208";a="2547509" From: Roger Pau Monne To: Date: Wed, 3 Jul 2019 11:43:22 +0200 Message-ID: <20190703094322.1551-1-roger.pau@citrix.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) MIME-Version: 1.0 Subject: [Xen-devel] [PATCH] x86/ept: pass correct level to p2m_entry_modify X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Kevin Tian , Jun Nakajima , Wei Liu , George Dunlap , Andrew Cooper , Jan Beulich , Roger Pau Monne Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" EPT differs from NPT and shadow when translating page orders to levels in the physmap page tables. EPT page tables level for order 0 pages is 0, while NPT and shadow instead use 1, ie: EPT page tables levels starts at 0 while NPT and shadow starts at 1. Fix the p2m_entry_modify call in atomic_write_ept_entry to always add one to the level, in order to match NPT and shadow usage. While there also fix p2m_entry_modify BUG condition to trigger when foreign or ioreq entries with level different than 0 are attempted. That should allow to catch future errors related to the level parameter. Fixes: c7a4c0 ('x86/mm: split p2m ioreq server pages special handling into = helper') Signed-off-by: Roger Pau Monn=C3=A9 --- Cc: Jun Nakajima Cc: Kevin Tian Cc: George Dunlap Cc: Jan Beulich Cc: Andrew Cooper Cc: Wei Liu --- xen/arch/x86/mm/p2m-ept.c | 2 +- xen/include/asm-x86/p2m.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c index e3044bee2e..6b8468c793 100644 --- a/xen/arch/x86/mm/p2m-ept.c +++ b/xen/arch/x86/mm/p2m-ept.c @@ -51,7 +51,7 @@ static int atomic_write_ept_entry(struct p2m_domain *p2m, int level) { int rc =3D p2m_entry_modify(p2m, new.sa_p2mt, entryptr->sa_p2mt, - _mfn(new.mfn), _mfn(entryptr->mfn), level); + _mfn(new.mfn), _mfn(entryptr->mfn), level + = 1); =20 if ( rc ) return rc; diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h index 09ef7e02fd..756929d5c0 100644 --- a/xen/include/asm-x86/p2m.h +++ b/xen/include/asm-x86/p2m.h @@ -946,7 +946,7 @@ static inline int p2m_entry_modify(struct p2m_domain *p= 2m, p2m_type_t nt, p2m_type_t ot, mfn_t nfn, mfn_t ofn, unsigned int level) { - BUG_ON(level > 1 && (nt =3D=3D p2m_ioreq_server || nt =3D=3D p2m_map_f= oreign)); + BUG_ON(level !=3D 1 && (nt =3D=3D p2m_ioreq_server || nt =3D=3D p2m_ma= p_foreign)); =20 if ( level !=3D 1 || (nt =3D=3D ot && mfn_eq(nfn, ofn)) ) return 0; --=20 2.20.1 (Apple Git-117) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel