From 064427fcafe8e00607041c8797b415bc70ff9bb6 Mon Sep 17 00:00:00 2001 From: Zbigniew Bodek Date: Thu, 8 Oct 2020 18:31:01 +0800 Subject: [PATCH] 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 Change-Id: I1843c897b32991fddc3d0ba362d188c4a621d052 --- arch/arm/arm/src/los_hw_exc.S | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/arm/src/los_hw_exc.S b/arch/arm/arm/src/los_hw_exc.S index 9a51b2a5..1dc3cf52 100644 --- a/arch/arm/arm/src/los_hw_exc.S +++ b/arch/arm/arm/src/los_hw_exc.S @@ -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