Add support for GCC stack protection
Introduce new build option ENABLE_STACK_PROTECTOR. It enables
compilation of all BL images with one of the GCC -fstack-protector-*
options.

A new platform function plat_get_stack_protector_canary() is introduced.
It returns a value that is used to initialize the canary for stack
corruption detection. Returning a random value will prevent an attacker
from predicting the value and greatly increase the effectiveness of the
protection.

A message is printed at the ERROR level when a stack corruption is
detected.

To be effective, the global data must be stored at an address
lower than the base of the stacks. Failure to do so would allow an
attacker to overwrite the canary as part of an attack which would void
the protection.

FVP implementation of plat_get_stack_protector_canary is weak as
there is no real source of entropy on the FVP. It therefore relies on a
timer's value, which could be predictable.

Change-Id: Icaaee96392733b721fa7c86a81d03660d3c1bc06
Signed-off-by: Douglas Raillard <douglas.raillard@arm.com>
1 parent e422f99 commit 51faada71a219a8b94cd8d8e423f0f22e9da4d8f
@Douglas Raillard Douglas Raillard authored on 24 Feb 2017
dp-arm committed on 31 Mar 2017
Showing 23 changed files
View
Makefile
View
bl1/bl1.ld.S
View
bl2/aarch32/bl2_entrypoint.S
View
bl2/aarch64/bl2_entrypoint.S
View
bl2/bl2.ld.S
View
bl2u/aarch64/bl2u_entrypoint.S
View
bl2u/bl2u.ld.S
View
bl31/bl31.ld.S
View
bl32/tsp/aarch64/tsp_entrypoint.S
View
docs/porting-guide.md
View
docs/user-guide.md
View
include/common/aarch32/el3_common_macros.S
View
include/common/aarch64/el3_common_macros.S
View
include/common/debug.h
View
include/plat/common/platform.h
View
lib/stack_protector/aarch32/asm_stack_protector.S 0 → 100644
View
lib/stack_protector/aarch64/asm_stack_protector.S 0 → 100644
View
lib/stack_protector/stack_protector.c 0 → 100644
View
lib/stack_protector/stack_protector.mk 0 → 100644
View
make_helpers/defaults.mk
View
plat/arm/board/fvp/fvp_stack_protector.c 0 → 100644
View
plat/arm/board/fvp/platform.mk
View
plat/mediatek/mt6795/bl31.ld.S