riscv: Add ARCH_HAS_FORTIFY_SOURCE
PATCH 1/1 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").
--- arch/riscv/Kconfig | 1 + arch/riscv/include/asm/string.h | 5 +++++ 2 files changed, 6 insertions(+)
arch/riscv/Kconfig +1 -0
@@ -20,6 +20,7 @@ config RISCV select ARCH_HAS_DEBUG_VM_PGTABLE select ARCH_HAS_DEBUG_VIRTUAL if MMU select ARCH_HAS_DEBUG_WX + select ARCH_HAS_FORTIFY_SOURCE select ARCH_HAS_GCOV_PROFILE_ALL select ARCH_HAS_GIGANTIC_PAGE select ARCH_HAS_KCOV
arch/riscv/include/asm/string.h +5 -0
@@ -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 */
Signature · 7 lines
2.17.1 _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv
Palmer Dabbelt
maintainerQuoted 30 lines · On Wed, 24 Feb 2021 23:03:03 PST (-0800), [email protected] wrote:
FORTIFY_SOURCEcould detect various overflows at compile and run time.ARCH_HAS_FORTIFY_SOURCEmeans that the architecture can be built and run withCONFIG_FORTIFY_SOURCE. Select it in RISCV.See more about this feature from commit
6974f0c4555e("include/linux/string.h: add the option of fortifiedstring.hfunctions").Signed-off-by Kefeng Wang <[email protected]>--- arch/riscv/Kconfig | 1 + arch/riscv/include/asm/string.h | 5 +++++ 2 files changed, 6 insertions(+)arch/riscv/Kconfig +1
-0@@ -20,6 +20,7 @@ config RISCV select ARCH_HAS_DEBUG_VM_PGTABLE select ARCH_HAS_DEBUG_VIRTUAL if MMU select ARCH_HAS_DEBUG_WX + select ARCH_HAS_FORTIFY_SOURCE select ARCH_HAS_GCOV_PROFILE_ALL select ARCH_HAS_GIGANTIC_PAGE select ARCH_HAS_KCOVarch/riscv/include/asm/string.h +0
-0
arch/riscv/include/asm/string.h extern asmlinkage void *__memmove(void *, const void *, size_t); · line 32
Quoted 10 lines
arch/riscv/include/asm/string.h +5
-0@@ -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 */
Thanks, this is on for-next.
_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv