arm-trusted-firmware/plat/arm/board/fvp
Petre-Ionut Tudor 60e8f3cfd5 Read-only xlat tables for BL31 memory
This patch introduces a build flag which allows the xlat tables
to be mapped in a read-only region within BL31 memory. It makes it
much harder for someone who has acquired the ability to write to
arbitrary secure memory addresses to gain control of the
translation tables.

The memory attributes of the descriptors describing the tables
themselves are changed to read-only secure data. This change
happens at the end of BL31 runtime setup. Until this point, the
tables have read-write permissions. This gives a window of
opportunity for changes to be made to the tables with the MMU on
(e.g. reclaiming init code). No changes can be made to the tables
with the MMU turned on from this point onwards. This change is also
enabled for sp_min and tspd.

To make all this possible, the base table was moved to .rodata. The
penalty we pay is that now .rodata must be aligned to the size of
the base table (512B alignment). Still, this is better than putting
the base table with the higher level tables in the xlat_table
section, as that would cost us a full 4KB page.

Changing the tables from read-write to read-only cannot be done with
the MMU on, as the break-before-make sequence would invalidate the
descriptor which resolves the level 3 page table where that very
descriptor is located. This would make the translation required for
writing the changes impossible, generating an MMU fault.

The caches are also flushed.

Signed-off-by: Petre-Ionut Tudor <petre-ionut.tudor@arm.com>
Change-Id: Ibe5de307e6dc94c67d6186139ac3973516430466
2020-02-24 16:52:56 +00:00
..
aarch32 fvp: pwrc: Move to drivers/ folder 2019-01-25 16:04:11 +00:00
aarch64 FVP: Remove GIC initialisation from secondary core cold boot 2019-06-05 17:46:50 +01:00
fdts Merge changes from topic "lm/fconf" into integration 2020-02-11 16:15:45 +00:00
include FVP: Fix BL31 load address and image size for RESET_TO_BL31=1 2020-02-18 10:16:51 +00:00
sp_min fvp: pwrc: Move to drivers/ folder 2019-01-25 16:04:11 +00:00
tsp fvp: pwrc: Move to drivers/ folder 2019-01-25 16:04:11 +00:00
fvp_bl1_setup.c FVP: Add Delay Timer driver to BL1 and BL31 2019-08-16 14:15:59 +01:00
fvp_bl2_el3_setup.c plat/arm: Sanitise includes 2019-01-25 16:04:10 +00:00
fvp_bl2_setup.c Coverity: remove unnecessary header file includes 2020-02-04 10:23:51 -06:00
fvp_bl2u_setup.c FVP: Add Delay Timer driver to BL1 and BL31 2019-08-16 14:15:59 +01:00
fvp_bl31_setup.c FVP: Add Delay Timer driver to BL1 and BL31 2019-08-16 14:15:59 +01:00
fvp_common.c SPMD: add support to run BL32 in TDRAM and BL31 in secure DRAM on Arm FVP 2020-02-10 14:09:21 +00:00
fvp_def.h FVP: Remove re-definition of topology related build options 2020-01-10 14:24:17 +00:00
fvp_err.c Coverity: remove unnecessary header file includes 2020-02-04 10:23:51 -06:00
fvp_io_storage.c arm-io: Panic in case of io setup failure 2020-02-07 13:51:32 +00:00
fvp_pm.c Coverity: remove unnecessary header file includes 2020-02-04 10:23:51 -06:00
fvp_private.h FVP: Add Delay Timer driver to BL1 and BL31 2019-08-16 14:15:59 +01:00
fvp_security.c plat/arm: Sanitise includes 2019-01-25 16:04:10 +00:00
fvp_stack_protector.c Sanitise includes across codebase 2019-01-04 10:43:17 +00:00
fvp_topology.c Fix multithreaded FVP power domain tree 2019-11-15 09:50:06 +00:00
fvp_trusted_boot.c Adds option to read ROTPK from registers for FVP 2020-02-06 16:58:53 +00:00
jmptbl.i fconf: Add dynamic config DTBs info as property 2020-02-07 13:51:32 +00:00
platform.mk Read-only xlat tables for BL31 memory 2020-02-24 16:52:56 +00:00