import gcc-toolset-9-valgrind-3.15.0-9.el8
This commit is contained in:
		
						commit
						ae26ca37e2
					
				
							
								
								
									
										1
									
								
								.gcc-toolset-9-valgrind.metadata
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								.gcc-toolset-9-valgrind.metadata
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1 @@ | |||||||
|  | 4cc014e2390c4bcecb11aa00b37aa52d352db97f SOURCES/valgrind-3.15.0.tar.bz2 | ||||||
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1 @@ | |||||||
|  | SOURCES/valgrind-3.15.0.tar.bz2 | ||||||
							
								
								
									
										45
									
								
								SOURCES/valgrind-3.15.0-arm64-ld-stpcpy.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								SOURCES/valgrind-3.15.0-arm64-ld-stpcpy.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,45 @@ | |||||||
|  | commit 89423f5d8ba05a099c2c62227a00a4f4eec59eb3 | ||||||
|  | Author: Mark Wielaard <mark@klomp.org> | ||||||
|  | Date:   Tue May 7 21:20:04 2019 +0200 | ||||||
|  | 
 | ||||||
|  |     Intercept stpcpy also in ld.so for arm64 | ||||||
|  |      | ||||||
|  |     On other arches stpcpy () is intercepted for both libc.so and ld.so. | ||||||
|  |     But not on arm64, where it is only intercepted for libc.so. | ||||||
|  |      | ||||||
|  |     This can cause memcheck warnings about the use of stpcpy () in ld.so | ||||||
|  |     when called through dlopen () because ld.so contains its own copy of | ||||||
|  |     that functions. | ||||||
|  |      | ||||||
|  |     Fix by introducing VG_Z_LD_LINUX_AARCH64_SO_1 (the encoded name of | ||||||
|  |     ld.so on arm64) and using that in vg_replace_strmem.c to intercept | ||||||
|  |     stpcpy. | ||||||
|  |      | ||||||
|  |     https://bugs.kde.org/show_bug.cgi?id=407307 | ||||||
|  | 
 | ||||||
|  | diff --git a/include/pub_tool_redir.h b/include/pub_tool_redir.h
 | ||||||
|  | index c97941f..15ba67f 100644
 | ||||||
|  | --- a/include/pub_tool_redir.h
 | ||||||
|  | +++ b/include/pub_tool_redir.h
 | ||||||
|  | @@ -313,7 +313,9 @@
 | ||||||
|  |  #define  VG_Z_LD_SO_1               ldZdsoZd1                  // ld.so.1 | ||||||
|  |  #define  VG_U_LD_SO_1               "ld.so.1" | ||||||
|  |   | ||||||
|  | +#define  VG_Z_LD_LINUX_AARCH64_SO_1  ldZhlinuxZhaarch64ZdsoZd1
 | ||||||
|  |  #define  VG_U_LD_LINUX_AARCH64_SO_1 "ld-linux-aarch64.so.1" | ||||||
|  | +
 | ||||||
|  |  #define  VG_U_LD_LINUX_ARMHF_SO_3   "ld-linux-armhf.so.3" | ||||||
|  |   | ||||||
|  |  #endif | ||||||
|  | diff --git a/shared/vg_replace_strmem.c b/shared/vg_replace_strmem.c
 | ||||||
|  | index 89a7dcc..19143cf 100644
 | ||||||
|  | --- a/shared/vg_replace_strmem.c
 | ||||||
|  | +++ b/shared/vg_replace_strmem.c
 | ||||||
|  | @@ -1160,6 +1160,7 @@ static inline void my_exit ( int x )
 | ||||||
|  |   STPCPY(VG_Z_LIBC_SONAME,          __stpcpy_sse2_unaligned) | ||||||
|  |   STPCPY(VG_Z_LD_LINUX_SO_2,        stpcpy) | ||||||
|  |   STPCPY(VG_Z_LD_LINUX_X86_64_SO_2, stpcpy) | ||||||
|  | + STPCPY(VG_Z_LD_LINUX_AARCH64_SO_1,stpcpy)
 | ||||||
|  |   | ||||||
|  |  #elif defined(VGO_darwin) | ||||||
|  |   //STPCPY(VG_Z_LIBC_SONAME,          stpcpy) | ||||||
							
								
								
									
										95
									
								
								SOURCES/valgrind-3.15.0-avx-rdrand-f16c.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										95
									
								
								SOURCES/valgrind-3.15.0-avx-rdrand-f16c.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,95 @@ | |||||||
|  | commit 791fe5ecf909d573bcbf353b677b9404f9da0ed4 | ||||||
|  | Author: Mark Wielaard <mark@klomp.org> | ||||||
|  | Date:   Mon May 27 22:19:27 2019 +0200 | ||||||
|  | 
 | ||||||
|  |     Expose rdrand and f16c through cpuid also if the host only has avx. | ||||||
|  |      | ||||||
|  |     The amd64 CPUID dirtyhelpers are mostly static since they emulate some | ||||||
|  |     existing CPU "family". The avx2 ("i7-4910MQ") CPUID variant however | ||||||
|  |     can "dynamicly" enable rdrand and/or f16c if the host supports them. | ||||||
|  |     Do the same for the avx_and_cx16 ("i5-2300") CPUID variant. | ||||||
|  |      | ||||||
|  |     https://bugs.kde.org/show_bug.cgi?id=408009 | ||||||
|  | 
 | ||||||
|  | diff --git a/VEX/priv/guest_amd64_defs.h b/VEX/priv/guest_amd64_defs.h
 | ||||||
|  | index 4f34b41..a5de527 100644
 | ||||||
|  | --- a/VEX/priv/guest_amd64_defs.h
 | ||||||
|  | +++ b/VEX/priv/guest_amd64_defs.h
 | ||||||
|  | @@ -165,7 +165,9 @@ extern void  amd64g_dirtyhelper_storeF80le ( Addr/*addr*/, ULong/*data*/ );
 | ||||||
|  |  extern void  amd64g_dirtyhelper_CPUID_baseline ( VexGuestAMD64State* st ); | ||||||
|  |  extern void  amd64g_dirtyhelper_CPUID_sse3_and_cx16 ( VexGuestAMD64State* st ); | ||||||
|  |  extern void  amd64g_dirtyhelper_CPUID_sse42_and_cx16 ( VexGuestAMD64State* st ); | ||||||
|  | -extern void  amd64g_dirtyhelper_CPUID_avx_and_cx16 ( VexGuestAMD64State* st );
 | ||||||
|  | +extern void  amd64g_dirtyhelper_CPUID_avx_and_cx16 ( VexGuestAMD64State* st,
 | ||||||
|  | +                                                     ULong hasF16C,
 | ||||||
|  | +                                                     ULong hasRDRAND );
 | ||||||
|  |  extern void  amd64g_dirtyhelper_CPUID_avx2 ( VexGuestAMD64State* st, | ||||||
|  |                                               ULong hasF16C, ULong hasRDRAND ); | ||||||
|  |   | ||||||
|  | diff --git a/VEX/priv/guest_amd64_helpers.c b/VEX/priv/guest_amd64_helpers.c
 | ||||||
|  | index e4cf7e2..182bae0 100644
 | ||||||
|  | --- a/VEX/priv/guest_amd64_helpers.c
 | ||||||
|  | +++ b/VEX/priv/guest_amd64_helpers.c
 | ||||||
|  | @@ -3141,8 +3141,11 @@ void amd64g_dirtyhelper_CPUID_sse42_and_cx16 ( VexGuestAMD64State* st )
 | ||||||
|  |     address sizes   : 36 bits physical, 48 bits virtual | ||||||
|  |     power management: | ||||||
|  |  */ | ||||||
|  | -void amd64g_dirtyhelper_CPUID_avx_and_cx16 ( VexGuestAMD64State* st )
 | ||||||
|  | +void amd64g_dirtyhelper_CPUID_avx_and_cx16 ( VexGuestAMD64State* st,
 | ||||||
|  | +                                             ULong hasF16C, ULong hasRDRAND )
 | ||||||
