Allow enabling SSP for platforms that don't randomize canary

HiSilicon-specific randomization routine for the __stack_chk_guard
should not be called for other platforms that don't implement
this function.
Fix build for targets that don't link with HiSi libraries when
stack smashing protector is enabled.

Signed-off-by: Zbigniew Bodek <zbigniew.bodek@huawei.com>
Change-Id: I1843c897b32991fddc3d0ba362d188c4a621d052
This commit is contained in:
Zbigniew Bodek 2020-10-08 18:31:01 +08:00 committed by Wojciech Zmuda WX948747
parent 4188734ee4
commit 064427fcaf
1 changed files with 3 additions and 0 deletions

View File

@ -157,11 +157,14 @@
@ Description: Stack-Protector Init
__stack_chk_guard_setup:
PUSH {FP, LR}
#if defined(LOSCFG_PLATFORM_HI3516DV300) || defined(LOSCFG_PLATFORM_HI3518EV300)
/* Randomize __stack_chk_quard using platform-specific function. */
BL OsRandomStackGuard
LDR R1, =__stack_chk_guard
MOV R3, R0
ORR R2, R3, #0X80000000
STR R2, [R1]
#endif
POP {FP, PC}
#endif