From nobody Tue May 7 13:44:42 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1638206852; cv=none; d=zohomail.com; s=zohoarc; b=Xiqoz1zrkIFgjgZ5jVz6mgVD5ieyNbMxjXl0sTcENXX3NllE1UhNz2aQFwtWJGn1BHxrzv707JGb1ofvqZi7ulW+zzntuvi3UBnhLd49ZaMXYACQycyic+7yfZ4TUcw9gnHh/43g9v4YuzwyATR8usELpVX8r/tv31/oaarTzbY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638206852; 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; bh=W4bD/KyGFk4DCcnI+f9SgQdSqIQm2h9TCQMKc/MAr5o=; b=ADWf3V5JfLVhfozVTCMS9TLbIJ93j5szOImpcjsXz8hEwp22GrY0kC8UDXbOD2FMykgDYFfLSGVGEoqg92CCASB4ekz+hummvTFb8H8xkRhtOqaSChn7nnDuvTZRRWMfROhA+q/UZweSmxlPytKpQNVNBt5Z2SKRLe1aymEMbrM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1638206852245992.038114399741; Mon, 29 Nov 2021 09:27:32 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.234768.407397 (Exim 4.92) (envelope-from ) id 1mrkQa-0007lg-No; Mon, 29 Nov 2021 17:26:56 +0000 Received: by outflank-mailman (output) from mailman id 234768.407397; Mon, 29 Nov 2021 17:26:56 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mrkQa-0007lZ-Ka; Mon, 29 Nov 2021 17:26:56 +0000 Received: by outflank-mailman (input) for mailman id 234768; Mon, 29 Nov 2021 17:26:54 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mrkQY-0007lT-PW for xen-devel@lists.xenproject.org; Mon, 29 Nov 2021 17:26:54 +0000 Received: from esa2.hc3370-68.iphmx.com (esa2.hc3370-68.iphmx.com [216.71.145.153]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 8a2f172d-5139-11ec-b941-1df2895da90e; Mon, 29 Nov 2021 18:26:53 +0100 (CET) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 8a2f172d-5139-11ec-b941-1df2895da90e DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1638206813; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=LgAYVrwXcCN/hnjAXyshxLDQR7k9TL7p2qGhfipP85g=; b=Q9SwNu0ooymp/g1gOjBD7MmRAZriRTO2+U5zHfYKvWS/8+L0l/noOcun EJsDy5jTAtpw2oPo23e9peauGTv80iU2wSP+1LQuxXTqxhgGQi/G2iJxV quiHfLk6oaXePNTrw5GozU9Aa45xwZzYD8SM9+gKONJyihsJHPJU60G0w M=; Authentication-Results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: 3QRIQvlYtTUExbzD1+z4kiqWHSoV6QWH5xmBEwX7QRinsdFpmin7jnxCshdZjljJWCD9sNGlcl I379AEVFTjICj7Z49lwKnd4/yy0lQlVin/69HXO3ghAI4sYxYenYjVQWry55HndkJFEKHAzG+K HrAZ3I+d4tML74qbCpxxs6oso61L6Ec7WXZMCjjvIYmbNH1kJYSJur8MOR3riuhgBFeNPafHX7 VsohNGBwVYj3q/8mw3P7aIKuKaLt/dTCmtVs8RMuzYS3vtBywOz/G7RrZlQu9W7tcTi6oR5doB nNWarnuPWbvMd0Is/tyd5Qk5 X-SBRS: 5.1 X-MesageID: 58830142 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:eL2aNqAnMUYIuRVW/+/kw5YqxClBgxIJ4kV8jS/XYbTApDklgTBRz GYeCjjUOP2MZTf0L4pyYNzipxxX65OBzoc3QQY4rX1jcSlH+JHPbTi7wuYcHM8wwunrFh8PA xA2M4GYRCwMo/u1Si6FatANl1ElvU2zbue6WLGs1hxZH1c+EX5400M7wobVv6Yz6TSHK1LV0 T/Ni5W31G+Ng1aY5UpNtspvADs21BjDkGtwUm4WPJinj3eH/5UhN7oNJLnZEpfNatI88thW5 Qr05OrREmvxp3/BAz4++1rxWhVirrX6ZWBihpfKMkQLb9crSiEai84G2PQghUh/syyDxdR66 fV0j7eCVho5Yq7quOExXEwNe81+FfUuFL7vJHG+tYqYzlHccmuqyPJrZK00FdRGoKAtWzgIr KFGbmBWBvyAr7veLLaTY+9gnMk8auLsO5sSoCpIxjDFF/c2B5vERs0m4PcFjGdr3pkSR54yY eIjdAtKfDXnPCF1K3cpD50ApPiMiCnGJmgwRFW9+vNsvjm7IBZK+KfpGMrYfJqNX8o9tmSyq 3/C/m/5KgoHL9HZwj2Amlq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5PwJE80l6QFgrX5VI3KNGKN1VdARLsSi7cKqAeAJ8SRzIFgPN 9bAspDNOE= X-IronPort-AV: E=Sophos;i="5.87,273,1631592000"; d="scan'208";a="58830142" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu Subject: [PATCH] x86/boot: Drop incorrect mapping at l2_xenmap[0] Date: Mon, 29 Nov 2021 17:26:17 +0000 Message-ID: <20211129172617.12779-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1638206853190100001 It has been 4 years since the default load address changed from 1M to 2M, a= nd _stext ceased residing in l2_xenmap[0]. We should not be inserting an unus= ed mapping. To ensure we don't create/remove mappings accidentally, loop from 0 and obey _PAGE_PRESENT on all entries. Fixes: 7ed93f3a0dff ("x86: change default load address from 1 MiB to 2 MiB") Signed-off-by: Andrew Cooper --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Wei Liu I ought to have spotted this in c/s 52975142d154 ("x86/boot: Create the l2_xenmap[] mappings dynamically") too. --- xen/arch/x86/setup.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index da47cdea14a1..6f241048425c 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1279,16 +1279,12 @@ void __init noreturn __start_xen(unsigned long mbi_= p) =20 /* The only data mappings to be relocated are in the Xen area.= */ pl2e =3D __va(__pa(l2_xenmap)); - /* - * Undo the temporary-hooking of the l1_directmap. __2M_text_= start - * is contained in this PTE. - */ + BUG_ON(using_2M_mapping() && l2_table_offset((unsigned long)_erodata) =3D=3D l2_table_offset((unsigned long)_stext)); - *pl2e++ =3D l2e_from_pfn(xen_phys_start >> PAGE_SHIFT, - PAGE_HYPERVISOR_RX | _PAGE_PSE); - for ( i =3D 1; i < L2_PAGETABLE_ENTRIES; i++, pl2e++ ) + + for ( i =3D 0; i < L2_PAGETABLE_ENTRIES; i++, pl2e++ ) { unsigned int flags; =20 --=20 2.11.0