|  |  { | ||||||
|  | +   vassert((hasF16C >> 1) == 0ULL);
 | ||||||
|  | +   vassert((hasRDRAND >> 1) == 0ULL);
 | ||||||
|  |  #  define SET_ABCD(_a,_b,_c,_d)                \ | ||||||
|  |        do { st->guest_RAX = (ULong)(_a);        \ | ||||||
|  |             st->guest_RBX = (ULong)(_b);        \ | ||||||
|  | @@ -3157,9 +3160,14 @@ void amd64g_dirtyhelper_CPUID_avx_and_cx16 ( VexGuestAMD64State* st )
 | ||||||
|  |        case 0x00000000: | ||||||
|  |           SET_ABCD(0x0000000d, 0x756e6547, 0x6c65746e, 0x49656e69); | ||||||
|  |           break; | ||||||
|  | -      case 0x00000001:
 | ||||||
|  | -         SET_ABCD(0x000206a7, 0x00100800, 0x1f9ae3bf, 0xbfebfbff);
 | ||||||
|  | +      case 0x00000001: {
 | ||||||
|  | +         // As a baseline, advertise neither F16C (ecx:29) nor RDRAND (ecx:30),
 | ||||||
|  | +         // but patch in support for them as directed by the caller.
 | ||||||
|  | +         UInt ecx_extra
 | ||||||
|  | +            = (hasF16C ? (1U << 29) : 0) | (hasRDRAND ? (1U << 30) : 0);
 | ||||||
|  | +         SET_ABCD(0x000206a7, 0x00100800, (0x1f9ae3bf | ecx_extra), 0xbfebfbff);
 | ||||||
|  |           break; | ||||||
|  | +      }
 | ||||||
|  |        case 0x00000002: | ||||||
|  |           SET_ABCD(0x76035a01, 0x00f0b0ff, 0x00000000, 0x00ca0000); | ||||||
|  |           break; | ||||||
|  | diff --git a/VEX/priv/guest_amd64_toIR.c b/VEX/priv/guest_amd64_toIR.c
 | ||||||
|  | index 56e992c..96dee38 100644
 | ||||||
|  | --- a/VEX/priv/guest_amd64_toIR.c
 | ||||||
|  | +++ b/VEX/priv/guest_amd64_toIR.c
 | ||||||
|  | @@ -22007,7 +22007,8 @@ Long dis_ESC_0F (
 | ||||||
|  |   | ||||||
|  |        vassert(fName); vassert(fAddr); | ||||||
|  |        IRExpr** args = NULL; | ||||||
|  | -      if (fAddr == &amd64g_dirtyhelper_CPUID_avx2) {
 | ||||||
|  | +      if (fAddr == &amd64g_dirtyhelper_CPUID_avx2
 | ||||||
|  | +          || fAddr == &amd64g_dirtyhelper_CPUID_avx_and_cx16) {
 | ||||||
|  |           Bool hasF16C   = (archinfo->hwcaps & VEX_HWCAPS_AMD64_F16C) != 0; | ||||||
|  |           Bool hasRDRAND = (archinfo->hwcaps & VEX_HWCAPS_AMD64_RDRAND) != 0; | ||||||
|  |           args = mkIRExprVec_3(IRExpr_GSPTR(), | ||||||
|  | diff --git a/coregrind/m_machine.c b/coregrind/m_machine.c
 | ||||||
|  | index 3536e57..56a28d1 100644
 | ||||||
|  | --- a/coregrind/m_machine.c
 | ||||||
|  | +++ b/coregrind/m_machine.c
 | ||||||
|  | @@ -1076,10 +1076,10 @@ Bool VG_(machine_get_hwcaps)( void )
 | ||||||
|  |          have_avx2 = (ebx & (1<<5)) != 0; /* True => have AVX2 */ | ||||||
|  |       } | ||||||
|  |   | ||||||
|  | -     /* Sanity check for RDRAND and F16C.  These don't actually *need* AVX2, but
 | ||||||
|  | -        it's convenient to restrict them to the AVX2 case since the simulated
 | ||||||
|  | -        CPUID we'll offer them on has AVX2 as a base. */
 | ||||||
|  | -     if (!have_avx2) {
 | ||||||
|  | +     /* Sanity check for RDRAND and F16C.  These don't actually *need* AVX, but
 | ||||||
|  | +        it's convenient to restrict them to the AVX case since the simulated
 | ||||||
|  | +        CPUID we'll offer them on has AVX as a base. */
 | ||||||
|  | +     if (!have_avx) {
 | ||||||
|  |          have_f16c   = False; | ||||||
|  |          have_rdrand = False; | ||||||
|  |       } | ||||||
							
								
								
									
										374
									
								
								SOURCES/valgrind-3.15.0-copy_file_range.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										374
									
								
								SOURCES/valgrind-3.15.0-copy_file_range.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,374 @@ | |||||||
|  | commit 5f00db054a6f59502e9deeeb59ace2261207ee31 | ||||||
|  | Author: Alexandra Hajkova <ahajkova@redhat.com> | ||||||
|  | Date:   Thu May 2 08:24:02 2019 -0400 | ||||||
|  | 
 | ||||||
|  |     Add support for the copy_file_range syscall | ||||||
|  |      | ||||||
|  |     Support amd64, x86, arm64, ppc64, ppc32 and s390x architectures. | ||||||
|  |     Also add sys-copy_file_range test case. | ||||||
|  | 
 | ||||||
|  | diff --git a/configure.ac b/configure.ac
 | ||||||
|  | index d043ce3..3528925 100755
 | ||||||
|  | --- a/configure.ac
 | ||||||
|  | +++ b/configure.ac
 | ||||||
|  | @@ -4172,6 +4172,7 @@ AC_CHECK_FUNCS([     \
 | ||||||
|  |          utimensat    \ | ||||||
|  |          process_vm_readv  \ | ||||||
|  |          process_vm_writev \ | ||||||
|  | +        copy_file_range \
 | ||||||
|  |          ]) | ||||||
|  |   | ||||||
|  |  # AC_CHECK_LIB adds any library found to the variable LIBS, and links these | ||||||
|  | @@ -4187,6 +4188,8 @@ AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
 | ||||||
|  |                 [test x$ac_cv_func_pthread_spin_lock = xyes]) | ||||||
|  |  AM_CONDITIONAL([HAVE_PTHREAD_SETNAME_NP], | ||||||
|  |                 [test x$ac_cv_func_pthread_setname_np = xyes]) | ||||||
|  | +AM_CONDITIONAL([HAVE_COPY_FILE_RANGE],
 | ||||||
|  | +               [test x$ac_cv_func_copy_file_range = xyes])
 | ||||||
|  |   | ||||||
|  |  if test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \ | ||||||
|  |       -o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX ; then | ||||||
|  | diff --git a/coregrind/m_syswrap/priv_syswrap-linux.h b/coregrind/m_syswrap/priv_syswrap-linux.h
 | ||||||
|  | index f76191a..1edf9eb 100644
 | ||||||
|  | --- a/coregrind/m_syswrap/priv_syswrap-linux.h
 | ||||||
|  | +++ b/coregrind/m_syswrap/priv_syswrap-linux.h
 | ||||||
|  | @@ -379,6 +379,7 @@ DECL_TEMPLATE(linux, sys_getsockname);
 | ||||||
|  |  DECL_TEMPLATE(linux, sys_getpeername); | ||||||
|  |  DECL_TEMPLATE(linux, sys_socketpair); | ||||||
|  |  DECL_TEMPLATE(linux, sys_kcmp); | ||||||
|  | +DECL_TEMPLATE(linux, sys_copy_file_range);
 | ||||||
|  |   | ||||||
|  |  // Some arch specific functions called from syswrap-linux.c | ||||||
|  |  extern Int do_syscall_clone_x86_linux ( Word (*fn)(void *),  | ||||||
|  | diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c
 | ||||||
|  | index 30e7d0e..0c1d8d1 100644
 | ||||||
|  | --- a/coregrind/m_syswrap/syswrap-amd64-linux.c
 | ||||||
|  | +++ b/coregrind/m_syswrap/syswrap-amd64-linux.c
 | ||||||
|  | @@ -863,6 +863,8 @@ static SyscallTableEntry syscall_table[] = {
 | ||||||
|  |     LINXY(__NR_statx,             sys_statx),             // 332 | ||||||
|  |   | ||||||
|  |     LINX_(__NR_membarrier,        sys_membarrier),        // 324 | ||||||
|  | +
 | ||||||
|  | +   LINX_(__NR_copy_file_range,   sys_copy_file_range),   // 326
 | ||||||
|  |  }; | ||||||
|  |   | ||||||
|  |  SyscallTableEntry* ML_(get_linux_syscall_entry) ( UInt sysno ) | ||||||
|  | diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c
 | ||||||
|  | index 290320a..f66be2d 100644
 | ||||||
|  | --- a/coregrind/m_syswrap/syswrap-arm64-linux.c
 | ||||||
|  | +++ b/coregrind/m_syswrap/syswrap-arm64-linux.c
 | ||||||
|  | @@ -819,7 +819,7 @@ static SyscallTableEntry syscall_main_table[] = {
 | ||||||
|  |     //   (__NR_userfaultfd,       sys_ni_syscall),        // 282 | ||||||
|  |     LINX_(__NR_membarrier,        sys_membarrier),        // 283 | ||||||
|  |     //   (__NR_mlock2,            sys_ni_syscall),        // 284 | ||||||
|  | -   //   (__NR_copy_file_range,   sys_ni_syscall),        // 285
 | ||||||
|  | +   LINX_(__NR_copy_file_range,   sys_copy_file_range),   // 285
 | ||||||
|  |     //   (__NR_preadv2,           sys_ni_syscall),        // 286 | ||||||
|  |     //   (__NR_pwritev2,          sys_ni_syscall),        // 287 | ||||||
|  |     //   (__NR_pkey_mprotect,     sys_ni_syscall),        // 288 | ||||||
|  | diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c
 | ||||||
|  | index 73ef98d..cd0ee74 100644
 | ||||||
|  | --- a/coregrind/m_syswrap/syswrap-linux.c
 | ||||||
|  | +++ b/coregrind/m_syswrap/syswrap-linux.c
 | ||||||
|  | @@ -12093,6 +12093,36 @@ POST(sys_bpf)
 | ||||||
|  |     } | ||||||
|  |  } | ||||||
|  |   | ||||||
|  | +PRE(sys_copy_file_range)
 | ||||||
|  | +{
 | ||||||
|  | +  PRINT("sys_copy_file_range (%lu, %lu, %lu, %lu, %lu, %lu)", ARG1, ARG2, ARG3,
 | ||||||
|  | +        ARG4, ARG5, ARG6);
 | ||||||
|  | +
 | ||||||
|  | +  PRE_REG_READ6(vki_size_t, "copy_file_range",
 | ||||||
|  | +                int, "fd_in",
 | ||||||
|  | +                vki_loff_t *, "off_in",
 | ||||||
|  | +                int, "fd_out",
 | ||||||
|  | +                vki_loff_t *, "off_out",
 | ||||||
|  | +                vki_size_t, "len",
 | ||||||
|  | +                unsigned int, "flags");
 | ||||||
|  | +
 | ||||||
|  | +  /* File descriptors are "specially" tracked by valgrind.
 | ||||||
|  | +     valgrind itself uses some, so make sure someone didn't
 | ||||||
|  | +     put in one of our own...  */
 | ||||||
|  | +  if (!ML_(fd_allowed)(ARG1, "copy_file_range(fd_in)", tid, False) ||
 | ||||||
|  | +      !ML_(fd_allowed)(ARG3, "copy_file_range(fd_in)", tid, False)) {
 | ||||||
|  | +     SET_STATUS_Failure( VKI_EBADF );
 | ||||||
|  | +  } else {
 | ||||||
|  | +     /* Now see if the offsets are defined. PRE_MEM_READ will
 | ||||||
|  | +        double check it can dereference them. */
 | ||||||
|  | +     if (ARG2 != 0)
 | ||||||
|  | +        PRE_MEM_READ( "copy_file_range(off_in)", ARG2, sizeof(vki_loff_t));
 | ||||||
|  | +     if (ARG4 != 0)
 | ||||||
|  | +        PRE_MEM_READ( "copy_file_range(off_out)", ARG4, sizeof(vki_loff_t));
 | ||||||
|  | +  }
 | ||||||
|  | +}
 | ||||||
|  | +
 | ||||||
|  | +
 | ||||||
|  |  #undef PRE | ||||||
|  |  #undef POST | ||||||
|  |   | ||||||
|  | diff --git a/coregrind/m_syswrap/syswrap-ppc32-linux.c b/coregrind/m_syswrap/syswrap-ppc32-linux.c
 | ||||||
|  | index f812f1f..71f208d 100644
 | ||||||
|  | --- a/coregrind/m_syswrap/syswrap-ppc32-linux.c
 | ||||||
|  | +++ b/coregrind/m_syswrap/syswrap-ppc32-linux.c
 | ||||||
|  | @@ -1021,6 +1021,8 @@ static SyscallTableEntry syscall_table[] = {
 | ||||||
|  |     LINXY(__NR_getrandom,         sys_getrandom),        // 359 | ||||||
|  |     LINXY(__NR_memfd_create,      sys_memfd_create),     // 360 | ||||||
|  |   | ||||||
|  | +   LINX_(__NR_copy_file_range,   sys_copy_file_range),  // 379
 | ||||||
|  | +
 | ||||||
|  |     LINXY(__NR_statx,             sys_statx),            // 383 | ||||||
|  |  }; | ||||||
|  |   | ||||||
|  | diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c
 | ||||||
|  | index eada099..1a42c1f 100644
 | ||||||
|  | --- a/coregrind/m_syswrap/syswrap-ppc64-linux.c
 | ||||||
|  | +++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c
 | ||||||
|  | @@ -1007,6 +1007,8 @@ static SyscallTableEntry syscall_table[] = {
 | ||||||
|  |   | ||||||
|  |     LINX_(__NR_membarrier,        sys_membarrier),       // 365 | ||||||
|  |   | ||||||
|  | +   LINX_(__NR_copy_file_range,   sys_copy_file_range),  // 379
 | ||||||
|  | +
 | ||||||
|  |     LINXY(__NR_statx,             sys_statx),            // 383 | ||||||
|  |  }; | ||||||
|  |   | ||||||
|  | diff --git a/coregrind/m_syswrap/syswrap-s390x-linux.c b/coregrind/m_syswrap/syswrap-s390x-linux.c
 | ||||||
|  | index ad78384..41ada8d 100644
 | ||||||
|  | --- a/coregrind/m_syswrap/syswrap-s390x-linux.c
 | ||||||
|  | +++ b/coregrind/m_syswrap/syswrap-s390x-linux.c
 | ||||||
|  | @@ -854,6 +854,8 @@ static SyscallTableEntry syscall_table[] = {
 | ||||||
|  |     LINXY(__NR_recvmsg, sys_recvmsg),                                  // 372 | ||||||
|  |     LINX_(__NR_shutdown, sys_shutdown),                                // 373 | ||||||
|  |   | ||||||
|  | +   LINX_(__NR_copy_file_range, sys_copy_file_range),                  // 375
 | ||||||
|  | +
 | ||||||
|  |     LINXY(__NR_statx, sys_statx),                                      // 379 | ||||||
|  |  }; | ||||||
|  |   | ||||||
|  | diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c
 | ||||||
|  | index f05619e..f8d97ea 100644
 | ||||||
|  | --- a/coregrind/m_syswrap/syswrap-x86-linux.c
 | ||||||
|  | +++ b/coregrind/m_syswrap/syswrap-x86-linux.c
 | ||||||
|  | @@ -1608,6 +1608,8 @@ static SyscallTableEntry syscall_table[] = {
 | ||||||
|  |   | ||||||
|  |     LINX_(__NR_membarrier,        sys_membarrier),       // 375 | ||||||
|  |   | ||||||
|  | +   LINX_(__NR_copy_file_range,   sys_copy_file_range),   // 377
 | ||||||
|  | +
 | ||||||
|  |     LINXY(__NR_statx,             sys_statx),            // 383 | ||||||
|  |   | ||||||
|  |     /* Explicitly not supported on i386 yet. */ | ||||||
|  | diff --git a/memcheck/tests/linux/Makefile.am b/memcheck/tests/linux/Makefile.am
 | ||||||
|  | index d7515d9..00e99a5 100644
 | ||||||
|  | --- a/memcheck/tests/linux/Makefile.am
 | ||||||
|  | +++ b/memcheck/tests/linux/Makefile.am
 | ||||||
|  | @@ -20,6 +20,7 @@ EXTRA_DIST = \
 | ||||||
|  |  	stack_switch.stderr.exp stack_switch.vgtest \ | ||||||
|  |  	syscalls-2007.vgtest syscalls-2007.stderr.exp \ | ||||||
|  |  	syslog-syscall.vgtest syslog-syscall.stderr.exp \ | ||||||
|  | +	sys-copy_file_range.vgtest sys-copy_file_range.stderr.exp \
 | ||||||
|  |  	sys-openat.vgtest sys-openat.stderr.exp sys-openat.stdout.exp \ | ||||||
|  |  	sys-statx.vgtest sys-statx.stderr.exp \ | ||||||
|  |  	timerfd-syscall.vgtest timerfd-syscall.stderr.exp \ | ||||||
|  | @@ -49,6 +50,10 @@ if HAVE_AT_FDCWD
 | ||||||
|  |  check_PROGRAMS += sys-openat | ||||||
|  |  endif | ||||||
|  |   | ||||||
|  | +if HAVE_COPY_FILE_RANGE
 | ||||||
|  | +        check_PROGRAMS += sys-copy_file_range
 | ||||||
|  | +endif
 | ||||||
|  | +
 | ||||||
|  |  AM_CFLAGS   += $(AM_FLAG_M3264_PRI) | ||||||
|  |  AM_CXXFLAGS += $(AM_FLAG_M3264_PRI) | ||||||
|  |   | ||||||
|  | diff --git a/memcheck/tests/linux/sys-copy_file_range.c b/memcheck/tests/linux/sys-copy_file_range.c
 | ||||||
|  | new file mode 100644 | ||||||
|  | index 0000000..83981c6
 | ||||||
|  | --- /dev/null
 | ||||||
|  | +++ b/memcheck/tests/linux/sys-copy_file_range.c
 | ||||||
|  | @@ -0,0 +1,67 @@
 | ||||||
|  | +#define _GNU_SOURCE
 | ||||||
|  | +#include <fcntl.h>
 | ||||||
|  | +#include <stdio.h>
 | ||||||
|  | +#include <stdlib.h>
 | ||||||
|  | +#include <sys/stat.h>
 | ||||||
|  | +#include <sys/syscall.h>
 | ||||||
|  | +#include <unistd.h>
 | ||||||
|  | +
 | ||||||
|  | +int main(int argc, char **argv)
 | ||||||
|  | +{
 | ||||||
|  | +    int fd_in, fd_out;
 | ||||||
|  | +    struct stat stat;
 | ||||||
|  | +    loff_t len, ret;
 | ||||||
|  | +
 | ||||||
|  | +    fd_in = open("copy_file_range_source", O_CREAT | O_RDWR);
 | ||||||
|  | +    if (fd_in == -1) {
 | ||||||
|  | +        perror("open copy_file_range_source");
 | ||||||
|  | +        exit(EXIT_FAILURE);
 | ||||||
|  | +    }
 | ||||||
|  | +
 | ||||||
|  | +    if (write(fd_in, "foo bar\n", 8) != 8) {
 | ||||||
|  | +        perror("writing to the copy_file_range_source");
 | ||||||
|  | +        exit(EXIT_FAILURE);
 | ||||||
|  | +    }
 | ||||||
|  | +    lseek(fd_in, 0, SEEK_SET);
 | ||||||
|  | +
 | ||||||
|  | +    if (fstat(fd_in, &stat) == -1) {
 | ||||||
|  | +        perror("fstat");
 | ||||||
|  | +        exit(EXIT_FAILURE);
 | ||||||
|  | +    }
 | ||||||
|  | +
 | ||||||
|  | +    len = stat.st_size;
 | ||||||
|  | +
 | ||||||
|  | +    fd_out = open("copy_file_range_dest", O_CREAT | O_WRONLY | O_TRUNC, 0644);
 | ||||||
|  | +    if (fd_out == -1) {
 | ||||||
|  | +        perror("open copy_file_range_dest");
 | ||||||
|  | +        exit(EXIT_FAILURE);
 | ||||||
|  | +    }
 | ||||||
|  | +
 | ||||||
|  | +    /* Check copy_file_range called with the correct arguments works. */
 | ||||||
|  | +    do {
 | ||||||
|  | +        ret = copy_file_range(fd_in, NULL, fd_out, NULL, len, 0);
 | ||||||
|  | +        if (ret == -1) {
 | ||||||
|  | +            perror("copy_file_range");
 | ||||||
|  | +            exit(EXIT_FAILURE);
 | ||||||
|  | +        }
 | ||||||
|  | +
 | ||||||
|  | +        len -= ret;
 | ||||||
|  | +    } while (len > 0);
 | ||||||
|  | +
 | ||||||
|  | +    /* Check valgrind will produce expected warnings for the
 | ||||||
|  | +       various wrong arguments. */
 | ||||||
|  | +    do {
 | ||||||
|  | +        void *t;
 | ||||||
|  | +        void *z = (void *) -1;
 | ||||||
|  | +
 | ||||||
|  | +        ret = copy_file_range(fd_in, t, fd_out, NULL, len, 0);
 | ||||||
|  | +        ret = copy_file_range(fd_in, NULL, fd_out, z, len, 0);
 | ||||||
|  | +        ret = copy_file_range(- 1, NULL, - 1, NULL, len, 0);
 | ||||||
|  | +    } while (0);
 | ||||||
|  | +
 | ||||||
|  | +    close(fd_in);
 | ||||||
|  | +    close(fd_out);
 | ||||||
|  | +    unlink("copy_file_range_source");
 | ||||||
|  | +    unlink("copy_file_range_dest");
 | ||||||
|  | +    exit(EXIT_SUCCESS);
 | ||||||
|  | +}
 | ||||||
|  | diff --git a/memcheck/tests/linux/sys-copy_file_range.stderr.exp b/memcheck/tests/linux/sys-copy_file_range.stderr.exp
 | ||||||
|  | new file mode 100644 | ||||||
|  | index 0000000..1aa4dc2
 | ||||||
|  | --- /dev/null
 | ||||||
|  | +++ b/memcheck/tests/linux/sys-copy_file_range.stderr.exp
 | ||||||
|  | @@ -0,0 +1,21 @@
 | ||||||
|  | +
 | ||||||
|  | +Syscall param copy_file_range("off_in") contains uninitialised byte(s)
 | ||||||
|  | +   ...
 | ||||||
|  | +   by 0x........: main (sys-copy_file_range.c:57)
 | ||||||
|  | +
 | ||||||
|  | +Syscall param copy_file_range(off_out) points to unaddressable byte(s)
 | ||||||
|  | +   ...
 | ||||||
|  | +   by 0x........: main (sys-copy_file_range.c:58)
 | ||||||
|  | + Address 0x........ is not stack'd, malloc'd or (recently) free'd
 | ||||||
|  | +
 | ||||||
|  | +Warning: invalid file descriptor -1 in syscall copy_file_range(fd_in)()
 | ||||||
|  | +
 | ||||||
|  | +HEAP SUMMARY:
 | ||||||
|  | +    in use at exit: 0 bytes in 0 blocks
 | ||||||
|  | +  total heap usage: 0 allocs, 0 frees, 0 bytes allocated
 | ||||||
|  | +
 | ||||||
|  | +For a detailed leak analysis, rerun with: --leak-check=full
 | ||||||
|  | +
 | ||||||
|  | +Use --track-origins=yes to see where uninitialised values come from
 | ||||||
|  | +For lists of detected and suppressed errors, rerun with: -s
 | ||||||
|  | +ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
 | ||||||
|  | diff --git a/memcheck/tests/linux/sys-copy_file_range.vgtest b/memcheck/tests/linux/sys-copy_file_range.vgtest
 | ||||||
|  | new file mode 100644 | ||||||
|  | index 0000000..b7741e8
 | ||||||
|  | --- /dev/null
 | ||||||
|  | +++ b/memcheck/tests/linux/sys-copy_file_range.vgtest
 | ||||||
|  | @@ -0,0 +1,2 @@
 | ||||||
|  | +prereq: test -e sys-copy_file_range
 | ||||||
|  | +prog: sys-copy_file_range
 | ||||||
|  | commit bd27ad3ff31555484b7fdb310c4b033620882e44 | ||||||
|  | Author: Mark Wielaard <mark@klomp.org> | ||||||
|  | Date:   Sun May 5 16:01:41 2019 +0200 | ||||||
|  | 
 | ||||||
|  |     Hook linux copy_file_range syscall on arm. | ||||||
|  | 
 | ||||||
|  | diff --git a/coregrind/m_syswrap/syswrap-arm-linux.c b/coregrind/m_syswrap/syswrap-arm-linux.c
 | ||||||
|  | index 9f1bdab..9ba0665 100644
 | ||||||
|  | --- a/coregrind/m_syswrap/syswrap-arm-linux.c
 | ||||||
|  | +++ b/coregrind/m_syswrap/syswrap-arm-linux.c
 | ||||||
|  | @@ -1016,6 +1016,8 @@ static SyscallTableEntry syscall_main_table[] = {
 | ||||||
|  |     LINXY(__NR_getrandom,         sys_getrandom),        // 384 | ||||||
|  |     LINXY(__NR_memfd_create,      sys_memfd_create),     // 385 | ||||||
|  |   | ||||||
|  | +   LINX_(__NR_copy_file_range,   sys_copy_file_range),  // 391
 | ||||||
|  | +
 | ||||||
|  |     LINXY(__NR_statx,             sys_statx),            // 397 | ||||||
|  |  }; | ||||||
|  |   | ||||||
|  | commit c212b72a63e43be323a4e028bbdbe8b023c22be8 | ||||||
|  | Author: Mark Wielaard <mark@klomp.org> | ||||||
|  | Date:   Wed May 15 21:30:00 2019 +0200 | ||||||
|  | 
 | ||||||
|  |     Explicitly make testcase variable for sys-copy_file_range undefined. | ||||||
|  |      | ||||||
|  |     On some systems an extra warning could occur when a variable in | ||||||
|  |     the memcheck/tests/linux/sys-copy_file_range testcase was undefined, | ||||||
|  |     but (accidentially) pointed to known bad memory. Fix by defining the | ||||||
|  |     variable as 0, but then marking it explicitly undefined using memcheck | ||||||
|  |     VALGRIND_MAKE_MEM_UNDEFINED. | ||||||
|  |      | ||||||
|  |     Followup for https://bugs.kde.org/show_bug.cgi?id=407218 | ||||||
|  | 
 | ||||||
|  | diff --git a/memcheck/tests/linux/sys-copy_file_range.c b/memcheck/tests/linux/sys-copy_file_range.c
 | ||||||
|  | index 83981c6..589399c 100644
 | ||||||
|  | --- a/memcheck/tests/linux/sys-copy_file_range.c
 | ||||||
|  | +++ b/memcheck/tests/linux/sys-copy_file_range.c
 | ||||||
|  | @@ -3,8 +3,8 @@
 | ||||||
|  |  #include <stdio.h> | ||||||
|  |  #include <stdlib.h> | ||||||
|  |  #include <sys/stat.h> | ||||||
|  | -#include <sys/syscall.h>
 | ||||||
|  |  #include <unistd.h> | ||||||
|  | +#include "../../memcheck.h"
 | ||||||
|  |   | ||||||
|  |  int main(int argc, char **argv) | ||||||
|  |  { | ||||||
|  | @@ -51,7 +51,7 @@ int main(int argc, char **argv)
 | ||||||
|  |      /* Check valgrind will produce expected warnings for the | ||||||
|  |         various wrong arguments. */ | ||||||
|  |      do { | ||||||
|  | -        void *t;
 | ||||||
|  | +        void *t = 0; VALGRIND_MAKE_MEM_UNDEFINED (&t, sizeof (void *));
 | ||||||
|  |          void *z = (void *) -1; | ||||||
|  |   | ||||||
|  |          ret = copy_file_range(fd_in, t, fd_out, NULL, len, 0); | ||||||
|  | commit 033d013bebeb3471c0da47060deb9a5771e6c913 | ||||||
|  | Author: Mark Wielaard <mark@klomp.org> | ||||||
|  | Date:   Fri May 24 21:51:31 2019 +0200 | ||||||
|  | 
 | ||||||
|  |     Fix memcheck/tests/linux/sys-copy_file_range open call (mode). | ||||||
|  |      | ||||||
|  |     sys-copy_file_range.c calls open with O_CREAT flag and so must provide | ||||||
|  |     a mode argument. valgrind memcheck actually caught this ommission on | ||||||
|  |     some arches (fedora rawhide i686 specifically). | ||||||
|  |      | ||||||
|  |     This is a small additional fixup for | ||||||
|  |     https://bugs.kde.org/show_bug.cgi?id=407218 | ||||||
|  | 
 | ||||||
|  | diff --git a/memcheck/tests/linux/sys-copy_file_range.c b/memcheck/tests/linux/sys-copy_file_range.c
 | ||||||
|  | index 589399c..3022fa1 100644
 | ||||||
|  | --- a/memcheck/tests/linux/sys-copy_file_range.c
 | ||||||
|  | +++ b/memcheck/tests/linux/sys-copy_file_range.c
 | ||||||
|  | @@ -12,7 +12,7 @@ int main(int argc, char **argv)
 | ||||||
|  |      struct stat stat; | ||||||
|  |      loff_t len, ret; | ||||||
|  |   | ||||||
|  | -    fd_in = open("copy_file_range_source", O_CREAT | O_RDWR);
 | ||||||
|  | +    fd_in = open("copy_file_range_source", O_CREAT | O_RDWR, 0644);
 | ||||||
|  |      if (fd_in == -1) { | ||||||
|  |          perror("open copy_file_range_source"); | ||||||
|  |          exit(EXIT_FAILURE); | ||||||
							
								
								
									
										34
									
								
								SOURCES/valgrind-3.15.0-disable-s390x-z13.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								SOURCES/valgrind-3.15.0-disable-s390x-z13.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,34 @@ | |||||||
|  | diff -ur valgrind-3.14.0.orig/VEX/priv/guest_s390_helpers.c valgrind-3.14.0/VEX/priv/guest_s390_helpers.c
 | ||||||
|  | --- valgrind-3.14.0.orig/VEX/priv/guest_s390_helpers.c	2019-01-10 17:00:57.203206690 +0100
 | ||||||
|  | +++ valgrind-3.14.0/VEX/priv/guest_s390_helpers.c	2019-01-10 17:06:23.335253900 +0100
 | ||||||
|  | @@ -2469,7 +2469,7 @@
 | ||||||
|  |  /*--- Dirty helper for vector instructions                 ---*/ | ||||||
|  |  /*------------------------------------------------------------*/ | ||||||
|  |   | ||||||
|  | -#if defined(VGA_s390x)
 | ||||||
|  | +#if defined(VGA_s390x) && 0 /* disable for old binutils */
 | ||||||
|  |  ULong | ||||||
|  |  s390x_dirtyhelper_vec_op(VexGuestS390XState *guest_state, | ||||||
|  |                           const ULong serialized) | ||||||
|  | diff -ur valgrind-3.14.0.orig/none/tests/s390x/Makefile.am valgrind-3.14.0/none/tests/s390x/Makefile.am
 | ||||||
|  | --- valgrind-3.14.0.orig/none/tests/s390x/Makefile.am	2019-01-10 17:00:57.411202894 +0100
 | ||||||
|  | +++ valgrind-3.14.0/none/tests/s390x/Makefile.am	2019-01-10 17:10:28.963776813 +0100
 | ||||||
|  | @@ -18,8 +18,7 @@
 | ||||||
|  |  	     spechelper-cr  spechelper-clr  \ | ||||||
|  |  	     spechelper-ltr spechelper-or   \ | ||||||
|  |  	     spechelper-icm-1  spechelper-icm-2 spechelper-tmll \ | ||||||
|  | -	     spechelper-tm laa vector lsc2 ppno vector_string vector_integer \
 | ||||||
|  | -	     vector_float
 | ||||||
|  | +	     spechelper-tm laa 
 | ||||||
|  |   | ||||||
|  |  if BUILD_DFP_TESTS | ||||||
|  |    INSN_TESTS += dfp-1 dfp-2 dfp-3 dfp-4 dfptest dfpext dfpconv srnmt pfpo | ||||||
|  | @@ -68,8 +67,3 @@
 | ||||||
|  |  fixbr_CFLAGS     = $(AM_CFLAGS) @FLAG_MLONG_DOUBLE_128@ | ||||||
|  |  fpext_CFLAGS     = $(AM_CFLAGS) @FLAG_MLONG_DOUBLE_128@ | ||||||
|  |  ex_clone_LDADD   = -lpthread | ||||||
|  | -vector_CFLAGS    = $(AM_CFLAGS) -march=z13
 | ||||||
|  | -lsc2_CFLAGS       = -march=z13 -DS390_TESTS_NOCOLOR
 | ||||||
|  | -vector_string_CFLAGS = $(AM_CFLAGS) -march=z13 -DS390_TEST_COUNT=5
 | ||||||
|  | -vector_integer_CFLAGS    = $(AM_CFLAGS) -march=z13 -DS390_TEST_COUNT=4
 | ||||||
|  | -vector_float_CFLAGS    = $(AM_CFLAGS) -march=z13 -DS390_TEST_COUNT=4
 | ||||||
							
								
								
									
										29
									
								
								SOURCES/valgrind-3.15.0-exp-sgcheck-no-aarch64.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								SOURCES/valgrind-3.15.0-exp-sgcheck-no-aarch64.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,29 @@ | |||||||
|  | commit 59784c512ec40e588b21cf5ae8e31e9c4f99d6b8 | ||||||
|  | Author: Mark Wielaard <mark@klomp.org> | ||||||
|  | Date:   Sat May 18 14:55:50 2019 +0200 | ||||||
|  | 
 | ||||||
|  |     aarch64 (arm64) isn't a supported architecture for exp-sgcheck. | ||||||
|  |      | ||||||
|  |     exp-sgcheck/pc_main.c contains: | ||||||
|  |      | ||||||
|  |        #if defined(VGA_arm) || defined(VGA_arm64) | ||||||
|  |           VG_(printf)("SGCheck doesn't work on ARM yet, sorry.\n"); | ||||||
|  |           VG_(exit)(1); | ||||||
|  |        #endif | ||||||
|  |      | ||||||
|  |     But exp-sgcheck/tests/is_arch_supported checked against uname -m | ||||||
|  |     which returns aarch64 (not arm64). Fix the test check so the | ||||||
|  |     exp-sgcheck tests are skipped instead of producing failures. | ||||||
|  | 
 | ||||||
|  | diff --git a/exp-sgcheck/tests/is_arch_supported b/exp-sgcheck/tests/is_arch_supported
 | ||||||
|  | index 818cc61..d4c6191 100755
 | ||||||
|  | --- a/exp-sgcheck/tests/is_arch_supported
 | ||||||
|  | +++ b/exp-sgcheck/tests/is_arch_supported
 | ||||||
|  | @@ -10,6 +10,6 @@
 | ||||||
|  |  # architectures. | ||||||
|  |   | ||||||
|  |  case `uname -m` in | ||||||
|  | -  ppc*|arm*|s390x|mips*) exit 1;;
 | ||||||
|  | +  ppc*|aarch64|arm*|s390x|mips*) exit 1;;
 | ||||||
|  |    *)         exit 0;; | ||||||
|  |  esac | ||||||
							
								
								
									
										226
									
								
								SOURCES/valgrind-3.15.0-pkey.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										226
									
								
								SOURCES/valgrind-3.15.0-pkey.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,226 @@ | |||||||
|  | commit b064131bdf099d3647b4501e5d15391e1e9623e6 | ||||||
|  | Author: Mark Wielaard <mark@klomp.org> | ||||||
|  | Date:   Thu May 30 00:29:58 2019 +0200 | ||||||
|  | 
 | ||||||
|  |     linux x86 and amd64 memory protection key syscalls. | ||||||
|  |      | ||||||
|  |     This implements minimal support for the pkey_alloc, pkey_free and | ||||||
|  |     pkey_mprotect syscalls. pkey_alloc will simply indicate that pkeys | ||||||
|  |     are not supported. pkey_free always fails. pkey_mprotect works just | ||||||
|  |     like mprotect if the special pkey -1 is provided. | ||||||
|  |      | ||||||
|  |     https://bugs.kde.org/show_bug.cgi?id=408091 | ||||||
|  | 
 | ||||||
|  | diff --git a/coregrind/m_syswrap/priv_syswrap-generic.h b/coregrind/m_syswrap/priv_syswrap-generic.h
 | ||||||
|  | index 88530f0..3e1c8b6 100644
 | ||||||
|  | --- a/coregrind/m_syswrap/priv_syswrap-generic.h
 | ||||||
|  | +++ b/coregrind/m_syswrap/priv_syswrap-generic.h
 | ||||||
|  | @@ -106,6 +106,10 @@ extern Bool
 | ||||||
|  |  ML_(handle_auxv_open)(SyscallStatus *status, const HChar *filename, | ||||||
|  |                        int flags); | ||||||
|  |   | ||||||
|  | +/* Helper function for generic mprotect and linux pkey_mprotect. */
 | ||||||
|  | +extern void handle_sys_mprotect (ThreadId tid, SyscallStatus *status,
 | ||||||
|  | +                                 Addr *addr, SizeT *len, Int *prot);
 | ||||||
|  | +
 | ||||||
|  |  DECL_TEMPLATE(generic, sys_ni_syscall);            // * P -- unimplemented | ||||||
|  |  DECL_TEMPLATE(generic, sys_exit); | ||||||
|  |  DECL_TEMPLATE(generic, sys_fork); | ||||||
|  | diff --git a/coregrind/m_syswrap/priv_syswrap-linux.h b/coregrind/m_syswrap/priv_syswrap-linux.h
 | ||||||
|  | index 5cf5407..2471524 100644
 | ||||||
|  | --- a/coregrind/m_syswrap/priv_syswrap-linux.h
 | ||||||
|  | +++ b/coregrind/m_syswrap/priv_syswrap-linux.h
 | ||||||
|  | @@ -299,6 +299,11 @@ DECL_TEMPLATE(linux, sys_bpf);
 | ||||||
|  |  // Linux-specific (new in Linux 4.11) | ||||||
|  |  DECL_TEMPLATE(linux, sys_statx); | ||||||
|  |   | ||||||
|  | +// Linux-specific memory protection key syscalls (since Linux 4.9)
 | ||||||
|  | +DECL_TEMPLATE(linux, sys_pkey_alloc);
 | ||||||
|  | +DECL_TEMPLATE(linux, sys_pkey_free);
 | ||||||
|  | +DECL_TEMPLATE(linux, sys_pkey_mprotect);
 | ||||||
|  | +
 | ||||||
|  |  /* --------------------------------------------------------------------- | ||||||
|  |     Wrappers for sockets and ipc-ery.  These are split into standalone | ||||||
|  |     procedures because x86-linux hides them inside multiplexors | ||||||
|  | diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c
 | ||||||
|  | index d4fe413..2d6b95f 100644
 | ||||||
|  | --- a/coregrind/m_syswrap/syswrap-amd64-linux.c
 | ||||||
|  | +++ b/coregrind/m_syswrap/syswrap-amd64-linux.c
 | ||||||
|  | @@ -863,6 +863,10 @@ static SyscallTableEntry syscall_table[] = {
 | ||||||
|  |     LINX_(__NR_membarrier,        sys_membarrier),        // 324 | ||||||
|  |   | ||||||
|  |     LINX_(__NR_copy_file_range,   sys_copy_file_range),   // 326 | ||||||
|  | +
 | ||||||
|  | +   LINXY(__NR_pkey_mprotect,     sys_pkey_mprotect),     // 329
 | ||||||
|  | +   LINX_(__NR_pkey_alloc,        sys_pkey_alloc),        // 330
 | ||||||
|  | +   LINX_(__NR_pkey_free,         sys_pkey_free),         // 331
 | ||||||
|  |  }; | ||||||
|  |   | ||||||
|  |  SyscallTableEntry* ML_(get_linux_syscall_entry) ( UInt sysno ) | ||||||
|  | diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c
 | ||||||
|  | index 0b64919..01191f6 100644
 | ||||||
|  | --- a/coregrind/m_syswrap/syswrap-generic.c
 | ||||||
|  | +++ b/coregrind/m_syswrap/syswrap-generic.c
 | ||||||
|  | @@ -3842,12 +3842,28 @@ PRE(sys_mprotect)
 | ||||||
|  |     PRE_REG_READ3(long, "mprotect", | ||||||
|  |                   unsigned long, addr, vki_size_t, len, unsigned long, prot); | ||||||
|  |   | ||||||
|  | -   if (!ML_(valid_client_addr)(ARG1, ARG2, tid, "mprotect")) {
 | ||||||
|  | +   Addr addr = ARG1;
 | ||||||
|  | +   SizeT len = ARG2;
 | ||||||
|  | +   Int prot  = ARG3;
 | ||||||
|  | +
 | ||||||
|  | +   handle_sys_mprotect (tid, status, &addr, &len, &prot);
 | ||||||
|  | +
 | ||||||
|  | +   ARG1 = addr;
 | ||||||
|  | +   ARG2 = len;
 | ||||||
|  | +   ARG3 = prot;
 | ||||||
|  | +}
 | ||||||
|  | +/* This will be called from the generic mprotect, or the linux specific
 | ||||||
|  | +   pkey_mprotect. Pass pointers to ARG1, ARG2 and ARG3 as addr, len and prot,
 | ||||||
|  | +   they might be adjusted and have to assigned back to ARG1, ARG2 and ARG3.  */
 | ||||||
|  | +void handle_sys_mprotect(ThreadId tid, SyscallStatus* status,
 | ||||||
|  | +                         Addr *addr, SizeT *len, Int *prot)
 | ||||||
|  | +{
 | ||||||
|  | +   if (!ML_(valid_client_addr)(*addr, *len, tid, "mprotect")) {
 | ||||||
|  |        SET_STATUS_Failure( VKI_ENOMEM ); | ||||||
|  |     }  | ||||||
|  |  #if defined(VKI_PROT_GROWSDOWN) | ||||||
|  |     else  | ||||||
|  | -   if (ARG3 & (VKI_PROT_GROWSDOWN|VKI_PROT_GROWSUP)) {
 | ||||||
|  | +   if (*prot & (VKI_PROT_GROWSDOWN|VKI_PROT_GROWSUP)) {
 | ||||||
|  |        /* Deal with mprotects on growable stack areas. | ||||||
|  |   | ||||||
|  |           The critical files to understand all this are mm/mprotect.c | ||||||
|  | @@ -3862,8 +3878,8 @@ PRE(sys_mprotect)
 | ||||||
|  |   | ||||||
|  |           The sanity check provided by the kernel is that the vma must | ||||||
|  |           have the VM_GROWSDOWN/VM_GROWSUP flag set as appropriate.  */ | ||||||
|  | -      UInt grows = ARG3 & (VKI_PROT_GROWSDOWN|VKI_PROT_GROWSUP);
 | ||||||
|  | -      NSegment const *aseg = VG_(am_find_nsegment)(ARG1);
 | ||||||
|  | +      UInt grows = *prot & (VKI_PROT_GROWSDOWN|VKI_PROT_GROWSUP);
 | ||||||
|  | +      NSegment const *aseg = VG_(am_find_nsegment)(*addr);
 | ||||||
|  |        NSegment const *rseg; | ||||||
|  |   | ||||||
|  |        vg_assert(aseg); | ||||||
|  | @@ -3874,10 +3890,10 @@ PRE(sys_mprotect)
 | ||||||
|  |               && rseg->kind == SkResvn | ||||||
|  |               && rseg->smode == SmUpper | ||||||
|  |               && rseg->end+1 == aseg->start) { | ||||||
|  | -            Addr end = ARG1 + ARG2;
 | ||||||
|  | -            ARG1 = aseg->start;
 | ||||||
|  | -            ARG2 = end - aseg->start;
 | ||||||
|  | -            ARG3 &= ~VKI_PROT_GROWSDOWN;
 | ||||||
|  | +            Addr end = *addr + *len;
 | ||||||
|  | +            *addr = aseg->start;
 | ||||||
|  | +            *len = end - aseg->start;
 | ||||||
|  | +            *prot &= ~VKI_PROT_GROWSDOWN;
 | ||||||
|  |           } else { | ||||||
|  |              SET_STATUS_Failure( VKI_EINVAL ); | ||||||
|  |           } | ||||||
|  | @@ -3887,8 +3903,8 @@ PRE(sys_mprotect)
 | ||||||
|  |               && rseg->kind == SkResvn | ||||||
|  |               && rseg->smode == SmLower | ||||||
|  |               && aseg->end+1 == rseg->start) { | ||||||
|  | -            ARG2 = aseg->end - ARG1 + 1;
 | ||||||
|  | -            ARG3 &= ~VKI_PROT_GROWSUP;
 | ||||||
|  | +            *len = aseg->end - *addr + 1;
 | ||||||
|  | +            *prot &= ~VKI_PROT_GROWSUP;
 | ||||||
|  |           } else { | ||||||
|  |              SET_STATUS_Failure( VKI_EINVAL ); | ||||||
|  |           } | ||||||
|  | diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c
 | ||||||
|  | index 810ca24..5452b8d 100644
 | ||||||
|  | --- a/coregrind/m_syswrap/syswrap-linux.c
 | ||||||
|  | +++ b/coregrind/m_syswrap/syswrap-linux.c
 | ||||||
|  | @@ -12120,6 +12120,76 @@ PRE(sys_copy_file_range)
 | ||||||
|  |    } | ||||||
|  |  } | ||||||
|  |   | ||||||
|  | +PRE(sys_pkey_alloc)
 | ||||||
|  | +{
 | ||||||
|  | +  PRINT("pkey_alloc (%lu, %lu)", ARG1, ARG2);
 | ||||||
|  | +
 | ||||||
|  | +  PRE_REG_READ2(long, "pkey_alloc",
 | ||||||
|  | +                unsigned long, "flags",
 | ||||||
|  | +                unsigned long, "access_rights");
 | ||||||
|  | +
 | ||||||
|  | +  /* The kernel says: pkey_alloc() is always safe to call regardless of
 | ||||||
|  | +     whether or not the operating system supports protection keys.  It can be
 | ||||||
|  | +     used in lieu of any other mechanism for detecting pkey support and will
 | ||||||
|  | +     simply fail with the error ENOSPC if the operating system has no pkey
 | ||||||
|  | +     support.
 | ||||||
|  | +
 | ||||||
|  | +     So we simply always return ENOSPC to signal memory protection keys are
 | ||||||
|  | +     not supported under valgrind, unless there are unknown flags, then we
 | ||||||
|  | +     return EINVAL. */
 | ||||||
|  | +  unsigned long pkey_flags = ARG1;
 | ||||||
|  | +  if (pkey_flags != 0)
 | ||||||
|  | +     SET_STATUS_Failure( VKI_EINVAL );
 | ||||||
|  | +  else
 | ||||||
|  | +     SET_STATUS_Failure( VKI_ENOSPC );
 | ||||||
|  | +}
 | ||||||
|  | +
 | ||||||
|  | +PRE(sys_pkey_free)
 | ||||||
|  | +{
 | ||||||
|  | +  PRINT("pkey_free (%" FMT_REGWORD "u )", ARG1);
 | ||||||
|  | +
 | ||||||
|  | +  PRE_REG_READ1(long, "pkey_free",
 | ||||||
|  | +                unsigned long, "pkey");
 | ||||||
|  | +
 | ||||||
|  | +  /* Since pkey_alloc () can never succeed, see above, freeing any pkey is
 | ||||||
|  | +     always an error.  */
 | ||||||
|  | +  SET_STATUS_Failure( VKI_EINVAL );
 | ||||||
|  | +}
 | ||||||
|  | +
 | ||||||
|  | +PRE(sys_pkey_mprotect)
 | ||||||
|  | +{
 | ||||||
|  | +   PRINT("sys_pkey_mprotect ( %#" FMT_REGWORD "x, %" FMT_REGWORD "u, %"
 | ||||||
|  | +         FMT_REGWORD "u %" FMT_REGWORD "u )", ARG1, ARG2, ARG3, ARG4);
 | ||||||
|  | +   PRE_REG_READ4(long, "pkey_mprotect",
 | ||||||
|  | +                 unsigned long, addr, vki_size_t, len, unsigned long, prot,
 | ||||||
|  | +                 unsigned long, pkey);
 | ||||||
|  | +
 | ||||||
|  | +   Addr  addr = ARG1;
 | ||||||
|  | +   SizeT len  = ARG2;
 | ||||||
|  | +   Int   prot = ARG3;
 | ||||||
|  | +   Int   pkey = ARG4;
 | ||||||
|  | +
 | ||||||
|  | +   /* Since pkey_alloc () can never succeed, see above, any pkey is
 | ||||||
|  | +      invalid. Except for -1, then pkey_mprotect acts just like mprotect.  */
 | ||||||
|  | +   if (pkey != -1)
 | ||||||
|  | +      SET_STATUS_Failure( VKI_EINVAL );
 | ||||||
|  | +   else
 | ||||||
|  | +      handle_sys_mprotect (tid, status, &addr, &len, &prot);
 | ||||||
|  | +
 | ||||||
|  | +   ARG1 = addr;
 | ||||||
|  | +   ARG2 = len;
 | ||||||
|  | +   ARG3 = prot;
 | ||||||
|  | +}
 | ||||||
|  | +
 | ||||||
|  | +POST(sys_pkey_mprotect)
 | ||||||
|  | +{
 | ||||||
|  | +   Addr  addr = ARG1;
 | ||||||
|  | +   SizeT len  = ARG2;
 | ||||||
|  | +   Int   prot = ARG3;
 | ||||||
|  | +
 | ||||||
|  | +   ML_(notify_core_and_tool_of_mprotect)(addr, len, prot);
 | ||||||
|  | +}
 | ||||||
|  | +
 | ||||||
|  |   | ||||||
|  |  #undef PRE | ||||||
|  |  #undef POST | ||||||
|  | diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c
 | ||||||
|  | index ad54cf6..3829fa4 100644
 | ||||||
|  | --- a/coregrind/m_syswrap/syswrap-x86-linux.c
 | ||||||
|  | +++ b/coregrind/m_syswrap/syswrap-x86-linux.c
 | ||||||
|  | @@ -1608,6 +1608,9 @@ static SyscallTableEntry syscall_table[] = {
 | ||||||
|  |   | ||||||
|  |     LINX_(__NR_copy_file_range,   sys_copy_file_range),   // 377 | ||||||
|  |   | ||||||
|  | +   LINXY(__NR_pkey_mprotect,     sys_pkey_mprotect),    // 380
 | ||||||
|  | +   LINX_(__NR_pkey_alloc,        sys_pkey_alloc),       // 381
 | ||||||
|  | +   LINX_(__NR_pkey_free,         sys_pkey_free),        // 382
 | ||||||
|  |     LINXY(__NR_statx,             sys_statx),            // 383 | ||||||
|  |   | ||||||
|  |     /* Explicitly not supported on i386 yet. */ | ||||||
							
								
								
									
										117
									
								
								SOURCES/valgrind-3.15.0-pkglibexecdir.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										117
									
								
								SOURCES/valgrind-3.15.0-pkglibexecdir.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,117 @@ | |||||||
|  | diff --git a/Makefile.all.am b/Makefile.all.am
 | ||||||
|  | index 3786e34..1befef5 100644
 | ||||||
|  | --- a/Makefile.all.am
 | ||||||
|  | +++ b/Makefile.all.am
 | ||||||
|  | @@ -50,20 +50,20 @@ inplace-noinst_DSYMS: build-noinst_DSYMS
 | ||||||
|  |  	done | ||||||
|  |   | ||||||
|  |  # This is used by coregrind/Makefile.am and by <tool>/Makefile.am for doing | ||||||
|  | -# "make install".  It copies $(noinst_PROGRAMS) into $prefix/lib/valgrind/.
 | ||||||
|  | +# "make install".  It copies $(noinst_PROGRAMS) into $prefix/libexec/valgrind/.
 | ||||||
|  |  # It needs to be depended on by an 'install-exec-local' rule. | ||||||
|  |  install-noinst_PROGRAMS: $(noinst_PROGRAMS) | ||||||
|  | -	$(mkinstalldirs) $(DESTDIR)$(pkglibdir); \
 | ||||||
|  | +	$(mkinstalldirs) $(DESTDIR)$(pkglibexecdir); \
 | ||||||
|  |  	for f in $(noinst_PROGRAMS); do \ | ||||||
|  | -	  $(INSTALL_PROGRAM) $$f $(DESTDIR)$(pkglibdir); \
 | ||||||
|  | +	  $(INSTALL_PROGRAM) $$f $(DESTDIR)$(pkglibexecdir); \
 | ||||||
|  |  	done | ||||||
|  |   | ||||||
|  |  # This is used by coregrind/Makefile.am and by <tool>/Makefile.am for doing | ||||||
|  | -# "make uninstall".  It removes $(noinst_PROGRAMS) from $prefix/lib/valgrind/.
 | ||||||
|  | +# "make uninstall".  It removes $(noinst_PROGRAMS) from $prefix/libexec/valgrind/.
 | ||||||
|  |  # It needs to be depended on by an 'uninstall-local' rule. | ||||||
|  |  uninstall-noinst_PROGRAMS: | ||||||
|  |  	for f in $(noinst_PROGRAMS); do \ | ||||||
|  | -	  rm -f $(DESTDIR)$(pkglibdir)/$$f; \
 | ||||||
|  | +	  rm -f $(DESTDIR)$(pkglibexecdir)/$$f; \
 | ||||||
|  |  	done | ||||||
|  |   | ||||||
|  |  # Similar to install-noinst_PROGRAMS. | ||||||
|  | @@ -71,15 +71,15 @@ uninstall-noinst_PROGRAMS:
 | ||||||
|  |  # directories.  XXX: not sure whether the resulting permissions will be | ||||||
|  |  # correct when using 'cp -R'... | ||||||
|  |  install-noinst_DSYMS: build-noinst_DSYMS | ||||||
|  | -	$(mkinstalldirs) $(DESTDIR)$(pkglibdir); \
 | ||||||
|  | +	$(mkinstalldirs) $(DESTDIR)$(pkglibexecdir); \
 | ||||||
|  |  	for f in $(noinst_DSYMS); do \ | ||||||
|  | -	  cp -R $$f.dSYM $(DESTDIR)$(pkglibdir); \
 | ||||||
|  | +	  cp -R $$f.dSYM $(DESTDIR)$(pkglibexecdir); \
 | ||||||
|  |  	done | ||||||
|  |   | ||||||
|  |  # Similar to uninstall-noinst_PROGRAMS. | ||||||
|  |  uninstall-noinst_DSYMS: | ||||||
|  |  	for f in $(noinst_DSYMS); do \ | ||||||
|  | -	  rm -f $(DESTDIR)$(pkglibdir)/$$f.dSYM; \
 | ||||||
|  | +	  rm -f $(DESTDIR)$(pkglibexecdir)/$$f.dSYM; \
 | ||||||
|  |  	done | ||||||
|  |   | ||||||
|  |  # This needs to be depended on by a 'clean-local' rule. | ||||||
|  | diff --git a/Makefile.am b/Makefile.am
 | ||||||
|  | index 242b38a..3b7c806 100644
 | ||||||
|  | --- a/Makefile.am
 | ||||||
|  | +++ b/Makefile.am
 | ||||||
|  | @@ -58,7 +58,7 @@ DEFAULT_SUPP_FILES = @DEFAULT_SUPP@
 | ||||||
|  |  # default.supp, as it is built from the base .supp files at compile-time. | ||||||
|  |  dist_noinst_DATA = $(SUPP_FILES) | ||||||
|  |   | ||||||
|  | -vglibdir = $(pkglibdir)
 | ||||||
|  | +vglibdir = $(pkglibexecdir)
 | ||||||
|  |  vglib_DATA = default.supp | ||||||
|  |   | ||||||
|  |  pkgconfigdir = $(libdir)/pkgconfig | ||||||
|  | diff --git a/coregrind/Makefile.am b/coregrind/Makefile.am
 | ||||||
|  | index 94030fd..f09763a 100644
 | ||||||
|  | --- a/coregrind/Makefile.am
 | ||||||
|  | +++ b/coregrind/Makefile.am
 | ||||||
|  | @@ -11,12 +11,12 @@ include $(top_srcdir)/Makefile.all.am
 | ||||||
|  |   | ||||||
|  |  AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@ += \ | ||||||
|  |  	-I$(top_srcdir)/coregrind \ | ||||||
|  | -	-DVG_LIBDIR="\"$(pkglibdir)"\" \
 | ||||||
|  | +	-DVG_LIBDIR="\"$(pkglibexecdir)"\" \
 | ||||||
|  |  	-DVG_PLATFORM="\"@VGCONF_ARCH_PRI@-@VGCONF_OS@\"" | ||||||
|  |  if VGCONF_HAVE_PLATFORM_SEC | ||||||
|  |  AM_CPPFLAGS_@VGCONF_PLATFORM_SEC_CAPS@ += \ | ||||||
|  |  	-I$(top_srcdir)/coregrind \ | ||||||
|  | -	-DVG_LIBDIR="\"$(pkglibdir)"\" \
 | ||||||
|  | +	-DVG_LIBDIR="\"$(pkglibexecdir)"\" \
 | ||||||
|  |  	-DVG_PLATFORM="\"@VGCONF_ARCH_SEC@-@VGCONF_OS@\"" | ||||||
|  |  endif | ||||||
|  |   | ||||||
|  | @@ -714,7 +714,7 @@ GDBSERVER_XML_FILES = \
 | ||||||
|  |  	m_gdbserver/mips64-fpu.xml | ||||||
|  |   | ||||||
|  |  # so as to make sure these get copied into the install tree | ||||||
|  | -vglibdir = $(pkglibdir)
 | ||||||
|  | +vglibdir = $(pkglibexecdir)
 | ||||||
|  |  vglib_DATA  = $(GDBSERVER_XML_FILES) | ||||||
|  |   | ||||||
|  |  # so as to make sure these get copied into the tarball | ||||||
|  | diff --git a/mpi/Makefile.am b/mpi/Makefile.am
 | ||||||
|  | index 7ad9a25..471fee0 100644
 | ||||||
|  | --- a/mpi/Makefile.am
 | ||||||
|  | +++ b/mpi/Makefile.am
 | ||||||
|  | @@ -18,16 +18,18 @@ EXTRA_DIST = \
 | ||||||
|  |  # libmpiwrap-<platform>.so | ||||||
|  |  #---------------------------------------------------------------------------- | ||||||
|  |   | ||||||
|  | -noinst_PROGRAMS  =
 | ||||||
|  | +# These are really real libraries, so they should go to libdir, not libexec.
 | ||||||
|  | +mpidir = $(pkglibdir)
 | ||||||
|  | +mpi_PROGRAMS  =
 | ||||||
|  |  if BUILD_MPIWRAP_PRI | ||||||
|  | -noinst_PROGRAMS += libmpiwrap-@VGCONF_ARCH_PRI@-@VGCONF_OS@.so
 | ||||||
|  | +mpi_PROGRAMS += libmpiwrap-@VGCONF_ARCH_PRI@-@VGCONF_OS@.so
 | ||||||
|  |  endif | ||||||
|  |  if BUILD_MPIWRAP_SEC | ||||||
|  | -noinst_PROGRAMS += libmpiwrap-@VGCONF_ARCH_SEC@-@VGCONF_OS@.so
 | ||||||
|  | +mpi_PROGRAMS += libmpiwrap-@VGCONF_ARCH_SEC@-@VGCONF_OS@.so
 | ||||||
|  |  endif | ||||||
|  |   | ||||||
|  |  if VGCONF_OS_IS_DARWIN | ||||||
|  | -noinst_DSYMS = $(noinst_PROGRAMS)
 | ||||||
|  | +mpi_DSYMS = $(mpi_PROGRAMS)
 | ||||||
|  |  endif | ||||||
|  |   | ||||||
|  |   | ||||||
							
								
								
									
										22
									
								
								SOURCES/valgrind-3.15.0-ppc64-filter_gdb.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								SOURCES/valgrind-3.15.0-ppc64-filter_gdb.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,22 @@ | |||||||
|  | commit b1cc37ddb660afc536131227a9fb452ac9328972 | ||||||
|  | Author: Alexandra Hájková <ahajkova@redhat.com> | ||||||
|  | Date:   Mon Apr 15 15:34:12 2019 +0200 | ||||||
|  | 
 | ||||||
|  |     filter_gdb: add regexp to filter out names which starts with a "." | ||||||
|  |      | ||||||
|  |     such names are used for "function descriptors" on ppc64 | ||||||
|  |      | ||||||
|  |     https://bugs.kde.org/show_bug.cgi?id=406561 | ||||||
|  | 
 | ||||||
|  | diff --git a/gdbserver_tests/filter_gdb b/gdbserver_tests/filter_gdb
 | ||||||
|  | index 6eff229..fd2e8e7 100755
 | ||||||
|  | --- a/gdbserver_tests/filter_gdb
 | ||||||
|  | +++ b/gdbserver_tests/filter_gdb
 | ||||||
|  | @@ -119,6 +119,7 @@ sed -e '/Remote debugging using/,/vgdb launched process attached/d'
 | ||||||
|  |      -e 's/in select ()$/in syscall .../'                                                              \ | ||||||
|  |      -e 's/in \.__select ()$/in syscall .../'                                                          \ | ||||||
|  |      -e 's/in select () at \.\.\/sysdeps\/unix\/syscall-template\.S.*$/in syscall .../'                \ | ||||||
|  | +    -e 's/in \.__select () at \.\.\/sysdeps\/unix\/syscall-template\.S.*$/in syscall .../'            \
 | ||||||
|  |      -e '/^[ 	]*at \.\.\/sysdeps\/unix\/syscall-template\.S/d'                                      \ | ||||||
|  |      -e '/^[ 	]*in \.\.\/sysdeps\/unix\/syscall-template\.S/d'                                      \ | ||||||
|  |      -e '/^[1-9][0-9]*[ 	]*\.\.\/sysdeps\/unix\/syscall-template\.S/d'                                 \ | ||||||
							
								
								
									
										194
									
								
								SOURCES/valgrind-3.15.0-s390x-wrap-drd.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										194
									
								
								SOURCES/valgrind-3.15.0-s390x-wrap-drd.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,194 @@ | |||||||
|  | From bfa89eae00ba7067445bc0532e1f17405c062954 Mon Sep 17 00:00:00 2001 | ||||||
|  | From: Andreas Arnez <arnez@linux.ibm.com> | ||||||
|  | Date: Thu, 23 May 2019 17:17:43 +0200 | ||||||
|  | Subject: [PATCH] Bug 407764 - s390x: drd fails on z13 due to function wrapping | ||||||
|  |  issue | ||||||
|  | 
 | ||||||
|  | The s390x-specific inline assembly macros for function wrapping in | ||||||
|  | include/valgrind.h have a few issues. | ||||||
|  | 
 | ||||||
|  | When the compiler uses vector registers, such as with "-march=z13", all | ||||||
|  | vector registers must be declared as clobbered by the callee.  Because | ||||||
|  | this is missing, many drd test failures are seen with "-march=z13". | ||||||
|  | 
 | ||||||
|  | Also, the inline assemblies write the return value into the target | ||||||
|  | register before restoring r11.  If r11 is used as the target register, | ||||||
|  | this means that the restore operation corrupts the result.  This bug | ||||||
|  | causes failures with memcheck's "wrap6" test case. | ||||||
|  | 
 | ||||||
|  | These bugs are fixed.  The clobber list is extended by the vector | ||||||
|  | registers (if appropriate), and the target register is now written at the | ||||||
|  | end, after restoring r11. | ||||||
|  | ---
 | ||||||
|  |  include/valgrind.h | 38 +++++++++++++++++++++++--------------- | ||||||
|  |  1 file changed, 23 insertions(+), 15 deletions(-) | ||||||
|  | 
 | ||||||
|  | diff --git a/include/valgrind.h b/include/valgrind.h
 | ||||||
|  | index f071bd392..815efa893 100644
 | ||||||
|  | --- a/include/valgrind.h
 | ||||||
|  | +++ b/include/valgrind.h
 | ||||||
|  | @@ -4687,8 +4687,16 @@ typedef
 | ||||||
|  |     r14 in s390_irgen_noredir (VEX/priv/guest_s390_irgen.c) to give the | ||||||
|  |     function a proper return address. All others are ABI defined call | ||||||
|  |     clobbers. */ | ||||||
|  | -#define __CALLER_SAVED_REGS "0","1","2","3","4","5","14", \
 | ||||||
|  | -                           "f0","f1","f2","f3","f4","f5","f6","f7"
 | ||||||
|  | +#if defined(__VX__) || defined(__S390_VX__)
 | ||||||
|  | +#define __CALLER_SAVED_REGS "0", "1", "2", "3", "4", "5", "14",   \
 | ||||||
|  | +      "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7",             \
 | ||||||
|  | +      "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15",       \
 | ||||||
|  | +      "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23",     \
 | ||||||
|  | +      "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31"
 | ||||||
|  | +#else
 | ||||||
|  | +#define __CALLER_SAVED_REGS "0", "1", "2", "3", "4", "5", "14",   \
 | ||||||
|  | +      "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7"
 | ||||||
|  | +#endif
 | ||||||
|  |   | ||||||
|  |  /* Nb: Although r11 is modified in the asm snippets below (inside  | ||||||
|  |     VALGRIND_CFI_PROLOGUE) it is not listed in the clobber section, for | ||||||
|  | @@ -4710,9 +4718,9 @@ typedef
 | ||||||
|  |           "aghi 15,-160\n\t"                                      \ | ||||||
|  |           "lg 1, 0(1)\n\t"  /* target->r1 */                      \ | ||||||
|  |           VALGRIND_CALL_NOREDIR_R1                                \ | ||||||
|  | -         "lgr %0, 2\n\t"                                         \
 | ||||||
|  |           "aghi 15,160\n\t"                                       \ | ||||||
|  |           VALGRIND_CFI_EPILOGUE                                   \ | ||||||
|  | +         "lgr %0, 2\n\t"                                         \
 | ||||||
|  |           : /*out*/   "=d" (_res)                                 \ | ||||||
|  |           : /*in*/    "d" (&_argvec[0]) __FRAME_POINTER           \ | ||||||
|  |           : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"7"     \ | ||||||
|  | @@ -4734,9 +4742,9 @@ typedef
 | ||||||
|  |           "lg 2, 8(1)\n\t"                                        \ | ||||||
|  |           "lg 1, 0(1)\n\t"                                        \ | ||||||
|  |           VALGRIND_CALL_NOREDIR_R1                                \ | ||||||
|  | -         "lgr %0, 2\n\t"                                         \
 | ||||||
|  |           "aghi 15,160\n\t"                                       \ | ||||||
|  |           VALGRIND_CFI_EPILOGUE                                   \ | ||||||
|  | +         "lgr %0, 2\n\t"                                         \
 | ||||||
|  |           : /*out*/   "=d" (_res)                                 \ | ||||||
|  |           : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER           \ | ||||||
|  |           : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"7"     \ | ||||||
|  | @@ -4759,9 +4767,9 @@ typedef
 | ||||||
|  |           "lg 3,16(1)\n\t"                                        \ | ||||||
|  |           "lg 1, 0(1)\n\t"                                        \ | ||||||
|  |           VALGRIND_CALL_NOREDIR_R1                                \ | ||||||
|  | -         "lgr %0, 2\n\t"                                         \
 | ||||||
|  |           "aghi 15,160\n\t"                                       \ | ||||||
|  |           VALGRIND_CFI_EPILOGUE                                   \ | ||||||
|  | +         "lgr %0, 2\n\t"                                         \
 | ||||||
|  |           : /*out*/   "=d" (_res)                                 \ | ||||||
|  |           : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER           \ | ||||||
|  |           : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"7"     \ | ||||||
|  | @@ -4786,9 +4794,9 @@ typedef
 | ||||||
|  |           "lg 4,24(1)\n\t"                                        \ | ||||||
|  |           "lg 1, 0(1)\n\t"                                        \ | ||||||
|  |           VALGRIND_CALL_NOREDIR_R1                                \ | ||||||
|  | -         "lgr %0, 2\n\t"                                         \
 | ||||||
|  |           "aghi 15,160\n\t"                                       \ | ||||||
|  |           VALGRIND_CFI_EPILOGUE                                   \ | ||||||
|  | +         "lgr %0, 2\n\t"                                         \
 | ||||||
|  |           : /*out*/   "=d" (_res)                                 \ | ||||||
|  |           : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER           \ | ||||||
|  |           : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"7"     \ | ||||||
|  | @@ -4815,9 +4823,9 @@ typedef
 | ||||||
|  |           "lg 5,32(1)\n\t"                                        \ | ||||||
|  |           "lg 1, 0(1)\n\t"                                        \ | ||||||
|  |           VALGRIND_CALL_NOREDIR_R1                                \ | ||||||
|  | -         "lgr %0, 2\n\t"                                         \
 | ||||||
|  |           "aghi 15,160\n\t"                                       \ | ||||||
|  |           VALGRIND_CFI_EPILOGUE                                   \ | ||||||
|  | +         "lgr %0, 2\n\t"                                         \
 | ||||||
|  |           : /*out*/   "=d" (_res)                                 \ | ||||||
|  |           : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER           \ | ||||||
|  |           : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"7"     \ | ||||||
|  | @@ -4846,9 +4854,9 @@ typedef
 | ||||||
|  |           "lg 6,40(1)\n\t"                                        \ | ||||||
|  |           "lg 1, 0(1)\n\t"                                        \ | ||||||
|  |           VALGRIND_CALL_NOREDIR_R1                                \ | ||||||
|  | -         "lgr %0, 2\n\t"                                         \
 | ||||||
|  |           "aghi 15,160\n\t"                                       \ | ||||||
|  |           VALGRIND_CFI_EPILOGUE                                   \ | ||||||
|  | +         "lgr %0, 2\n\t"                                         \
 | ||||||
|  |           : /*out*/   "=d" (_res)                                 \ | ||||||
|  |           : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER           \ | ||||||
|  |           : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \ | ||||||
|  | @@ -4880,9 +4888,9 @@ typedef
 | ||||||
|  |           "mvc 160(8,15), 48(1)\n\t"                              \ | ||||||
|  |           "lg 1, 0(1)\n\t"                                        \ | ||||||
|  |           VALGRIND_CALL_NOREDIR_R1                                \ | ||||||
|  | -         "lgr %0, 2\n\t"                                         \
 | ||||||
|  |           "aghi 15,168\n\t"                                       \ | ||||||
|  |           VALGRIND_CFI_EPILOGUE                                   \ | ||||||
|  | +         "lgr %0, 2\n\t"                                         \
 | ||||||
|  |           : /*out*/   "=d" (_res)                                 \ | ||||||
|  |           : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER           \ | ||||||
|  |           : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \ | ||||||
|  | @@ -4916,9 +4924,9 @@ typedef
 | ||||||
|  |           "mvc 168(8,15), 56(1)\n\t"                              \ | ||||||
|  |           "lg 1, 0(1)\n\t"                                        \ | ||||||
|  |           VALGRIND_CALL_NOREDIR_R1                                \ | ||||||
|  | -         "lgr %0, 2\n\t"                                         \
 | ||||||
|  |           "aghi 15,176\n\t"                                       \ | ||||||
|  |           VALGRIND_CFI_EPILOGUE                                   \ | ||||||
|  | +         "lgr %0, 2\n\t"                                         \
 | ||||||
|  |           : /*out*/   "=d" (_res)                                 \ | ||||||
|  |           : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER           \ | ||||||
|  |           : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \ | ||||||
|  | @@ -4954,9 +4962,9 @@ typedef
 | ||||||
|  |           "mvc 176(8,15), 64(1)\n\t"                              \ | ||||||
|  |           "lg 1, 0(1)\n\t"                                        \ | ||||||
|  |           VALGRIND_CALL_NOREDIR_R1                                \ | ||||||
|  | -         "lgr %0, 2\n\t"                                         \
 | ||||||
|  |           "aghi 15,184\n\t"                                       \ | ||||||
|  |           VALGRIND_CFI_EPILOGUE                                   \ | ||||||
|  | +         "lgr %0, 2\n\t"                                         \
 | ||||||
|  |           : /*out*/   "=d" (_res)                                 \ | ||||||
|  |           : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER           \ | ||||||
|  |           : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \ | ||||||
|  | @@ -4994,9 +5002,9 @@ typedef
 | ||||||
|  |           "mvc 184(8,15), 72(1)\n\t"                              \ | ||||||
|  |           "lg 1, 0(1)\n\t"                                        \ | ||||||
|  |           VALGRIND_CALL_NOREDIR_R1                                \ | ||||||
|  | -         "lgr %0, 2\n\t"                                         \
 | ||||||
|  |           "aghi 15,192\n\t"                                       \ | ||||||
|  |           VALGRIND_CFI_EPILOGUE                                   \ | ||||||
|  | +         "lgr %0, 2\n\t"                                         \
 | ||||||
|  |           : /*out*/   "=d" (_res)                                 \ | ||||||
|  |           : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER           \ | ||||||
|  |           : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \ | ||||||
|  | @@ -5036,9 +5044,9 @@ typedef
 | ||||||
|  |           "mvc 192(8,15), 80(1)\n\t"                              \ | ||||||
|  |           "lg 1, 0(1)\n\t"                                        \ | ||||||
|  |           VALGRIND_CALL_NOREDIR_R1                                \ | ||||||
|  | -         "lgr %0, 2\n\t"                                         \
 | ||||||
|  |           "aghi 15,200\n\t"                                       \ | ||||||
|  |           VALGRIND_CFI_EPILOGUE                                   \ | ||||||
|  | +         "lgr %0, 2\n\t"                                         \
 | ||||||
|  |           : /*out*/   "=d" (_res)                                 \ | ||||||
|  |           : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER           \ | ||||||
|  |           : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \ | ||||||
|  | @@ -5080,9 +5088,9 @@ typedef
 | ||||||
|  |           "mvc 200(8,15), 88(1)\n\t"                              \ | ||||||
|  |           "lg 1, 0(1)\n\t"                                        \ | ||||||
|  |           VALGRIND_CALL_NOREDIR_R1                                \ | ||||||
|  | -         "lgr %0, 2\n\t"                                         \
 | ||||||
|  |           "aghi 15,208\n\t"                                       \ | ||||||
|  |           VALGRIND_CFI_EPILOGUE                                   \ | ||||||
|  | +         "lgr %0, 2\n\t"                                         \
 | ||||||
|  |           : /*out*/   "=d" (_res)                                 \ | ||||||
|  |           : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER           \ | ||||||
|  |           : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \ | ||||||
|  | @@ -5126,9 +5134,9 @@ typedef
 | ||||||
|  |           "mvc 208(8,15), 96(1)\n\t"                              \ | ||||||
|  |           "lg 1, 0(1)\n\t"                                        \ | ||||||
|  |           VALGRIND_CALL_NOREDIR_R1                                \ | ||||||
|  | -         "lgr %0, 2\n\t"                                         \
 | ||||||
|  |           "aghi 15,216\n\t"                                       \ | ||||||
|  |           VALGRIND_CFI_EPILOGUE                                   \ | ||||||
|  | +         "lgr %0, 2\n\t"                                         \
 | ||||||
|  |           : /*out*/   "=d" (_res)                                 \ | ||||||
|  |           : /*in*/    "a" (&_argvec[0]) __FRAME_POINTER           \ | ||||||
|  |           : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS,"6","7" \ | ||||||
|  | -- 
 | ||||||
|  | 2.17.0 | ||||||
|  | 
 | ||||||
							
								
								
									
										83
									
								
								SOURCES/valgrind-3.15.0-scalar-arm64.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										83
									
								
								SOURCES/valgrind-3.15.0-scalar-arm64.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,83 @@ | |||||||
|  | commit 917e423073c5eacffbad83008c27c8e61e0e342a | ||||||
|  | Author: Mark Wielaard <mark@klomp.org> | ||||||
|  | Date:   Mon May 20 00:09:59 2019 +0200 | ||||||
|  | 
 | ||||||
|  |     Make memcheck/tests/arm64-linux/scalar test work under root. | ||||||
|  |      | ||||||
|  |     Running the testsuite as root isn't really recommended. | ||||||
|  |     But lets not make tests fail unnecessarily when running as root. | ||||||
|  |     Pass really invalid arguments to setuid, setgid, acct and fchown. | ||||||
|  |     Make setresgid, setresuid, setregid and setreuid always succeed. | ||||||
|  | 
 | ||||||
|  | diff --git a/memcheck/tests/arm64-linux/scalar.c b/memcheck/tests/arm64-linux/scalar.c
 | ||||||
|  | index fd49db6..622ea1c 100644
 | ||||||
|  | --- a/memcheck/tests/arm64-linux/scalar.c
 | ||||||
|  | +++ b/memcheck/tests/arm64-linux/scalar.c
 | ||||||
|  | @@ -136,7 +136,7 @@ int main(void)
 | ||||||
|  |   | ||||||
|  |     // __NR_setuid 23 | ||||||
|  |     GO(__NR_setuid, "1s 0m"); | ||||||
|  | -   SY(__NR_setuid, x0); FAIL;
 | ||||||
|  | +   SY(__NR_setuid, x0-1); FAIL;
 | ||||||
|  |   | ||||||
|  |     // __NR_getuid 24 | ||||||
|  |     GO(__NR_getuid, "0s 0m"); | ||||||
|  | @@ -229,7 +229,7 @@ int main(void)
 | ||||||
|  |   | ||||||
|  |     // __NR_setgid 46 | ||||||
|  |     GO(__NR_setgid, "1s 0m"); | ||||||
|  | -   SY(__NR_setgid, x0); FAIL;
 | ||||||
|  | +   SY(__NR_setgid, x0-1); FAIL;
 | ||||||
|  |   | ||||||
|  |     // __NR_getgid 47 | ||||||
|  |     GO(__NR_getgid, "0s 0m"); | ||||||
|  | @@ -249,7 +249,7 @@ int main(void)
 | ||||||
|  |   | ||||||
|  |     // __NR_acct 51 | ||||||
|  |     GO(__NR_acct, "1s 1m"); | ||||||
|  | -   SY(__NR_acct, x0); FAIL;
 | ||||||
|  | +   SY(__NR_acct, x0-1); FAIL;
 | ||||||
|  |   | ||||||
|  |     // __NR_umount2 52 | ||||||
|  |     GO(__NR_umount2, "2s 1m"); | ||||||
|  | @@ -340,11 +340,11 @@ int main(void)
 | ||||||
|  |   | ||||||
|  |     // __NR_setreuid 70 | ||||||
|  |     GO(__NR_setreuid, "2s 0m"); | ||||||
|  | -   SY(__NR_setreuid, x0, x0); FAIL;
 | ||||||
|  | +   SY(__NR_setreuid, x0-1, x0-1); SUCC;
 | ||||||
|  |   | ||||||
|  |     // __NR_setregid 71 | ||||||
|  |     GO(__NR_setregid, "2s 0m"); | ||||||
|  | -   SY(__NR_setregid, x0, x0); FAIL;
 | ||||||
|  | +   SY(__NR_setregid, x0-1, x0-1); SUCC;
 | ||||||
|  |   | ||||||
|  |     // __NR_sigsuspend arm64 only has rt_sigsuspend | ||||||
|  |     // XXX: how do you use this function? | ||||||
|  | @@ -447,7 +447,7 @@ int main(void)
 | ||||||
|  |   | ||||||
|  |     // __NR_fchown 95 | ||||||
|  |     GO(__NR_fchown, "3s 0m"); | ||||||
|  | -   SY(__NR_fchown, x0, x0, x0); FAIL;
 | ||||||
|  | +   SY(__NR_fchown, x0-1, x0, x0); FAIL;
 | ||||||
|  |   | ||||||
|  |     // __NR_getpriority 96 | ||||||
|  |     GO(__NR_getpriority, "2s 0m"); | ||||||
|  | @@ -733,7 +733,7 @@ int main(void)
 | ||||||
|  |   | ||||||
|  |     // __NR_setresuid 164 | ||||||
|  |     GO(__NR_setresuid, "3s 0m"); | ||||||
|  | -   SY(__NR_setresuid, x0, x0, x0); FAIL;
 | ||||||
|  | +   SY(__NR_setresuid, x0-1, x0-1, x0-1); SUCC;
 | ||||||
|  |   | ||||||
|  |     // __NR_getresuid 165 | ||||||
|  |     GO(__NR_getresuid, "3s 3m"); | ||||||
|  | @@ -757,7 +757,7 @@ int main(void)
 | ||||||
|  |   | ||||||
|  |     // __NR_setresgid 170 | ||||||
|  |     GO(__NR_setresgid, "3s 0m"); | ||||||
|  | -   SY(__NR_setresgid, x0, x0, x0); FAIL;
 | ||||||
|  | +   SY(__NR_setresgid, x0-1, x0-1, x0-1); SUCC;
 | ||||||
|  |   | ||||||
|  |     // __NR_getresgid 171 | ||||||
|  |     GO(__NR_getresgid, "3s 3m"); | ||||||
							
								
								
									
										137
									
								
								SOURCES/valgrind-3.15.0-scalar-x86.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										137
									
								
								SOURCES/valgrind-3.15.0-scalar-x86.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,137 @@ | |||||||
|  | commit abc09f23e1ad55a07beb827aef969acfe6c496ef | ||||||
|  | Author: Mark Wielaard <mark@klomp.org> | ||||||
|  | Date:   Mon May 20 13:08:41 2019 +0200 | ||||||
|  | 
 | ||||||
|  |     Make memcheck/tests/x86-linux/scalar test work under root. | ||||||
|  |      | ||||||
|  |     Running the testsuite as root isn't really recommended. | ||||||
|  |     But lets not make tests fail unnecessarily when running as root. | ||||||
|  |     Similar to the arm64-linux/scalar fixes. Plus 32bit variants that | ||||||
|  |     don't exist on arm64. | ||||||
|  |      | ||||||
|  |     Pass really invalid arguments to setuid[32], setgid[32], acct, fchown[32]. | ||||||
|  |     Make setresgid[32], setresuid[32], setregid[32], setreuid[32] always succeed. | ||||||
|  | 
 | ||||||
|  | diff --git a/memcheck/tests/x86-linux/scalar.c b/memcheck/tests/x86-linux/scalar.c
 | ||||||
|  | index 213a5ad..52f0d4e 100644
 | ||||||
|  | --- a/memcheck/tests/x86-linux/scalar.c
 | ||||||
|  | +++ b/memcheck/tests/x86-linux/scalar.c
 | ||||||
|  | @@ -145,7 +145,7 @@ int main(void)
 | ||||||
|  |   | ||||||
|  |     // __NR_setuid 23 | ||||||
|  |     GO(__NR_setuid, "1s 0m"); | ||||||
|  | -   SY(__NR_setuid, x0); FAIL;
 | ||||||
|  | +   SY(__NR_setuid, x0-1); FAIL;
 | ||||||
|  |   | ||||||
|  |     // __NR_getuid 24 | ||||||
|  |     GO(__NR_getuid, "0s 0m"); | ||||||
|  | @@ -238,7 +238,7 @@ int main(void)
 | ||||||
|  |   | ||||||
|  |     // __NR_setgid 46 | ||||||
|  |     GO(__NR_setgid, "1s 0m"); | ||||||
|  | -   SY(__NR_setgid, x0); FAIL;
 | ||||||
|  | +   SY(__NR_setgid, x0-1); FAIL;
 | ||||||
|  |   | ||||||
|  |     // __NR_getgid 47 | ||||||
|  |     GO(__NR_getgid, "0s 0m"); | ||||||
|  | @@ -258,7 +258,7 @@ int main(void)
 | ||||||
|  |   | ||||||
|  |     // __NR_acct 51 | ||||||
|  |     GO(__NR_acct, "1s 1m"); | ||||||
|  | -   SY(__NR_acct, x0); FAIL;
 | ||||||
|  | +   SY(__NR_acct, x0-1); FAIL;
 | ||||||
|  |   | ||||||
|  |     // __NR_umount2 52 | ||||||
|  |     GO(__NR_umount2, "2s 1m"); | ||||||
|  | @@ -349,11 +349,11 @@ int main(void)
 | ||||||
|  |   | ||||||
|  |     // __NR_setreuid 70 | ||||||
|  |     GO(__NR_setreuid, "2s 0m"); | ||||||
|  | -   SY(__NR_setreuid, x0, x0); FAIL;
 | ||||||
|  | +   SY(__NR_setreuid, x0-1, x0-1); SUCC;
 | ||||||
|  |   | ||||||
|  |     // __NR_setregid 71 | ||||||
|  |     GO(__NR_setregid, "2s 0m"); | ||||||
|  | -   SY(__NR_setregid, x0, x0); FAIL;
 | ||||||
|  | +   SY(__NR_setregid, x0-1, x0-1); SUCC;
 | ||||||
|  |   | ||||||
|  |     // __NR_sigsuspend 72 | ||||||
|  |     // XXX: how do you use this function? | ||||||
|  | @@ -456,7 +456,7 @@ int main(void)
 | ||||||
|  |   | ||||||
|  |     // __NR_fchown 95 | ||||||
|  |     GO(__NR_fchown, "3s 0m"); | ||||||
|  | -   SY(__NR_fchown, x0, x0, x0); FAIL;
 | ||||||
|  | +   SY(__NR_fchown, x0-1, x0, x0); FAIL;
 | ||||||
|  |   | ||||||
|  |     // __NR_getpriority 96 | ||||||
|  |     GO(__NR_getpriority, "2s 0m"); | ||||||
|  | @@ -742,7 +742,7 @@ int main(void)
 | ||||||
|  |   | ||||||
|  |     // __NR_setresuid 164 | ||||||
|  |     GO(__NR_setresuid, "3s 0m"); | ||||||
|  | -   SY(__NR_setresuid, x0, x0, x0); FAIL;
 | ||||||
|  | +   SY(__NR_setresuid, x0-1, x0-1, x0-1); SUCC;
 | ||||||
|  |   | ||||||
|  |     // __NR_getresuid 165 | ||||||
|  |     GO(__NR_getresuid, "3s 3m"); | ||||||
|  | @@ -766,7 +766,7 @@ int main(void)
 | ||||||
|  |   | ||||||
|  |     // __NR_setresgid 170 | ||||||
|  |     GO(__NR_setresgid, "3s 0m"); | ||||||
|  | -   SY(__NR_setresgid, x0, x0, x0); FAIL;
 | ||||||
|  | +   SY(__NR_setresgid, x0-1, x0-1, x0-1); SUCC;
 | ||||||
|  |   | ||||||
|  |     // __NR_getresgid 171 | ||||||
|  |     GO(__NR_getresgid, "3s 3m"); | ||||||
|  | @@ -923,11 +923,11 @@ int main(void)
 | ||||||
|  |   | ||||||
|  |     // __NR_setreuid32 203 | ||||||
|  |     GO(__NR_setreuid32, "2s 0m"); | ||||||
|  | -   SY(__NR_setreuid32, x0, x0); FAIL;
 | ||||||
|  | +   SY(__NR_setreuid32, x0-1, x0-1); SUCC;
 | ||||||
|  |   | ||||||
|  |     // __NR_setregid32 204 | ||||||
|  |     GO(__NR_setregid32, "2s 0m"); | ||||||
|  | -   SY(__NR_setregid32, x0, x0); FAIL;
 | ||||||
|  | +   SY(__NR_setregid32, x0-1, x0-1); SUCC;
 | ||||||
|  |   | ||||||
|  |     // __NR_getgroups32 205 | ||||||
|  |     GO(__NR_getgroups32, "2s 1m"); | ||||||
|  | @@ -939,11 +939,11 @@ int main(void)
 | ||||||
|  |   | ||||||
|  |     // __NR_fchown32 207 | ||||||
|  |     GO(__NR_fchown32, "3s 0m"); | ||||||
|  | -   SY(__NR_fchown32, x0, x0, x0); FAIL;
 | ||||||
|  | +   SY(__NR_fchown32, x0-1, x0, x0); FAIL;
 | ||||||
|  |   | ||||||
|  |     // __NR_setresuid32 208 | ||||||
|  |     GO(__NR_setresuid32, "3s 0m"); | ||||||
|  | -   SY(__NR_setresuid32, x0, x0, x0); FAIL;
 | ||||||
|  | +   SY(__NR_setresuid32, x0-1, x0-1, x0-1); SUCC;
 | ||||||
|  |   | ||||||
|  |     // __NR_getresuid32 209 | ||||||
|  |     GO(__NR_getresuid32, "3s 3m"); | ||||||
|  | @@ -951,7 +951,7 @@ int main(void)
 | ||||||
|  |   | ||||||
|  |     // __NR_setresgid32 210 | ||||||
|  |     GO(__NR_setresgid32, "3s 0m"); | ||||||
|  | -   SY(__NR_setresgid32, x0, x0, x0); FAIL;
 | ||||||
|  | +   SY(__NR_setresgid32, x0-1, x0-1, x0-1); SUCC;
 | ||||||
|  |   | ||||||
|  |     // __NR_getresgid32 211 | ||||||
|  |     GO(__NR_getresgid32, "3s 3m"); | ||||||
|  | @@ -963,11 +963,11 @@ int main(void)
 | ||||||
|  |   | ||||||
|  |     // __NR_setuid32 213 | ||||||
|  |     GO(__NR_setuid32, "1s 0m"); | ||||||
|  | -   SY(__NR_setuid32, x0); FAIL;
 | ||||||
|  | +   SY(__NR_setuid32, x0-1); FAIL;
 | ||||||
|  |   | ||||||
|  |     // __NR_setgid32 214 | ||||||
|  |     GO(__NR_setgid32, "1s 0m"); | ||||||
|  | -   SY(__NR_setgid32, x0); FAIL;
 | ||||||
|  | +   SY(__NR_setgid32, x0-1); FAIL;
 | ||||||
|  |   | ||||||
|  |     // __NR_setfsuid32 215 | ||||||
|  |     GO(__NR_setfsuid32, "1s 0m"); | ||||||
							
								
								
									
										72
									
								
								SOURCES/valgrind-3.15.0-some-Wl-z-now.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										72
									
								
								SOURCES/valgrind-3.15.0-some-Wl-z-now.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,72 @@ | |||||||
|  | commit d3c977726064ba09fed6dfc7daf22b16824c97b4 | ||||||
|  | Author: Mark Wielaard <mark@klomp.org> | ||||||
|  | Date:   Fri May 24 18:24:56 2019 +0200 | ||||||
|  | 
 | ||||||
|  |     Add -Wl,-z,now to some binaries. | ||||||
|  | 
 | ||||||
|  | diff --git a/auxprogs/Makefile.am b/auxprogs/Makefile.am
 | ||||||
|  | index 1b7842b..e211eec 100644
 | ||||||
|  | --- a/auxprogs/Makefile.am
 | ||||||
|  | +++ b/auxprogs/Makefile.am
 | ||||||
|  | @@ -32,7 +32,7 @@ valgrind_listener_SOURCES = valgrind-listener.c
 | ||||||
|  |  valgrind_listener_CPPFLAGS  = $(AM_CPPFLAGS_PRI) -I$(top_srcdir)/coregrind | ||||||
|  |  valgrind_listener_CFLAGS    = $(AM_CFLAGS_PRI) -fstack-protector-strong | ||||||
|  |  valgrind_listener_CCASFLAGS = $(AM_CCASFLAGS_PRI) | ||||||
|  | -valgrind_listener_LDFLAGS   = $(AM_CFLAGS_PRI)
 | ||||||
|  | +valgrind_listener_LDFLAGS   = $(AM_CFLAGS_PRI) -Wl,-z,now
 | ||||||
|  |  if VGCONF_PLATVARIANT_IS_ANDROID | ||||||
|  |  valgrind_listener_CFLAGS    += -static | ||||||
|  |  endif | ||||||
|  | @@ -51,7 +51,7 @@ valgrind_di_server_SOURCES   = valgrind-di-server.c
 | ||||||
|  |  valgrind_di_server_CPPFLAGS  = $(AM_CPPFLAGS_PRI) -I$(top_srcdir)/coregrind | ||||||
|  |  valgrind_di_server_CFLAGS    = $(AM_CFLAGS_PRI) -fstack-protector-strong | ||||||
|  |  valgrind_di_server_CCASFLAGS = $(AM_CCASFLAGS_PRI) | ||||||
|  | -valgrind_di_server_LDFLAGS   = $(AM_CFLAGS_PRI)
 | ||||||
|  | +valgrind_di_server_LDFLAGS   = $(AM_CFLAGS_PRI) -Wl,-z,now
 | ||||||
|  |  if VGCONF_PLATVARIANT_IS_ANDROID | ||||||
|  |  valgrind_di_server_CFLAGS    += -static | ||||||
|  |  endif | ||||||
|  | @@ -86,7 +86,7 @@ getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_SOURCES   = getoff.c
 | ||||||
|  |  getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CPPFLAGS  = $(AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) | ||||||
|  |  getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS    = $(AM_CFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) -fstack-protector-strong | ||||||
|  |  getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CCASFLAGS = $(AM_CCASFLAGS_PRI) | ||||||
|  | -getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS   = $(AM_CFLAGS_PRI) @LIB_UBSAN@
 | ||||||
|  | +getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS   = $(AM_CFLAGS_PRI) @LIB_UBSAN@ -Wl,-z,now
 | ||||||
|  |  if HAVE_DLINFO_RTLD_DI_TLS_MODID | ||||||
|  |  getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDADD = $(LDADD) -ldl | ||||||
|  |  endif | ||||||
|  | diff --git a/cachegrind/Makefile.am b/cachegrind/Makefile.am
 | ||||||
|  | index f572741..1c07e50 100644
 | ||||||
|  | --- a/cachegrind/Makefile.am
 | ||||||
|  | +++ b/cachegrind/Makefile.am
 | ||||||
|  | @@ -27,7 +27,7 @@ cg_merge_SOURCES = cg_merge.c
 | ||||||
|  |  cg_merge_CPPFLAGS  = $(AM_CPPFLAGS_PRI) | ||||||
|  |  cg_merge_CFLAGS    = $(AM_CFLAGS_PRI) -fstack-protector-strong | ||||||
|  |  cg_merge_CCASFLAGS = $(AM_CCASFLAGS_PRI) | ||||||
|  | -cg_merge_LDFLAGS   = $(AM_CFLAGS_PRI)
 | ||||||
|  | +cg_merge_LDFLAGS   = $(AM_CFLAGS_PRI) -Wl,-z,now
 | ||||||
|  |  # If there is no secondary platform, and the platforms include x86-darwin, | ||||||
|  |  # then the primary platform must be x86-darwin.  Hence: | ||||||
|  |  if ! VGCONF_HAVE_PLATFORM_SEC | ||||||
|  | diff --git a/coregrind/Makefile.am b/coregrind/Makefile.am
 | ||||||
|  | index 3c73210..fb6b7bb 100644
 | ||||||
|  | --- a/coregrind/Makefile.am
 | ||||||
|  | +++ b/coregrind/Makefile.am
 | ||||||
|  | @@ -57,7 +57,7 @@ RANLIB = ${LTO_RANLIB}
 | ||||||
|  |  valgrind_CPPFLAGS  = $(AM_CPPFLAGS_PRI) | ||||||
|  |  valgrind_CFLAGS    = $(AM_CFLAGS_PRI) $(LTO_CFLAGS) -fstack-protector-strong | ||||||
|  |  valgrind_CCASFLAGS = $(AM_CCASFLAGS_PRI) | ||||||
|  | -valgrind_LDFLAGS   = $(AM_CFLAGS_PRI) @LIB_UBSAN@
 | ||||||
|  | +valgrind_LDFLAGS   = $(AM_CFLAGS_PRI) @LIB_UBSAN@ -Wl,-z,now
 | ||||||
|  |  # If there is no secondary platform, and the platforms include x86-darwin, | ||||||
|  |  # then the primary platform must be x86-darwin.  Hence: | ||||||
|  |  if ! VGCONF_HAVE_PLATFORM_SEC | ||||||
|  | @@ -96,7 +96,7 @@ endif
 | ||||||
|  |  vgdb_CPPFLAGS  = $(AM_CPPFLAGS_PRI) | ||||||
|  |  vgdb_CFLAGS    = $(AM_CFLAGS_PRI) $(LTO_CFLAGS) -fstack-protector-strong | ||||||
|  |  vgdb_CCASFLAGS = $(AM_CCASFLAGS_PRI) | ||||||
|  | -vgdb_LDFLAGS   = $(AM_CFLAGS_PRI) @LIB_UBSAN@
 | ||||||
|  | +vgdb_LDFLAGS   = $(AM_CFLAGS_PRI) @LIB_UBSAN@ -Wl,-z,now
 | ||||||
|  |  if VGCONF_PLATVARIANT_IS_ANDROID | ||||||
|  |  vgdb_CFLAGS    += -static | ||||||
|  |  endif | ||||||
							
								
								
									
										118
									
								
								SOURCES/valgrind-3.15.0-some-stack-protector.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										118
									
								
								SOURCES/valgrind-3.15.0-some-stack-protector.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,118 @@ | |||||||
|  | commit b73fb7a614e1b5d60af23fb0752b5cead995e02e | ||||||
|  | Author: Mark Wielaard <mark@klomp.org> | ||||||
|  | Date:   Sun Apr 14 00:30:05 2019 +0200 | ||||||
|  | 
 | ||||||
|  |     Remove no-stack-protector, add stack-protector-strong to some. | ||||||
|  | 
 | ||||||
|  | diff --git a/auxprogs/Makefile.am b/auxprogs/Makefile.am
 | ||||||
|  | index 56cc5ef..1b7842b 100644
 | ||||||
|  | --- a/auxprogs/Makefile.am
 | ||||||
|  | +++ b/auxprogs/Makefile.am
 | ||||||
|  | @@ -30,7 +30,7 @@ bin_PROGRAMS = valgrind-listener valgrind-di-server
 | ||||||
|  |   | ||||||
|  |  valgrind_listener_SOURCES = valgrind-listener.c | ||||||
|  |  valgrind_listener_CPPFLAGS  = $(AM_CPPFLAGS_PRI) -I$(top_srcdir)/coregrind | ||||||
|  | -valgrind_listener_CFLAGS    = $(AM_CFLAGS_PRI)
 | ||||||
|  | +valgrind_listener_CFLAGS    = $(AM_CFLAGS_PRI) -fstack-protector-strong
 | ||||||
|  |  valgrind_listener_CCASFLAGS = $(AM_CCASFLAGS_PRI) | ||||||
|  |  valgrind_listener_LDFLAGS   = $(AM_CFLAGS_PRI) | ||||||
|  |  if VGCONF_PLATVARIANT_IS_ANDROID | ||||||
|  | @@ -49,7 +49,7 @@ endif
 | ||||||
|  |   | ||||||
|  |  valgrind_di_server_SOURCES   = valgrind-di-server.c | ||||||
|  |  valgrind_di_server_CPPFLAGS  = $(AM_CPPFLAGS_PRI) -I$(top_srcdir)/coregrind | ||||||
|  | -valgrind_di_server_CFLAGS    = $(AM_CFLAGS_PRI)
 | ||||||
|  | +valgrind_di_server_CFLAGS    = $(AM_CFLAGS_PRI) -fstack-protector-strong
 | ||||||
|  |  valgrind_di_server_CCASFLAGS = $(AM_CCASFLAGS_PRI) | ||||||
|  |  valgrind_di_server_LDFLAGS   = $(AM_CFLAGS_PRI) | ||||||
|  |  if VGCONF_PLATVARIANT_IS_ANDROID | ||||||
|  | @@ -84,7 +84,7 @@ endif
 | ||||||
|  |   | ||||||
|  |  getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_SOURCES   = getoff.c | ||||||
|  |  getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CPPFLAGS  = $(AM_CPPFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) | ||||||
|  | -getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS    = $(AM_CFLAGS_@VGCONF_PLATFORM_PRI_CAPS@)
 | ||||||
|  | +getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CFLAGS    = $(AM_CFLAGS_@VGCONF_PLATFORM_PRI_CAPS@) -fstack-protector-strong
 | ||||||
|  |  getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_CCASFLAGS = $(AM_CCASFLAGS_PRI) | ||||||
|  |  getoff_@VGCONF_ARCH_PRI@_@VGCONF_OS@_LDFLAGS   = $(AM_CFLAGS_PRI) @LIB_UBSAN@ | ||||||
|  |  if HAVE_DLINFO_RTLD_DI_TLS_MODID | ||||||
|  | diff --git a/cachegrind/Makefile.am b/cachegrind/Makefile.am
 | ||||||
|  | index f8447a1..f572741 100644
 | ||||||
|  | --- a/cachegrind/Makefile.am
 | ||||||
|  | +++ b/cachegrind/Makefile.am
 | ||||||
|  | @@ -25,7 +25,7 @@ bin_PROGRAMS = cg_merge
 | ||||||
|  |   | ||||||
|  |  cg_merge_SOURCES = cg_merge.c | ||||||
|  |  cg_merge_CPPFLAGS  = $(AM_CPPFLAGS_PRI) | ||||||
|  | -cg_merge_CFLAGS    = $(AM_CFLAGS_PRI)
 | ||||||
|  | +cg_merge_CFLAGS    = $(AM_CFLAGS_PRI) -fstack-protector-strong
 | ||||||
|  |  cg_merge_CCASFLAGS = $(AM_CCASFLAGS_PRI) | ||||||
|  |  cg_merge_LDFLAGS   = $(AM_CFLAGS_PRI) | ||||||
|  |  # If there is no secondary platform, and the platforms include x86-darwin, | ||||||
|  | diff --git a/configure.ac b/configure.ac
 | ||||||
|  | index f8c798b..ccc8f52 100755
 | ||||||
|  | --- a/configure.ac
 | ||||||
|  | +++ b/configure.ac
 | ||||||
|  | @@ -2188,24 +2188,24 @@ AC_LANG(C)
 | ||||||
|  |  AC_SUBST(FLAG_FALIGNED_NEW) | ||||||
|  |   | ||||||
|  |  # does this compiler support -fno-stack-protector ? | ||||||
|  | -AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
 | ||||||
|  | -
 | ||||||
|  | -safe_CFLAGS=$CFLAGS
 | ||||||
|  | -CFLAGS="-fno-stack-protector -Werror"
 | ||||||
|  | -
 | ||||||
|  | -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
 | ||||||
|  | -  return 0;
 | ||||||
|  | -]])], [
 | ||||||
|  | -no_stack_protector=yes
 | ||||||
|  | -FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
 | ||||||
|  | -AC_MSG_RESULT([yes])
 | ||||||
|  | -], [
 | ||||||
|  | -no_stack_protector=no
 | ||||||
|  | +#AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
 | ||||||
|  | +#
 | ||||||
|  | +#safe_CFLAGS=$CFLAGS
 | ||||||
|  | +#CFLAGS="-fno-stack-protector -Werror"
 | ||||||
|  | +#
 | ||||||
|  | +#AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
 | ||||||
|  | +#  return 0;
 | ||||||
|  | +#]])], [
 | ||||||
|  | +#no_stack_protector=yes
 | ||||||
|  | +#FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
 | ||||||
|  | +#AC_MSG_RESULT([yes])
 | ||||||
|  | +#], [
 | ||||||
|  | +#no_stack_protector=no
 | ||||||
|  |  FLAG_FNO_STACK_PROTECTOR="" | ||||||
|  | -AC_MSG_RESULT([no])
 | ||||||
|  | -])
 | ||||||
|  | -CFLAGS=$safe_CFLAGS
 | ||||||
|  | -
 | ||||||
|  | +#AC_MSG_RESULT([no])
 | ||||||
|  | +#])
 | ||||||
|  | +#CFLAGS=$safe_CFLAGS
 | ||||||
|  | +#
 | ||||||
|  |  AC_SUBST(FLAG_FNO_STACK_PROTECTOR) | ||||||
|  |   | ||||||
|  |  # does this compiler support -finline-functions ? | ||||||
|  | diff --git a/coregrind/Makefile.am b/coregrind/Makefile.am
 | ||||||
|  | index 94030fd..3c73210 100644
 | ||||||
|  | --- a/coregrind/Makefile.am
 | ||||||
|  | +++ b/coregrind/Makefile.am
 | ||||||
|  | @@ -55,7 +55,7 @@ AR = ${LTO_AR}
 | ||||||
|  |  RANLIB = ${LTO_RANLIB} | ||||||
|  |   | ||||||
|  |  valgrind_CPPFLAGS  = $(AM_CPPFLAGS_PRI) | ||||||
|  | -valgrind_CFLAGS    = $(AM_CFLAGS_PRI) $(LTO_CFLAGS)
 | ||||||
|  | +valgrind_CFLAGS    = $(AM_CFLAGS_PRI) $(LTO_CFLAGS) -fstack-protector-strong
 | ||||||
|  |  valgrind_CCASFLAGS = $(AM_CCASFLAGS_PRI) | ||||||
|  |  valgrind_LDFLAGS   = $(AM_CFLAGS_PRI) @LIB_UBSAN@ | ||||||
|  |  # If there is no secondary platform, and the platforms include x86-darwin, | ||||||
|  | @@ -94,7 +94,7 @@ vgdb_SOURCES += vgdb-invoker-solaris.c
 | ||||||
|  |  endif | ||||||
|  |   | ||||||
|  |  vgdb_CPPFLAGS  = $(AM_CPPFLAGS_PRI) | ||||||
|  | -vgdb_CFLAGS    = $(AM_CFLAGS_PRI) $(LTO_CFLAGS)
 | ||||||
|  | +vgdb_CFLAGS    = $(AM_CFLAGS_PRI) $(LTO_CFLAGS) -fstack-protector-strong
 | ||||||
|  |  vgdb_CCASFLAGS = $(AM_CCASFLAGS_PRI) | ||||||
|  |  vgdb_LDFLAGS   = $(AM_CFLAGS_PRI) @LIB_UBSAN@ | ||||||
|  |  if VGCONF_PLATVARIANT_IS_ANDROID | ||||||
							
								
								
									
										54
									
								
								SOURCES/valgrind-3.9.0-cachegrind-improvements.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								SOURCES/valgrind-3.9.0-cachegrind-improvements.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,54 @@ | |||||||
|  | --- valgrind-3.8.1/cachegrind/cg_sim.c.jj	2011-10-26 23:24:32.000000000 +0200
 | ||||||
|  | +++ valgrind-3.8.1/cachegrind/cg_sim.c	2011-12-09 17:31:19.256023683 +0100
 | ||||||
|  | @@ -42,27 +42,30 @@ typedef struct {
 | ||||||
|  |     Int          size;                   /* bytes */ | ||||||
|  |     Int          assoc; | ||||||
|  |     Int          line_size;              /* bytes */ | ||||||
|  | -   Int          sets;
 | ||||||
|  |     Int          sets_min_1; | ||||||
|  |     Int          line_size_bits; | ||||||
|  |     Int          tag_shift; | ||||||
|  | -   HChar        desc_line[128];         /* large enough */
 | ||||||
|  |     UWord*       tags; | ||||||
|  | -} cache_t2;
 | ||||||
|  | +   HChar        desc_line[128];
 | ||||||
|  | +} cache_t2
 | ||||||
