[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v1 1/8] xen/riscv: make sure that identity mapping isn't bigger then page size
- To: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Mon, 12 Jun 2023 09:09:48 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6mU7HsEVTpwTt8IixyVQQdXCiCVfEdrlqSNY7K+Xmwo=; b=kpiB3O+UNmtuco9j8tlIPjPton1jVeQ3NFBUUprQWUdmq1GDYNJFVDAdx1CUGGDkPzlHDpLCGrF6Uy8tbKSgC0WWDtIrJtoZKc6OvKV5LJfuIEopGuzXvj6z5ffy2xTB3J0D+pPDCK0p7pdE3znmwRMR1AyPc7Pl7PXjednockWNxsVz3DoX4S7SMuQPmHZcHUigUAJ4lGlszKTcz7myCd2HUM9JTxsTatHhapRoruxBpeU9HYbNAHGb+JcxtRPFbhDup0DzZeLv0kbZyVTbIR4rBVgpQq7+500jMWDFcu7WCVIcF2iGVcZCN5xOamKI36/0QH3vcja1JYgDqr6N4g==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TI9F10TwQJEEf7EdaV7uWuTlZo4UK3ea2pcd7SmXVJEwS4joJKccHrtM+DvhJYor+ClygNn9hcR8dQcpsvXChueMAKR9zDGfrGpiUs6/jSDAX9NhK1nqaX10WKUvH4QFOBSk7WNupr7ZtebpNWaIAxL7hArbJEKetIL7/YVWsdwkxL5uyBM0RoH5ojy/+bZiZGdq4HXPM9dx1FwqatotdEb8w59had/isqKQxaXWrHVjG5ulagvf5IPRhCG/JUJOhj3iBYW9EHtVwVf8z2fWrPF27zrxnFSL2RBYipTHa2VLjaE506+sz3qD2p3PWHw/eihBPYcquwkdlbWu8Z2l6A==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
- Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Bob Eshleman <bobbyeshleman@xxxxxxxxx>, Alistair Francis <alistair.francis@xxxxxxx>, Connor Davis <connojdavis@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- Delivery-date: Mon, 12 Jun 2023 07:10:00 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 06.06.2023 21:55, Oleksii Kurochko wrote:
> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
Such commits without description are worrying. This may be okay for
entirely trivial and obvious changes, but that's going to be the
exception.
> --- a/xen/arch/riscv/xen.lds.S
> +++ b/xen/arch/riscv/xen.lds.S
> @@ -20,6 +20,7 @@ SECTIONS
> . = XEN_VIRT_START;
> _start = .;
> .text : {
> + _idmap_start = .;
> _stext = .; /* Text section */
> *(.text.header)
>
> @@ -35,6 +36,7 @@ SECTIONS
> *(.gnu.warning)
> . = ALIGN(POINTER_ALIGN);
> _etext = .; /* End of text section */
> + _idmap_end = .;
> } :text
So this covers all of .text. Why is it expected that .text will be (and
remain) ...
> @@ -174,3 +176,10 @@ ASSERT(!SIZEOF(.got), ".got non-empty")
> ASSERT(!SIZEOF(.got.plt), ".got.plt non-empty")
>
> ASSERT(_end - _start <= MB(2), "Xen too large for early-boot assumptions")
> +
> +/*
> + * We require that Xen is loaded at a page boundary, so this ensures that 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 <= PAGE_SIZE, "Identity mapped code is
> larger than a page size")
... less than 4k in size? And why is only .text of interest, but not
other sections?
I find the other assertion a little puzzling too: Isn't that merely
checking that XEN_VIRT_START is page aligned?
Jan
|