[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
On Wed, Jun 7, 2023 at 5:55 AM Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx> wrote: > > Signed-off-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx> Acked-by: Alistair Francis <alistair.francis@xxxxxxx> 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 > . = 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 > > . = ALIGN(PAGE_SIZE); > @@ -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") > -- > 2.40.1 > >
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |