public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/3] s390: Always declare __mem functions
@ 2022-09-09  7:38 Marco Elver
  2022-09-09  7:38 ` [PATCH v2 2/3] kcsan: Instrument memcpy/memset/memmove with newer Clang Marco Elver
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Marco Elver @ 2022-09-09  7:38 UTC (permalink / raw)
  To: elver, Paul E. McKenney
  Cc: Mark Rutland, Dmitry Vyukov, Alexander Potapenko, Boqun Feng,
	kasan-dev, linux-kernel, Nathan Chancellor, Nick Desaulniers,
	llvm, Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Peter Zijlstra, linux-s390

Like other architectures, always declare __mem*() functions if the
architecture defines __HAVE_ARCH_MEM*.

For example, this is required by sanitizer runtimes to unambiguously
refer to the arch versions of the mem-functions, and the compiler not
attempting any "optimizations" such as replacing the calls with builtins
(which may later be inlined etc.).

Signed-off-by: Marco Elver <elver@google.com>
---
v2:
* New patch.
---
 arch/s390/include/asm/string.h | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/arch/s390/include/asm/string.h b/arch/s390/include/asm/string.h
index 3fae93ddb322..2c3c48d526b9 100644
--- a/arch/s390/include/asm/string.h
+++ b/arch/s390/include/asm/string.h
@@ -20,8 +20,11 @@
 #define __HAVE_ARCH_MEMSET64	/* arch function */
 
 void *memcpy(void *dest, const void *src, size_t n);
+void *__memcpy(void *dest, const void *src, size_t n);
 void *memset(void *s, int c, size_t n);
+void *__memset(void *s, int c, size_t n);
 void *memmove(void *dest, const void *src, size_t n);
+void *__memmove(void *dest, const void *src, size_t n);
 
 #ifndef CONFIG_KASAN
 #define __HAVE_ARCH_MEMCHR	/* inline & arch function */
@@ -55,10 +58,6 @@ char *strstr(const char *s1, const char *s2);
 
 #if defined(CONFIG_KASAN) && !defined(__SANITIZE_ADDRESS__)
 
-extern void *__memcpy(void *dest, const void *src, size_t n);
-extern void *__memset(void *s, int c, size_t n);
-extern void *__memmove(void *dest, const void *src, size_t n);
-
 /*
  * For files that are not instrumented (e.g. mm/slub.c) we
  * should use not instrumented version of mem* functions.
-- 
2.37.2.789.g6183377224-goog


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

end of thread, other threads:[~2022-09-09  8:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-09  7:38 [PATCH v2 1/3] s390: Always declare __mem functions Marco Elver
2022-09-09  7:38 ` [PATCH v2 2/3] kcsan: Instrument memcpy/memset/memmove with newer Clang Marco Elver
2022-09-09  8:38   ` Dmitry Vyukov
2022-09-09  8:43     ` Marco Elver
2022-09-09  7:38 ` [PATCH v2 3/3] objtool, kcsan: Add volatile read/write instrumentation to whitelist Marco Elver
2022-09-09  8:38   ` Dmitry Vyukov
2022-09-09  8:36 ` [PATCH v2 1/3] s390: Always declare __mem functions Dmitry Vyukov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox