[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v6 3/5] xen/arm64: mm: Introduce helpers to prepare/enable/disable the identity mapping



Hi Bertrand,

On 03/03/2023 10:35, Bertrand Marquis wrote:
Hi Julien,

On 2 Mar 2023, at 15:59, Julien Grall <julien@xxxxxxx> wrote:

From: Julien Grall <jgrall@xxxxxxxxxx>

In follow-up patches we will need to have part of Xen identity mapped in
order to safely switch the TTBR.

On some platform, the identity mapping may have to start at 0. If we always
keep the identity region mapped, NULL pointer dereference would lead to
access to valid mapping.

It would be possible to relocate Xen to avoid clashing with address 0.
However the identity mapping is only meant to be used in very limited
places. Therefore it would be better to keep the identity region invalid
for most of the time.

Two new external helpers are introduced:
    - arch_setup_page_tables() will setup the page-tables so it is
      easy to create the mapping afterwards.
    - update_identity_mapping() will create/remove the identity mapping

Signed-off-by: Julien Grall <jgrall@xxxxxxxxxx>

In Arm internal CI this patch (or maybe an other in the serie) made one
of our test crash on qemu-arm64.

Thanks for the report. I managed to reproduce it by tweaking the QEMU command line option I was using:

42sh> qemu/build/qemu-system-aarch64 -machine virt,gic-version=3 -machine virtualization=true -cpu cortex-a57 -smp 4 -m 2048 -serial mon:stdio -serial null -nographic -kernel xen/xen/xen

The problem is in patch #2 because I didn't adjust the address of the vmap/frametable areas. So they effectively are still right in the middle of the reserved region for identity mapping.

I will update patch #2. I am also thinking to add a check in xen_pt_update() to ensure no-one can create a non 1:1 mapping in the reserved area for identity mapping.

Cheers,

--
Julien Grall



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.