From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9758CC7EE23 for ; Mon, 12 Jun 2023 05:09:43 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.546820.853861 (Exim 4.92) (envelope-from ) id 1q8Znp-0006H1-5D; Mon, 12 Jun 2023 05:09:17 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 546820.853861; Mon, 12 Jun 2023 05:09:17 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1q8Znp-0006Gu-2G; Mon, 12 Jun 2023 05:09:17 +0000 Received: by outflank-mailman (input) for mailman id 546820; Mon, 12 Jun 2023 05:09:16 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1q8Zno-0006Go-0y for xen-devel@lists.xenproject.org; Mon, 12 Jun 2023 05:09:16 +0000 Received: from mail-ua1-x931.google.com (mail-ua1-x931.google.com [2607:f8b0:4864:20::931]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 457373b9-08df-11ee-b232-6b7b168915f2; Mon, 12 Jun 2023 07:09:14 +0200 (CEST) Received: by mail-ua1-x931.google.com with SMTP id a1e0cc1a2514c-784205f0058so1371329241.1 for ; Sun, 11 Jun 2023 22:09:13 -0700 (PDT) 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: 457373b9-08df-11ee-b232-6b7b168915f2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686546552; x=1689138552; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=0x3KhOr+yc6kG50ecMt1zrzXqM3qDJzmbWg6PazmtvE=; b=NebBeLAFc7NKiGSo2OLiaezIPD9sAV1TkdfjNpfpp33a2Q7XViST56PjddsU4v6IM7 VyRg9JrtRwoEflZefIiI/z9D0xR53ZQnf0k6a5JK3QMvBy9L2ivuVGT/6quI7dHGWQ7l /YcskSZTdmi5XJo4yawWAWx9NQB1jjrwssgLPGlcu3LB8MwCetsa4GiI6ZiSOj1cIFcs VizgS3qJzMqKDME397JagWRlAFVQ1LHbxPZq+zAaUWU0s1L/D2DI3FXU0SEV3Xq+WDxD 2BF+oh3J4baiAXaBELwnCdfVopMEA/UYUJ4sULRS3PaHJBJpmoMT04qyUIfovY5cJmFR YDRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686546552; x=1689138552; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0x3KhOr+yc6kG50ecMt1zrzXqM3qDJzmbWg6PazmtvE=; b=ICwu/tXxuVgbU/pvKjfqfje6j1E5CX0DIbtxMznEz7JgVR8SN8T6jMYV4GB1LITxVF tRrWhhDEBDi2h+WYQc+0dCvuKW5tEGtGrlfb26oKWHIN5IC8rY0BDJ+ynRCH18UpwOzK 8Wxs8nATDDIH84oNdU2xBObDFfD9g/rKzbzm6RxS4xxEqXtD3VcJqJb4eAyI32hZU3Yf gK3ISfK36YpaLRhdn7JGARbjBo3hIKoOT2zYRoba04LMoNzKYJjXh+3pGS7B7BQ8b9M0 m0PVQPRozwbdbdU/nnMXaUxFJNovjE6FeYaQScy+Wl38Tq281PA+J6ep9TSPPn80Dmh7 aT6A== X-Gm-Message-State: AC+VfDz/QXBnQ0q/Kp4/ZAJBoa/8f6QhIRR2EixsKbMjhPAYDPXRg3S9 C4uEbni6Y5cx6l9sp6ZUIuL8Lh5D531bBujT64M= X-Google-Smtp-Source: ACHHUZ7V/jQjOwSBe0/meTvxkKQ0HiiB8xEEM+06KoPVK8/oLbQtTeLOBH/IsdGBuXeI2dpZEmVoQCCiFLkB2ggrM68= X-Received: by 2002:a05:6102:ca:b0:43d:54e9:35fb with SMTP id u10-20020a05610200ca00b0043d54e935fbmr2999738vsp.14.1686546552581; Sun, 11 Jun 2023 22:09:12 -0700 (PDT) MIME-Version: 1.0 References: <4ad639bed6b8aa6cee34288a7ce154db21d761b5.1686080337.git.oleksii.kurochko@gmail.com> In-Reply-To: <4ad639bed6b8aa6cee34288a7ce154db21d761b5.1686080337.git.oleksii.kurochko@gmail.com> From: Alistair Francis Date: Mon, 12 Jun 2023 15:08:46 +1000 Message-ID: Subject: Re: [PATCH v1 1/8] xen/riscv: make sure that identity mapping isn't bigger then page size To: Oleksii Kurochko Cc: xen-devel@lists.xenproject.org, Jan Beulich , Andrew Cooper , Bob Eshleman , Alistair Francis , Connor Davis Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Jun 7, 2023 at 5:55=E2=80=AFAM Oleksii Kurochko wrote: > > Signed-off-by: Oleksii Kurochko Acked-by: Alistair Francis Alistair > --- > xen/arch/riscv/xen.lds.S | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/xen/arch/riscv/xen.lds.S b/xen/arch/riscv/xen.lds.S > index 878130f313..74afbaab9b 100644 > --- a/xen/arch/riscv/xen.lds.S > +++ b/xen/arch/riscv/xen.lds.S > @@ -20,6 +20,7 @@ SECTIONS > . =3D XEN_VIRT_START; > _start =3D .; > .text : { > + _idmap_start =3D .; > _stext =3D .; /* Text section */ > *(.text.header) > > @@ -35,6 +36,7 @@ SECTIONS > *(.gnu.warning) > . =3D ALIGN(POINTER_ALIGN); > _etext =3D .; /* End of text section */ > + _idmap_end =3D .; > } :text > > . =3D ALIGN(PAGE_SIZE); > @@ -174,3 +176,10 @@ ASSERT(!SIZEOF(.got), ".got non-empty") > ASSERT(!SIZEOF(.got.plt), ".got.plt non-empty") > > ASSERT(_end - _start <=3D MB(2), "Xen too large for early-boot assumptio= ns") > + > +/* > + * We require that Xen is loaded at a page boundary, so this ensures tha= t any > + * code running on the identity map cannot cross a page boundary. > + */ > +ASSERT(IS_ALIGNED(_idmap_start, PAGE_SIZE), "_idmap_start should be page= -aligned") > +ASSERT(_idmap_end - _idmap_start <=3D PAGE_SIZE, "Identity mapped code i= s larger than a page size") > -- > 2.40.1 > >