Mark Wielaard 7bd740
commit 89423f5d8ba05a099c2c62227a00a4f4eec59eb3
Mark Wielaard 7bd740
Author: Mark Wielaard <mark@klomp.org>
Mark Wielaard 7bd740
Date:   Tue May 7 21:20:04 2019 +0200
Mark Wielaard 7bd740
Mark Wielaard 7bd740
    Intercept stpcpy also in ld.so for arm64
Mark Wielaard 7bd740
    
Mark Wielaard 7bd740
    On other arches stpcpy () is intercepted for both libc.so and ld.so.
Mark Wielaard 7bd740
    But not on arm64, where it is only intercepted for libc.so.
Mark Wielaard 7bd740
    
Mark Wielaard 7bd740
    This can cause memcheck warnings about the use of stpcpy () in ld.so
Mark Wielaard 7bd740
    when called through dlopen () because ld.so contains its own copy of
Mark Wielaard 7bd740
    that functions.
Mark Wielaard 7bd740
    
Mark Wielaard 7bd740
    Fix by introducing VG_Z_LD_LINUX_AARCH64_SO_1 (the encoded name of
Mark Wielaard 7bd740
    ld.so on arm64) and using that in vg_replace_strmem.c to intercept
Mark Wielaard 7bd740
    stpcpy.
Mark Wielaard 7bd740
    
Mark Wielaard 7bd740
    https://bugs.kde.org/show_bug.cgi?id=407307
Mark Wielaard 7bd740
Mark Wielaard 7bd740
diff --git a/include/pub_tool_redir.h b/include/pub_tool_redir.h
Mark Wielaard 7bd740
index c97941f..15ba67f 100644
Mark Wielaard 7bd740
--- a/include/pub_tool_redir.h
Mark Wielaard 7bd740
+++ b/include/pub_tool_redir.h
Mark Wielaard 7bd740
@@ -313,7 +313,9 @@
Mark Wielaard 7bd740
 #define  VG_Z_LD_SO_1               ldZdsoZd1                  // ld.so.1
Mark Wielaard 7bd740
 #define  VG_U_LD_SO_1               "ld.so.1"
Mark Wielaard 7bd740
 
Mark Wielaard 7bd740
+#define  VG_Z_LD_LINUX_AARCH64_SO_1  ldZhlinuxZhaarch64ZdsoZd1
Mark Wielaard 7bd740
 #define  VG_U_LD_LINUX_AARCH64_SO_1 "ld-linux-aarch64.so.1"
Mark Wielaard 7bd740
+
Mark Wielaard 7bd740
 #define  VG_U_LD_LINUX_ARMHF_SO_3   "ld-linux-armhf.so.3"
Mark Wielaard 7bd740
 
Mark Wielaard 7bd740
 #endif
Mark Wielaard 7bd740
diff --git a/shared/vg_replace_strmem.c b/shared/vg_replace_strmem.c
Mark Wielaard 7bd740
index 89a7dcc..19143cf 100644
Mark Wielaard 7bd740
--- a/shared/vg_replace_strmem.c
Mark Wielaard 7bd740
+++ b/shared/vg_replace_strmem.c
Mark Wielaard 7bd740
@@ -1160,6 +1160,7 @@ static inline void my_exit ( int x )
Mark Wielaard 7bd740
  STPCPY(VG_Z_LIBC_SONAME,          __stpcpy_sse2_unaligned)
Mark Wielaard 7bd740
  STPCPY(VG_Z_LD_LINUX_SO_2,        stpcpy)
Mark Wielaard 7bd740
  STPCPY(VG_Z_LD_LINUX_X86_64_SO_2, stpcpy)
Mark Wielaard 7bd740
+ STPCPY(VG_Z_LD_LINUX_AARCH64_SO_1,stpcpy)
Mark Wielaard 7bd740
 
Mark Wielaard 7bd740
 #elif defined(VGO_darwin)
Mark Wielaard 7bd740
  //STPCPY(VG_Z_LIBC_SONAME,          stpcpy)