arm-trusted-firmware/include/lib
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
..
bl_aux_params Factor out cross-BL API into export headers suitable for 3rd party code 2019-07-23 20:25:34 -07:00
cpus Merge "Add Matterhorn CPU lib" into integration 2020-02-21 17:51:10 +00:00
el3_runtime coverity: fix MISRA violations 2020-02-18 10:47:46 -06:00
extensions Refactor ARMv8.3 Pointer Authentication support code 2019-09-13 14:11:59 +01:00
fconf fconf: Add mbedtls shared heap as property 2020-02-07 13:51:32 +00:00
libc libc: Fix SIZE_MAX on AArch32 2019-12-16 15:24:50 +01:00
libfdt Replace __ASSEMBLY__ with compiler-builtin __ASSEMBLER__ 2019-08-01 13:14:12 -07:00
pmf Simplify PMF helper macro definitions across header files 2020-01-08 18:00:34 -06:00
psci Unify type of "cpu_idx" across PSCI module. 2020-01-10 17:11:51 +00:00
xlat_tables Read-only xlat tables for BL31 memory 2020-02-24 16:52:56 +00:00
zlib Standardise header guards across codebase 2018-11-08 10:20:19 +00:00
bakery_lock.h Replace __ASSEMBLY__ with compiler-builtin __ASSEMBLER__ 2019-08-01 13:14:12 -07:00
cassert.h Standardise header guards across codebase 2018-11-08 10:20:19 +00:00
coreboot.h Standardise header guards across codebase 2018-11-08 10:20:19 +00:00
debugfs.h debugfs: add SMC channel 2019-12-18 09:59:12 +01:00
mmio.h Standardise header guards across codebase 2018-11-08 10:20:19 +00:00
object_pool.h Sanitise includes across codebase 2019-01-04 10:43:17 +00:00
optee_utils.h Sanitise includes across codebase 2019-01-04 10:43:17 +00:00
runtime_instr.h Replace __ASSEMBLY__ with compiler-builtin __ASSEMBLER__ 2019-08-01 13:14:12 -07:00
semihosting.h qemu: Implement qemu_system_off via semihosting. 2020-01-23 10:53:45 +00:00
smccc.h smccc: add get smc function id num macro 2020-01-09 12:14:14 +01:00
spinlock.h Replace __ASSEMBLY__ with compiler-builtin __ASSEMBLER__ 2019-08-01 13:14:12 -07:00
utils.h arm: gicv3: Fix compiler dependent behavior 2019-12-10 15:53:44 -06:00
utils_def.h include: move MHZ_TICKS_PER_SEC to utils_def.h 2020-02-20 09:25:45 -08:00