|  | +#ifdef __GNUC__
 | ||||||
|  | +__attribute__ ((aligned (8 * sizeof (Int))))
 | ||||||
|  | +#endif
 | ||||||
|  | +;
 | ||||||
|  |   | ||||||
|  |  /* By this point, the size/assoc/line_size has been checked. */ | ||||||
|  |  static void cachesim_initcache(cache_t config, cache_t2* c) | ||||||
|  |  { | ||||||
|  | -   Int i;
 | ||||||
|  | +   Int sets;
 | ||||||
|  |   | ||||||
|  |     c->size      = config.size; | ||||||
|  |     c->assoc     = config.assoc; | ||||||
|  |     c->line_size = config.line_size; | ||||||
|  |   | ||||||
|  | -   c->sets           = (c->size / c->line_size) / c->assoc;
 | ||||||
|  | -   c->sets_min_1     = c->sets - 1;
 | ||||||
|  | +   sets              = (c->size / c->line_size) / c->assoc;
 | ||||||
|  | +   c->sets_min_1     = sets - 1;
 | ||||||
|  |     c->line_size_bits = VG_(log2)(c->line_size); | ||||||
|  | -   c->tag_shift      = c->line_size_bits + VG_(log2)(c->sets);
 | ||||||
|  | +   c->tag_shift      = c->line_size_bits + VG_(log2)(sets);
 | ||||||
|  |   | ||||||
|  |     if (c->assoc == 1) { | ||||||
|  |        VG_(sprintf)(c->desc_line, "%d B, %d B, direct-mapped",  | ||||||
|  | @@ -72,11 +75,8 @@ static void cachesim_initcache(cache_t c
 | ||||||
|  |                                   c->size, c->line_size, c->assoc); | ||||||
|  |     } | ||||||
|  |   | ||||||
|  | -   c->tags = VG_(malloc)("cg.sim.ci.1",
 | ||||||
|  | -                         sizeof(UWord) * c->sets * c->assoc);
 | ||||||
|  | -
 | ||||||
|  | -   for (i = 0; i < c->sets * c->assoc; i++)
 | ||||||
|  | -      c->tags[i] = 0;
 | ||||||
|  | +   c->tags = VG_(calloc)("cg.sim.ci.1",
 | ||||||
|  | +                         sizeof(UWord), sets * c->assoc);
 | ||||||
|  |  } | ||||||
|  |   | ||||||
|  |  /* This attribute forces GCC to inline the function, getting rid of a | ||||||
							
								
								
									
										15
									
								
								SOURCES/valgrind-3.9.0-helgrind-race-supp.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								SOURCES/valgrind-3.9.0-helgrind-race-supp.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,15 @@ | |||||||
|  | --- valgrind/glibc-2.34567-NPTL-helgrind.supp.jj	2009-08-19 15:37:48.000000000 +0200
 | ||||||
|  | +++ valgrind/glibc-2.34567-NPTL-helgrind.supp	2009-10-21 16:46:31.000000000 +0200
 | ||||||
|  | @@ -88,6 +88,12 @@
 | ||||||
|  |     obj:*/lib*/libpthread-2.*so* | ||||||
|  |  } | ||||||
|  |  { | ||||||
|  | +   helgrind-glibc2X-102a
 | ||||||
|  | +   Helgrind:Race
 | ||||||
|  | +   fun:mythread_wrapper
 | ||||||
|  | +   obj:*vgpreload_helgrind*.so
 | ||||||
|  | +}
 | ||||||
|  | +{
 | ||||||
|  |     helgrind-glibc2X-103 | ||||||
|  |     Helgrind:Race | ||||||
|  |     fun:pthread_cond_*@@GLIBC_2.* | ||||||
							
								
								
									
										28
									
								
								SOURCES/valgrind-3.9.0-ldso-supp.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								SOURCES/valgrind-3.9.0-ldso-supp.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,28 @@ | |||||||
|  | --- valgrind/glibc-2.X.supp.in.jj	2011-10-26 23:24:45.000000000 +0200
 | ||||||
|  | +++ valgrind/glibc-2.X.supp.in	2012-05-07 10:55:20.395942656 +0200
 | ||||||
|  | @@ -124,7 +124,7 @@
 | ||||||
|  |     glibc-2.5.x-on-SUSE-10.2-(PPC)-2a | ||||||
|  |     Memcheck:Cond | ||||||
|  |     fun:index | ||||||
|  | -   obj:*ld-@GLIBC_VERSION@.*.so
 | ||||||
|  | +   obj:*ld-@GLIBC_VERSION@*.so
 | ||||||
|  |  } | ||||||
|  |  { | ||||||
|  |     glibc-2.5.x-on-SuSE-10.2-(PPC)-2b | ||||||
|  | @@ -136,14 +136,14 @@
 | ||||||
|  |     glibc-2.5.5-on-SuSE-10.2-(PPC)-2c | ||||||
|  |     Memcheck:Addr4 | ||||||
|  |     fun:index | ||||||
|  | -   obj:*ld-@GLIBC_VERSION@.*.so
 | ||||||
|  | +   obj:*ld-@GLIBC_VERSION@*.so
 | ||||||
|  |  } | ||||||
|  |  { | ||||||
|  |     glibc-2.3.5-on-SuSE-10.1-(PPC)-3 | ||||||
|  |     Memcheck:Addr4 | ||||||
|  |     fun:*wordcopy_fwd_dest_aligned* | ||||||
|  |     fun:mem*cpy | ||||||
|  | -   obj:*lib*@GLIBC_VERSION@.*.so
 | ||||||
|  | +   obj:*lib*@GLIBC_VERSION@*.so
 | ||||||
|  |  } | ||||||
|  |   | ||||||
|  |  { | ||||||
							
								
								
									
										1803
									
								
								SPECS/valgrind.spec
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1803
									
								
								SPECS/valgrind.spec
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Loading…
	
		Reference in New Issue
	
	Block a user