Signed-off-by: Aster Boese <asterboese@mailbox.org> Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7485>
86 lines
2.3 KiB
Diff
86 lines
2.3 KiB
Diff
From: Fangrui Song <maskray@google.com>
|
|
|
|
mainline inclusion
|
|
from mainline-5.11-rc1
|
|
commit 735e8d93dc2b107f7891a9c2b1c4cfbea1fcbbbc
|
|
category: feature
|
|
feature: ARM KASAN support
|
|
issue: #I3ZXZF
|
|
CVE: NA
|
|
|
|
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i...
|
|
|
|
Modified by Aster Boese <asterboese@mailbox.org>
|
|
Changed to ARM64
|
|
|
|
-------------------------------------------------
|
|
Commit d6d51a96c7d6 ("ARM: 9014/2: Replace string mem* functions for
|
|
KASan") add .weak directives to memcpy/memmove/memset to avoid collision
|
|
with KASAN interceptors.
|
|
|
|
This does not work with LLVM's integrated assembler (the assembly snippet
|
|
`.weak memcpy ... .globl memcpy` produces a STB_GLOBAL memcpy while GNU as
|
|
produces a STB_WEAK memcpy). LLVM 12 (since https://reviews.llvm.org/D90108)
|
|
will error on such an overridden symbol binding.
|
|
|
|
Use the appropriate WEAK macro instead.
|
|
|
|
Link: https://github.com/ClangBuiltLinux/linux/issues/1190
|
|
Reviewed-by: Jing Xiangfeng <jingxiangfeng@huawei.com>
|
|
Signed-off-by: Chen Jun <chenjun102@huawei.com>
|
|
Signed-off-by: Yu Changchun <yuchangchun1@huawei.com>
|
|
|
|
---
|
|
arch/arm64/lib/memcpy.S | 3 +--
|
|
arch/arm64/lib/memmove.S | 3 +--
|
|
arch/arm64/lib/memset.S | 3 +--
|
|
3 files changed, 3 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/arch/arm64/lib/memcpy.S b/arch/arm64/lib/memcpy.S
|
|
index 676139377..dfedd4ab1 100644
|
|
--- a/arch/arm64/lib/memcpy.S
|
|
+++ b/arch/arm64/lib/memcpy.S
|
|
@@ -68,9 +68,8 @@
|
|
stp \ptr, \regB, [\regC], \val
|
|
.endm
|
|
|
|
- .weak memcpy
|
|
ENTRY(__memcpy)
|
|
-ENTRY(memcpy)
|
|
+WEAK(memcpy)
|
|
#include "copy_template.S"
|
|
ret
|
|
ENDPIPROC(memcpy)
|
|
diff --git a/arch/arm64/lib/memmove.S b/arch/arm64/lib/memmove.S
|
|
index f5ac945d2..d2dadccb6 100644
|
|
--- a/arch/arm64/lib/memmove.S
|
|
+++ b/arch/arm64/lib/memmove.S
|
|
@@ -57,9 +57,8 @@ C_h .req x12
|
|
D_l .req x13
|
|
D_h .req x14
|
|
|
|
- .weak memmove
|
|
ENTRY(__memmove)
|
|
-ENTRY(memmove)
|
|
+WEAK(memmove)
|
|
prfm pldl1strm, [src, #L1_CACHE_BYTES]
|
|
cmp dstin, src
|
|
b.lo __memcpy
|
|
diff --git a/arch/arm64/lib/memset.S b/arch/arm64/lib/memset.S
|
|
index f2670a9f2..316263c47 100644
|
|
--- a/arch/arm64/lib/memset.S
|
|
+++ b/arch/arm64/lib/memset.S
|
|
@@ -54,9 +54,8 @@ dst .req x8
|
|
tmp3w .req w9
|
|
tmp3 .req x9
|
|
|
|
- .weak memset
|
|
ENTRY(__memset)
|
|
-ENTRY(memset)
|
|
+WEAK(memset)
|
|
mov dst, dstin /* Preserve return value. */
|
|
and A_lw, val, #255
|
|
orr A_lw, A_lw, A_lw, lsl #8
|
|
--
|
|
2.52.0
|