summaryrefslogtreecommitdiffstats
path: root/arch/arm/cpu/setupc_64.S
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2023-04-15 10:34:47 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2023-04-17 08:44:48 +0200
commitdce999a0260437260d390ef0e23c81573a4bcb8d (patch)
treed195493ecb4469d289f8edf8d6db7b9dff7dd56a /arch/arm/cpu/setupc_64.S
parent02418643b149fca43ac760dc1d91194e209de516 (diff)
downloadbarebox-dce999a0260437260d390ef0e23c81573a4bcb8d.tar.gz
barebox-dce999a0260437260d390ef0e23c81573a4bcb8d.tar.xz
ARM64: setupc: don't invoke KASAN before relocation
Plain memset and memcpy are checked by KASAN if enabled before calling unchecked __memset and __memcpy respectively. KASAN uses a kasan_initialized variable as first condition in its memory check, but that only works after relocation. For that reason, we must take care not to invoke KASAN before then. This was done for ARM32, but was missing for ARM64. Do so now. This fixes an annoying issue where network booting a KASAN-enabled barebox twice in a row would fail: The first happened to work because the memory kasan_initialized was placed at was zero. The second would behave erratically, because BSS initialization would silently fail and barebox static storage would then be initialized with the final values of the previous run. Fixes: 932ef7a02e2f ("ARM: Add KASan support") Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230415083447.3069903-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/cpu/setupc_64.S')
-rw-r--r--arch/arm/cpu/setupc_64.S4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/arm/cpu/setupc_64.S b/arch/arm/cpu/setupc_64.S
index d64281c148..f38f893be9 100644
--- a/arch/arm/cpu/setupc_64.S
+++ b/arch/arm/cpu/setupc_64.S
@@ -14,7 +14,7 @@ ENTRY(setup_c)
mov x1, #0
ldr x2, =__bss_stop
sub x2, x2, x0
- bl memset /* clear bss */
+ bl __memset /* clear bss */
mov x30, x15
ret
ENDPROC(setup_c)
@@ -63,7 +63,7 @@ ENTRY(relocate_to_adr)
sub x19, x19, x1 /* sub address where we are actually running */
add x19, x19, x0 /* add address where we are going to run */
- bl memcpy /* copy binary */
+ bl __memcpy /* copy binary */
bl sync_caches_for_execution