From nobody Mon Feb 9 15:46:10 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1578598428; cv=none; d=zohomail.com; s=zohoarc; b=NDoYX/CxyDKAgZZ9ZuKMTftrLOAlLS77kFEyr4gp1qHTdET1AHTrJhyta3eRnEscWZR1juj2G1EIJJMykuQsxU5KYsi/S4Az68ay8poZjbjEtzlXqx+KtPhkL5nwMXso1GH5oVcQ9eoyZNESQ7TX43ljzd9igLu07oMf+hkwBW8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578598428; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vEbjDE4MLPbEEsVxl4HXxMo+f56cntABlNkDxPwSBJ0=; b=SCVAjsW1if4QYEgPDf/enGX9lZsIG/mVufqVhP+bZpPDbuwrYadqpuUd7EG3mX/YnqWwll60UD1IitFlEn8/TlQGD+OwjUcuMLk3qiQQPgmP7stlBoz+8U1yymFHzH5BXYfY7VBFZgjYxgc1cAp5tm1SHDG144wJq9FlKSMI/8E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1578598428252298.00465784055984; Thu, 9 Jan 2020 11:33:48 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ipdYD-0001uB-Qd; Thu, 09 Jan 2020 19:33:01 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ipdYB-0001ti-Ry for xen-devel@lists.xenproject.org; Thu, 09 Jan 2020 19:32:59 +0000 Received: from esa5.hc3370-68.iphmx.com (unknown [216.71.155.168]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id d049c2e8-3316-11ea-ac27-bc764e2007e4; Thu, 09 Jan 2020 19:32:47 +0000 (UTC) X-Inumbo-ID: d049c2e8-3316-11ea-ac27-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1578598366; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=TUgSJcvrtirnKoh5NZO7xoERz9S6nXrtyBnu1JNNQyo=; b=iX1Pz4q/Fag89XoA1aIp9djJZZZx+/2HkhLS4/kMuCmawf36PR4ZesiK 0WtexTTsYsRcdX665occOdi9HbzidIjYHetjjjkVVW2w8X9Xg2PjjFCOY dqrQi3/xkuQJ5aTj81m/sN66waJ/vhJ9D+V1IiltlIe9biysSsJPdV0YC E=; Authentication-Results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zohomail.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 (esa5.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa5.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa5.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa5.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@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 ip4:168.245.78.127 ~all" Received-SPF: None (esa5.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=esa5.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: 9g+cp44T7LVkWnkx5tocdIhT2jPVosjMB+R3gL3eoKSvuzcZngER5UjV1DeN27ePwq35z2CPp3 95sB/zqzNBZuscktsviwDqGUSXMvbupZjScxTDzcJLKq9Tn50ObDCDaHGXDeXQwzm57oR8RDcR 0GKD2Q16z35nfuZGsS9UTgFvTSHqiy6gDi17CMxugkx/d56/xp6YYVK+bInEI+duoy+PbhGdTC tt8DGektGI4eU3Ufzm84H4k5ns2InnLXsDTBRgUkZoNXVtU5H86X/MIXzDiStZSk1a+FnTRERv aEE= X-SBRS: 2.7 X-MesageID: 11081780 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.69,414,1571716800"; d="scan'208";a="11081780" From: Andrew Cooper To: Xen-devel Date: Thu, 9 Jan 2020 19:32:40 +0000 Message-ID: <20200109193241.14542-4-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200109193241.14542-1-andrew.cooper3@citrix.com> References: <20200109193241.14542-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v2 3/4] x86/boot: Don't map 0 during boot 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: Andrew Cooper , Wei Liu , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) In particular, it causes accidental NULL pointer dereferences to go unnotic= ed. The majority of the early operation takes place either in Real mode, or Protected Unpaged mode. The only bit which requires pagetable mappings is = the trampoline transition into Long mode and jump to the higher mappings, so th= ere is no need for the whole bottom 2M to be mapped. Introduce a new l1_bootmap in .init.data, and use it instead of l1_identmap. The EFI boot path doesn't pass through the trampoline, so doesn't need any adjustment. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 --- xen/arch/x86/boot/head.S | 14 ++++++++------ xen/arch/x86/boot/x86_64.S | 4 ++++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index 0b75d33a25..d246e374f1 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -689,12 +689,14 @@ trampoline_setup: sub $(L2_PAGETABLE_ENTRIES*8),%eax loop 1b =20 - /* - * During boot, hook 4kB mappings of first 2MB of memory into L2. - * This avoids mixing cachability for the legacy VGA region. - */ - lea __PAGE_HYPERVISOR+sym_esi(l1_identmap),%edi - mov %edi,sym_fs(l2_bootmap) + /* Map the permanent trampoline page into l{1,2}_bootmap[]. */ + mov sym_esi(trampoline_phys), %ecx + lea __PAGE_HYPERVISOR_RX(%ecx), %edx /* %edx =3D PTE to write = */ + shr $PAGE_SHIFT, %ecx /* %ecx =3D Slot to write= */ + mov %edx, sym_offs(l1_bootmap)(%esi, %ecx, 8) + + lea __PAGE_HYPERVISOR + sym_esi(l1_bootmap), %edx + mov %edx, sym_esi(l2_bootmap) =20 /* Apply relocations to bootstrap trampoline. */ mov sym_fs(trampoline_phys),%edx diff --git a/xen/arch/x86/boot/x86_64.S b/xen/arch/x86/boot/x86_64.S index de555f87f4..af62850589 100644 --- a/xen/arch/x86/boot/x86_64.S +++ b/xen/arch/x86/boot/x86_64.S @@ -155,6 +155,10 @@ GLOBAL(__page_tables_end) .section .init.data, "aw", @progbits .align PAGE_SIZE, 0 =20 +l1_bootmap: + .fill L1_PAGETABLE_ENTRIES, 8, 0 + .size l1_bootmap, . - l1_bootmap + GLOBAL(l2_bootmap) .fill 4 * L2_PAGETABLE_ENTRIES, 8, 0 .size l2_bootmap, . - l2_bootmap --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel