linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mips: Kconfig: Add ARCH_HAS_FORTIFY_SOURCE
@ 2019-09-12 22:53 Dmitry Korotin
  2019-10-01 12:49 ` Alexander Lobakin
  2019-10-07 17:53 ` Paul Burton
  0 siblings, 2 replies; 6+ messages in thread
From: Dmitry Korotin @ 2019-09-12 22:53 UTC (permalink / raw)
  To: Paul Burton; +Cc: linux-mips, Dmitry Korotin

FORTIFY_SOURCE detects various overflows at compile and run time.
(6974f0c4555e ("include/linux/string.h:
add the option of fortified string.h functions)

ARCH_HAS_FORTIFY_SOURCE means that the architecture can be built and
run with CONFIG_FORTIFY_SOURCE.

Since mips can be built and run with that flag,
select ARCH_HAS_FORTIFY_SOURCE as default.

Signed-off-by: Dmitry Korotin <dkorotin@wavecomp.com>
---
 arch/mips/Kconfig              |    1 +
 arch/mips/include/asm/string.h |    2 ++
 2 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index d50fafd..63d608f 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -8,6 +8,7 @@ config MIPS
 	select ARCH_HAS_ELF_RANDOMIZE
 	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
 	select ARCH_HAS_UBSAN_SANITIZE_ALL
+	select ARCH_HAS_FORTIFY_SOURCE
 	select ARCH_SUPPORTS_UPROBES
 	select ARCH_USE_BUILTIN_BSWAP
 	select ARCH_USE_CMPXCHG_LOCKREF if 64BIT
diff --git a/arch/mips/include/asm/string.h b/arch/mips/include/asm/string.h
index 29030cb..4b938c5 100644
--- a/arch/mips/include/asm/string.h
+++ b/arch/mips/include/asm/string.h
@@ -10,6 +10,7 @@
 #ifndef _ASM_STRING_H
 #define _ASM_STRING_H
 
+#if !defined(__OPTIMIZE__) || !defined(CONFIG_FORTIFY_SOURCE)
 
 /*
  * Most of the inline functions are rather naive implementations so I just
@@ -130,6 +131,7 @@ static __inline__ int strcmp(__const__ char *__cs, __const__ char *__ct)
 	return __res;
 }
 #endif /* CONFIG_32BIT */
+#endif /* !defined(__OPTIMIZE__) || !defined(CONFIG_FORTIFY_SOURCE) */
 
 #define __HAVE_ARCH_MEMSET
 extern void *memset(void *__s, int __c, size_t __count);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-10-07 17:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-12 22:53 [PATCH] mips: Kconfig: Add ARCH_HAS_FORTIFY_SOURCE Dmitry Korotin
2019-10-01 12:49 ` Alexander Lobakin
2019-10-01 23:14   ` Paul Burton
2019-10-02  8:39     ` Alexander Lobakin
2019-10-02 16:23       ` Alexander Lobakin
2019-10-07 17:53 ` Paul Burton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).