From nobody Tue Feb 10 08:03:25 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1670840282; cv=none; d=zohomail.com; s=zohoarc; b=aKqZZHm5OLYITkMzoKtGNgmmCvTOBhCzQBc4EIa22fnXN2Cj64JSXe/8G+N61C1OsvWf8YibqGqRjXHZhZRJs/bUW5c3ORTBeMb2AYJHX4msP6QtvPXhvrcO5fCV+wl0f3s4DuABxpmzG+yV/Abra62ico4WsYgAssOQzPrv69A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1670840282; h=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=ZGTi1zThIp+VUQ8tJlSSisRwmVvWp4XI48eN8oXi4Tw=; b=W71iOEz6BYAvr2wNAYZ+oqJ6q8efEAt1naWYqmrTn6eSajII5z2PZpUBqzlarkp9NQuql9VFg3z3sYsRNNR2EQLXRg3hpbB5TcoCaSqf8wfWhyW9j2rPX8Yk3kr//rU6XpYGt5JGVKdxa1GJual2pZBM/ZgYQr7grtJK57UPTfo= 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1670840282878618.529857861581; Mon, 12 Dec 2022 02:18:02 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.459398.717152 (Exim 4.92) (envelope-from ) id 1p4fsS-00070w-JV; Mon, 12 Dec 2022 10:17:40 +0000 Received: by outflank-mailman (output) from mailman id 459398.717152; Mon, 12 Dec 2022 10:17:40 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1p4fsS-0006y9-4k; Mon, 12 Dec 2022 10:17:40 +0000 Received: by outflank-mailman (input) for mailman id 459398; Mon, 12 Dec 2022 10:17:37 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1p4fsP-0006gD-SB for xen-devel@lists.xenproject.org; Mon, 12 Dec 2022 10:17:37 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1p4fsP-0002CR-HH; Mon, 12 Dec 2022 10:17:37 +0000 Received: from 54-240-197-224.amazon.com ([54.240.197.224] helo=dev-dsk-jgrall-1b-035652ec.eu-west-1.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1p4fXG-0001lz-DC; Mon, 12 Dec 2022 09:55:46 +0000 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" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=ZGTi1zThIp+VUQ8tJlSSisRwmVvWp4XI48eN8oXi4Tw=; b=rjswrnAAF5OgLzMbILYUIK2t3H b1pKNrtbdntqdjM7uEKICfQjeEr9PPRKa6JP3QKoNBBVrEFbBJvsh71haoQ0sBSZgvHnCsuZNQ/2Z kjY7UKti19XwLs0ypiGUqn0OOTduUfDhNbJR5V2u+FJpAWpN029f7ol/A+ckVsXv7TYE=; From: Julien Grall To: xen-devel@lists.xenproject.org Cc: michal.orzel@amd.com, Luca.Fancellu@arm.com, Julien Grall , Stefano Stabellini , Julien Grall , Bertrand Marquis , Volodymyr Babchuk Subject: [PATCH v3 17/18] xen/arm: linker: The identitymap check should cover the whole .text.header Date: Mon, 12 Dec 2022 09:55:22 +0000 Message-Id: <20221212095523.52683-18-julien@xen.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221212095523.52683-1-julien@xen.org> References: <20221212095523.52683-1-julien@xen.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @xen.org) X-ZM-MESSAGEID: 1670840284687100002 Content-Type: text/plain; charset="utf-8" From: Julien Grall At the moment, we are only checking that only some part of .text.header is part of the identity mapping. However, this doesn't take into account the litteral pool which will be located at the end of the section. While we could try to avoid using a literal pool, in the near future we will also want to use an identity mapping for switch_ttbr(). Not everything in .text.header requires to be part of the identity mapping. But it is below a page size (i.e. 4KB) so take a shortcut and check that .text.header is smaller than a page size. With that _end_boot can be removed as it is now unused. Take the pportunity to avoid assuming that a page size is always 4KB in the error message and comment. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- Changes in v3: - Patch added --- xen/arch/arm/arm32/head.S | 2 -- xen/arch/arm/arm64/head.S | 2 -- xen/arch/arm/xen.lds.S | 10 +++++++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S index 2658625bc775..e47f90f15b3d 100644 --- a/xen/arch/arm/arm32/head.S +++ b/xen/arch/arm/arm32/head.S @@ -730,8 +730,6 @@ fail: PRINT("- Boot failed -\r\n") b 1b ENDPROC(fail) =20 -GLOBAL(_end_boot) - /* * Switch TTBR * r1:r0 ttbr diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S index 23c2c7491db2..663f5813b12e 100644 --- a/xen/arch/arm/arm64/head.S +++ b/xen/arch/arm/arm64/head.S @@ -812,8 +812,6 @@ fail: PRINT("- Boot failed -\r\n") b 1b ENDPROC(fail) =20 -GLOBAL(_end_boot) - /* * Switch TTBR * diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S index ae8c3b4c6c5f..3f7ebd19f3ed 100644 --- a/xen/arch/arm/xen.lds.S +++ b/xen/arch/arm/xen.lds.S @@ -32,7 +32,9 @@ SECTIONS _start =3D .; .text : { _stext =3D .; /* Text section */ + _idmap_start =3D .; *(.text.header) + _idmap_end =3D .; =20 *(.text.cold) *(.text.unlikely .text.*_unlikely .text.unlikely.*) @@ -225,10 +227,12 @@ SECTIONS } =20 /* - * We require that Xen is loaded at a 4K boundary, so this ensures that any - * code running on the boot time identity map cannot cross a section bound= ary. + * We require that Xen is loaded at a page boundary, so this ensures that = any + * code running on the identity map cannot cross a section boundary. */ -ASSERT( _end_boot - start <=3D PAGE_SIZE, "Boot code is larger than 4K") +ASSERT(IS_ALIGNED(_idmap_start, PAGE_SIZE), "_idmap_start should be page-a= ligned") +ASSERT(_idmap_end - _idmap_start <=3D PAGE_SIZE, "Identity mapped code is = larger than a page size") + /* * __init_[begin|end] MUST be at word size boundary otherwise we cannot * write fault instructions in the space properly. --=20 2.38.1