sp_min: Implement workaround for CVE-2017-5715
This patch introduces two workarounds for ARMv7 systems.  The
workarounds need to be applied prior to any `branch` instruction in
secure world.  This is achieved using a custom vector table where each
entry is an `add sp, sp, #1` instruction.

On entry to monitor mode, once the sequence of `ADD` instructions is
executed, the branch target buffer (BTB) is invalidated.  The bottom
bits of `SP` are then used to decode the exception entry type.

A side effect of this change is that the exception vectors are
installed before the CPU specific reset function.  This is now
consistent with how it is done on AArch64.

Note, on AArch32 systems, the exception vectors are typically tightly
integrated with the secure payload (e.g. the Trusted OS).  This
workaround will need porting to each secure payload that requires it.

The patch to modify the AArch32 per-cpu vbar to the corresponding
workaround vector table according to the CPU type will be done in a
later patch.

Change-Id: I5786872497d359e496ebe0757e8017fa98f753fa
Signed-off-by: Dimitris Papastamos <dimitris.papastamos@arm.com>
1 parent eec9e7d commit 7343505d9661ab6481e99fa96d60f2a8447a4565
@Dimitris Papastamos Dimitris Papastamos authored on 2 Jan 2018
Showing 7 changed files
View
bl32/sp_min/aarch32/entrypoint.S
View
bl32/sp_min/sp_min.mk
View
bl32/sp_min/workaround_cve_2017_5715_bpiall.S 0 → 100644
View
bl32/sp_min/workaround_cve_2017_5715_icache_inv.S 0 → 100644
View
include/common/aarch32/el3_common_macros.S
View
include/lib/aarch32/arch.h
View
include/lib/aarch32/smcc_helpers.h