Re: [PATCH v2 1/3] s390: Always declare __mem functions

From: Dmitry Vyukov
Date: Fri Sep 09 2022 - 04:36:23 EST


On Fri, 9 Sept 2022 at 09:38, Marco Elver <elver@xxxxxxxxxx> wrote:
>
> 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@xxxxxxxxxx>

Acked-by: Dmitry Vyukov <dvyukov@xxxxxxxxxx>

> ---
> 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
>