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:
parent
4188734ee4
commit
064427fcaf
|
@ -157,11 +157,14 @@
|
||||||
@ Description: Stack-Protector Init
|
@ Description: Stack-Protector Init
|
||||||
__stack_chk_guard_setup:
|
__stack_chk_guard_setup:
|
||||||
PUSH {FP, LR}
|
PUSH {FP, LR}
|
||||||
|
#if defined(LOSCFG_PLATFORM_HI3516DV300) || defined(LOSCFG_PLATFORM_HI3518EV300)
|
||||||
|
/* Randomize __stack_chk_quard using platform-specific function. */
|
||||||
BL OsRandomStackGuard
|
BL OsRandomStackGuard
|
||||||
LDR R1, =__stack_chk_guard
|
LDR R1, =__stack_chk_guard
|
||||||
MOV R3, R0
|
MOV R3, R0
|
||||||
ORR R2, R3, #0X80000000
|
ORR R2, R3, #0X80000000
|
||||||
STR R2, [R1]
|
STR R2, [R1]
|
||||||
|
#endif
|
||||||
POP {FP, PC}
|
POP {FP, PC}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue