u-boot/arch/arm/cpu
Pierre-Clément Tosi 4b36f01201 arm64: Fix map_range() not splitting mapped blocks
The implementation of map_range() creates the requested mapping by
walking the page tables, iterating over multiple PTEs and/or descending
into existing table mappings as needed. When doing so, it assumes any
pre-existing valid PTE to be a table mapping. This assumption is wrong
if the platform code attempts to successively map two overlapping ranges
where the latter intersects a block mapping created for the former.

As a result, map_range() treats the existing block mapping as a table
mapping and descends into it i.e. starts interpreting the
previously-mapped range as an array of PTEs, writing to them and
potentially even descending further (extra fun with MMIO ranges!).

Instead, pass any valid non-table mapping to split_block(), which
ensures that it actually was a block mapping (calls panic() otherwise)
before splitting it.

Fixes: 41e2787f5e ("arm64: Reduce add_map() complexity")
Signed-off-by: Pierre-Clément Tosi <ptosi@google.com>
Tested-by: Fabio Estevam <festevam@gmail.com>
Tested-by: Hiago De Franco <hiago.franco@toradex.com> # Toradex Verdin AM62
Reviewed-by: Marc Zyngier <maz@kernel.org>
2024-04-10 08:41:00 -06:00
..
arm11 ARM: arm11: Add C wrapper for allow_unaligned() 2023-07-01 17:29:15 +02:00
arm720t Convert CONFIG_SKIP_LOWLEVEL_INIT et al to Kconfig 2021-08-31 17:47:49 -04:00
arm920t imx: Drop unused CONFIG_IMX 2023-02-07 14:33:48 -05:00
arm926ejs mxs: Fix VDDx brownout interrupt disable/enable 2023-12-20 15:00:47 -03:00
arm946es Convert CONFIG_SKIP_LOWLEVEL_INIT et al to Kconfig 2021-08-31 17:47:49 -04:00
arm1136 arm: Remove flea3 board 2021-10-01 12:08:19 -04:00
arm1176 global: Remove unused CONFIG defines 2023-01-20 12:27:06 -05:00
armv7 stv0991: Remove stv0991 board and architecture code 2024-03-13 18:47:11 -04:00
armv7m global: Move remaining CONFIG_SYS_* to CFG_SYS_* 2022-12-05 16:06:08 -05:00
armv8 arm64: Fix map_range() not splitting mapped blocks 2024-04-10 08:41:00 -06:00
Makefile SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
u-boot-spl.lds arm: move image_copy_start/end to linker symbols 2024-03-29 10:39:25 -04:00
u-boot.lds arm: remove redundant section alignments 2024-03-29 10:39:25 -04:00