mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-05-09 02:51:21 +00:00
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>
This commit is contained in:
parent
e422f991df
commit
51faada71a
23 changed files with 394 additions and 10 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2013-2016, ARM Limited and Contributors. All rights reserved.
|
||||
* Copyright (c) 2013-2017, ARM Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
|
@ -84,6 +84,9 @@
|
|||
void __dead2 do_panic(void);
|
||||
#define panic() do_panic()
|
||||
|
||||
/* Function called when stack protection check code detects a corrupted stack */
|
||||
void __dead2 __stack_chk_fail(void);
|
||||
|
||||
void tf_printf(const char *fmt, ...) __printflike(1, 2);
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue