summaryrefslogtreecommitdiff
path: root/arch/riscv/include/asm/string.h
diff options
context:
space:
mode:
authorKefeng Wang <wangkefeng.wang@huawei.com>2021-02-25 15:03:03 +0800
committerPalmer Dabbelt <palmerdabbelt@google.com>2021-03-09 18:18:31 -0800
commit9530141455c968938a913d602a236c2a7b0322e1 (patch)
tree6f4da9f0d64521493129809c7e9b7b2787a09b34 /arch/riscv/include/asm/string.h
parentf6e5aedf470bd4522732595a85688052e3cbc03f (diff)
riscv: Add ARCH_HAS_FORTIFY_SOURCE
FORTIFY_SOURCE could detect various overflows at compile and run time. ARCH_HAS_FORTIFY_SOURCE means that the architecture can be built and run with CONFIG_FORTIFY_SOURCE. Select it in RISCV. See more about this feature from commit 6974f0c4555e ("include/linux/string.h: add the option of fortified string.h functions"). Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
Diffstat (limited to 'arch/riscv/include/asm/string.h')
-rw-r--r--arch/riscv/include/asm/string.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/riscv/include/asm/string.h b/arch/riscv/include/asm/string.h
index 5477e7ecb6e1..909049366555 100644
--- a/arch/riscv/include/asm/string.h
+++ b/arch/riscv/include/asm/string.h
@@ -23,5 +23,10 @@ extern asmlinkage void *__memmove(void *, const void *, size_t);
#define memcpy(dst, src, len) __memcpy(dst, src, len)
#define memset(s, c, n) __memset(s, c, n)
#define memmove(dst, src, len) __memmove(dst, src, len)
+
+#ifndef __NO_FORTIFY
+#define __NO_FORTIFY /* FORTIFY_SOURCE uses __builtin_memcpy, etc. */
+#endif
+
#endif
#endif /* _ASM_RISCV_STRING_H */