3.16.0-0.2.GIT
This commit is contained in:
		
							parent
							
								
									848b6a726b
								
							
						
					
					
						commit
						28efd007fc
					
				
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -34,3 +34,4 @@ | ||||
| /valgrind-3.15.0.RC1.tar.bz2 | ||||
| /valgrind-3.15.0.RC2.tar.bz2 | ||||
| /valgrind-3.15.0.tar.bz2 | ||||
| /valgrind-3.16.0.GIT.tar.bz2 | ||||
|  | ||||
							
								
								
									
										2
									
								
								sources
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								sources
									
									
									
									
									
								
							| @ -1 +1 @@ | ||||
| SHA512 (valgrind-3.15.0.tar.bz2) = 5695d1355226fb63b0c80809ed43bb077b6eed4d427792d9d7ed944c38b557a84fe3c783517b921e32f161228e10e4625bea0550faa4685872bb4454450cfa7f | ||||
| SHA512 (valgrind-3.16.0.GIT.tar.bz2) = 74ed4e090ff3412458fef1b1d5c451d71551545234cff8328a2db9cd7f2b3feeba4fc53121844afafaa1f5fb0334df33446d15dabb0fa9136840d5dac9282f12 | ||||
|  | ||||
| @ -1,18 +0,0 @@ | ||||
| commit 9616e9bc9a1950f70ab1abd1c6ca9abc3f26eb7f | ||||
| Author: Mark Wielaard <mark@klomp.org> | ||||
| Date:   Fri May 31 15:11:35 2019 +0200 | ||||
| 
 | ||||
|     Hook up membarrier syscall for arm-linux. | ||||
| 
 | ||||
| diff --git a/coregrind/m_syswrap/syswrap-arm-linux.c b/coregrind/m_syswrap/syswrap-arm-linux.c
 | ||||
| index 3c5194d55..5e8baf8db 100644
 | ||||
| --- a/coregrind/m_syswrap/syswrap-arm-linux.c
 | ||||
| +++ b/coregrind/m_syswrap/syswrap-arm-linux.c
 | ||||
| @@ -1014,6 +1014,7 @@ static SyscallTableEntry syscall_main_table[] = {
 | ||||
|     LINXY(__NR_getrandom,         sys_getrandom),        // 384 | ||||
|     LINXY(__NR_memfd_create,      sys_memfd_create),     // 385 | ||||
|   | ||||
| +   LINX_(__NR_membarrier,        sys_membarrier),       // 389
 | ||||
|     LINX_(__NR_copy_file_range,   sys_copy_file_range),  // 391 | ||||
|   | ||||
|     LINXY(__NR_statx,             sys_statx),            // 397 | ||||
| @ -1,21 +0,0 @@ | ||||
| commit 2d040ce2c7fd328b4e8b0c2363ebe0c2ea2cbc9f | ||||
| Author: Mark Wielaard <mark@klomp.org> | ||||
| Date:   Sat Jan 25 15:10:22 2020 +0100 | ||||
| 
 | ||||
|     arm: Hook up preadv2 and pwritev2 syscalls. | ||||
|      | ||||
|     They work the same as on other linux architectures. | ||||
| 
 | ||||
| diff --git a/coregrind/m_syswrap/syswrap-arm-linux.c b/coregrind/m_syswrap/syswrap-arm-linux.c
 | ||||
| index 93ebc3f4d..18468f07e 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[] = {
 | ||||
|   | ||||
|     LINX_(__NR_membarrier,        sys_membarrier),       // 389 | ||||
|     LINX_(__NR_copy_file_range,   sys_copy_file_range),  // 391 | ||||
| +   LINXY(__NR_preadv2,           sys_preadv2),          // 392
 | ||||
| +   LINX_(__NR_pwritev2,          sys_pwritev2),         // 393
 | ||||
|   | ||||
|     LINXY(__NR_statx,             sys_statx),            // 397 | ||||
|   | ||||
| @ -1,45 +0,0 @@ | ||||
| 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) | ||||
| @ -1,95 +0,0 @@ | ||||
| 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; | ||||
|       } | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -1,374 +0,0 @@ | ||||
| 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); | ||||
| @ -1,34 +0,0 @@ | ||||
| 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
 | ||||
| @ -1,29 +0,0 @@ | ||||
| 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 | ||||
| @ -1,20 +0,0 @@ | ||||
| diff --git a/none/tests/x86/incdec_alt.c b/none/tests/x86/incdec_alt.c
 | ||||
| index 2db324275..b8ff5c07e 100644
 | ||||
| --- a/none/tests/x86/incdec_alt.c
 | ||||
| +++ b/none/tests/x86/incdec_alt.c
 | ||||
| @@ -8,6 +8,7 @@ int r1,r2,r3,r4,r5,r6,r7,r8,a1,a2;
 | ||||
|   | ||||
|  extern void foo ( void ); | ||||
|  asm("\n" | ||||
| +".text\n"
 | ||||
|  VG_SYM(foo) ":\n" | ||||
|  "\tpushl $0\n" | ||||
|  "\tpopfl\n" | ||||
| @@ -49,6 +50,7 @@ VG_SYM(foo) ":\n"
 | ||||
|  "\tpopl " VG_SYM(r8) "\n" | ||||
|   | ||||
|  "\tret\n" | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|  int main ( void ) | ||||
| @ -1,13 +0,0 @@ | ||||
| diff --git a/VEX/priv/guest_s390_defs.h b/VEX/priv/guest_s390_defs.h
 | ||||
| index b9f038aaa..9f93cff19 100644
 | ||||
| --- a/VEX/priv/guest_s390_defs.h
 | ||||
| +++ b/VEX/priv/guest_s390_defs.h
 | ||||
| @@ -261,7 +261,7 @@ extern ULong last_execute_target;
 | ||||
|  /* Vector operatons passed to s390x_dirtyhelper_vec_op(...) helper. | ||||
|     Please don't change ordering of elements and append new items | ||||
|     before  S390_VEC_OP_LAST. */ | ||||
| -enum {
 | ||||
| +typedef enum {
 | ||||
|     S390_VEC_OP_INVALID = 0, | ||||
|     S390_VEC_OP_VPKS = 1, | ||||
|     S390_VEC_OP_VPKLS = 2, | ||||
| @ -1,644 +0,0 @@ | ||||
| commit fe6805efc1b6db0cfa5f1cd5fb1854775cbfa31a | ||||
| Author: Mark Wielaard <mark@klomp.org> | ||||
| Date:   Sat Jan 25 18:34:58 2020 +0100 | ||||
| 
 | ||||
|     x86 and amd64 tests: Use .text and .previous around all top-level asm. | ||||
|      | ||||
|     GCC10 defaults to -fno-common which exposes some latent bugs in | ||||
|     some of the top-level asm code in various .c test files. Some of the | ||||
|     tests started to segfault (even if not run under valgrind). Such code | ||||
|     needs to be wrapped inside a .text and a .previous asm statement to | ||||
|     make sure the code is generated in the .text code section and to | ||||
|     make sure the compiler doesn't lose track of the section currently | ||||
|     being used to generate data or code in. Without it code might be | ||||
|     generated inside a data section or the other way around. | ||||
| 
 | ||||
| diff --git a/memcheck/tests/amd64/shr_edx.c b/memcheck/tests/amd64/shr_edx.c
 | ||||
| index f8746afff..bed289471 100644
 | ||||
| --- a/memcheck/tests/amd64/shr_edx.c
 | ||||
| +++ b/memcheck/tests/amd64/shr_edx.c
 | ||||
| @@ -8,6 +8,7 @@ ULong result;
 | ||||
|   | ||||
|  extern void shrl32_with_0x10 ( void ); | ||||
|  asm("\n" | ||||
| +".text\n"
 | ||||
|  "shrl32_with_0x10:\n" | ||||
|  "\tpushq %rdx\n" | ||||
|  "\tmovq data, %rdx\n" | ||||
| @@ -20,6 +21,7 @@ asm("\n"
 | ||||
|  "\tshrl32_with_0x10_jump:\n" | ||||
|  "\tmov $0xdeaddead, %edx\n" | ||||
|  "\tjmp shrl32_with_0x10_cont\n" | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|   | ||||
| diff --git a/none/tests/amd64/fxtract.c b/none/tests/amd64/fxtract.c
 | ||||
| index 4dff2a1f9..f4dfd36df 100644
 | ||||
| --- a/none/tests/amd64/fxtract.c
 | ||||
| +++ b/none/tests/amd64/fxtract.c
 | ||||
| @@ -6,6 +6,7 @@ double arg, res1, res2;
 | ||||
|   | ||||
|  extern void do_fxtract ( void ); | ||||
|  asm("\n" | ||||
| +".text\n"
 | ||||
|  ".global do_fxtract\n" | ||||
|  "do_fxtract:\n" | ||||
|  "\tfinit\n" | ||||
| @@ -13,7 +14,8 @@ asm("\n"
 | ||||
|  "\tfxtract\n" | ||||
|  "\tfstpl res1\n" | ||||
|  "\tfstpl res2\n" | ||||
| -"\tret"
 | ||||
| +"\tret\n"
 | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|  void try ( double x ) | ||||
| diff --git a/none/tests/amd64/jrcxz.c b/none/tests/amd64/jrcxz.c
 | ||||
| index dad088f08..4d70734c2 100644
 | ||||
| --- a/none/tests/amd64/jrcxz.c
 | ||||
| +++ b/none/tests/amd64/jrcxz.c
 | ||||
| @@ -8,6 +8,7 @@ ULong arg64, res64;
 | ||||
|   | ||||
|  extern void foo64 ( void ); | ||||
|  asm("\n" | ||||
| +".text\n"
 | ||||
|  "foo64:\n" | ||||
|  "\tpushq %rcx\n" | ||||
|   | ||||
| @@ -25,6 +26,7 @@ asm("\n"
 | ||||
|   | ||||
|  "\tpopq %rcx\n" | ||||
|  "\tret\n" | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|   | ||||
| @@ -32,6 +34,7 @@ UInt arg32, res32;
 | ||||
|   | ||||
|  extern void foo32 ( void ); | ||||
|  asm("\n" | ||||
| +".text\n"
 | ||||
|  "foo32:\n" | ||||
|  "\tpushq %rcx\n" | ||||
|   | ||||
| @@ -49,6 +52,7 @@ asm("\n"
 | ||||
|   | ||||
|  "\tpopq %rcx\n" | ||||
|  "\tret\n" | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|   | ||||
| diff --git a/none/tests/amd64/looper.c b/none/tests/amd64/looper.c
 | ||||
| index cb7f5cbea..586464242 100644
 | ||||
| --- a/none/tests/amd64/looper.c
 | ||||
| +++ b/none/tests/amd64/looper.c
 | ||||
| @@ -22,6 +22,7 @@ asm("\n"
 | ||||
|  "\tmovq %rax, res\n" | ||||
|  "\tpopq %rcx\n" | ||||
|  "\tret\n" | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|  extern void loop_ne ( void ); | ||||
| @@ -42,6 +43,7 @@ asm("\n"
 | ||||
|  "\tmovq %rax, res\n" | ||||
|  "\tpopq %rcx\n" | ||||
|  "\tret\n" | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|  extern void loop_e ( void ); | ||||
| @@ -66,6 +68,7 @@ asm("\n"
 | ||||
|  "\tmovq %rax, res\n" | ||||
|  "\tpopq %rcx\n" | ||||
|  "\tret\n" | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|  int main ( void ) | ||||
| diff --git a/none/tests/amd64/sbbmisc.c b/none/tests/amd64/sbbmisc.c
 | ||||
| index dd70efadc..1024bfd57 100644
 | ||||
| --- a/none/tests/amd64/sbbmisc.c
 | ||||
| +++ b/none/tests/amd64/sbbmisc.c
 | ||||
| @@ -9,6 +9,7 @@ int in_l, out_l1, out_l2;
 | ||||
|   | ||||
|  extern void sbb_ib_al ( void ); | ||||
|  asm("\n" | ||||
| +".text\n"
 | ||||
|  VG_SYM(sbb_ib_al) ":\n" | ||||
|   | ||||
|  #ifndef VGP_amd64_darwin | ||||
| @@ -37,11 +38,13 @@ VG_SYM(sbb_ib_al) ":\n"
 | ||||
|  #endif | ||||
|   | ||||
|  "\tretq\n" | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|   | ||||
|  extern void sbb_iw_ax ( void ); | ||||
|  asm("\n" | ||||
| +".text\n"
 | ||||
|  VG_SYM(sbb_iw_ax) ":\n" | ||||
|   | ||||
|  #ifndef VGP_amd64_darwin | ||||
| @@ -69,11 +72,13 @@ VG_SYM(sbb_iw_ax) ":\n"
 | ||||
|  #endif | ||||
|   | ||||
|  "\tretq\n" | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|   | ||||
|  extern void sbb_il_eax ( void ); | ||||
|  asm("\n" | ||||
| +".text\n"
 | ||||
|  VG_SYM(sbb_il_eax) ":\n" | ||||
|   | ||||
|  #ifndef VGP_amd64_darwin | ||||
| @@ -101,11 +106,13 @@ VG_SYM(sbb_il_eax) ":\n"
 | ||||
|  #endif | ||||
|   | ||||
|  "\tretq\n" | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|   | ||||
|  extern void sbb_eb_gb ( void ); | ||||
|  asm("\n" | ||||
| +".text\n"
 | ||||
|  VG_SYM(sbb_eb_gb) ":\n" | ||||
|   | ||||
|  #ifndef VGP_amd64_darwin | ||||
| @@ -135,11 +142,13 @@ VG_SYM(sbb_eb_gb) ":\n"
 | ||||
|  #endif | ||||
|   | ||||
|  "\tretq\n" | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|   | ||||
|  extern void sbb_eb_gb_2 ( void ); | ||||
|  asm("\n" | ||||
| +".text\n"
 | ||||
|  VG_SYM(sbb_eb_gb_2) ":\n" | ||||
|  "\tpushq %rcx\n" | ||||
|   | ||||
| @@ -173,11 +182,13 @@ VG_SYM(sbb_eb_gb_2) ":\n"
 | ||||
|   | ||||
|  "\tpopq %rcx\n" | ||||
|  "\tretq\n" | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|   | ||||
|  extern void adc_eb_gb ( void ); | ||||
|  asm("\n" | ||||
| +".text\n"
 | ||||
|  VG_SYM(adc_eb_gb) ":\n" | ||||
|   | ||||
|  #ifndef VGP_amd64_darwin | ||||
| @@ -207,11 +218,13 @@ VG_SYM(adc_eb_gb) ":\n"
 | ||||
|  #endif | ||||
|   | ||||
|  "\tretq\n" | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|   | ||||
|  extern void adc_eb_gb_2 ( void ); | ||||
|  asm("\n" | ||||
| +".text\n"
 | ||||
|  VG_SYM(adc_eb_gb_2) ":\n" | ||||
|  "\tpushq %rcx\n" | ||||
|   | ||||
| @@ -245,10 +258,12 @@ VG_SYM(adc_eb_gb_2) ":\n"
 | ||||
|   | ||||
|  "\tpopq %rcx\n" | ||||
|  "\tretq\n" | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|  extern void adc_ib_al ( void ); | ||||
|  asm("\n" | ||||
| +".text\n"
 | ||||
|  VG_SYM(adc_ib_al) ":\n" | ||||
|   | ||||
|  #ifndef VGP_amd64_darwin | ||||
| @@ -276,11 +291,13 @@ VG_SYM(adc_ib_al) ":\n"
 | ||||
|  #endif | ||||
|   | ||||
|  "\tretq\n" | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|   | ||||
|  extern void adc_iw_ax ( void ); | ||||
|  asm("\n" | ||||
| +".text\n"
 | ||||
|  VG_SYM(adc_iw_ax) ":\n" | ||||
|   | ||||
|  #ifndef VGP_amd64_darwin | ||||
| @@ -308,11 +325,13 @@ VG_SYM(adc_iw_ax) ":\n"
 | ||||
|  #endif | ||||
|   | ||||
|  "\tretq\n" | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|   | ||||
|  extern void adc_il_eax ( void ); | ||||
|  asm("\n" | ||||
| +".text\n"
 | ||||
|  VG_SYM(adc_il_eax) ":\n" | ||||
|   | ||||
|  #ifndef VGP_amd64_darwin | ||||
| @@ -340,6 +359,7 @@ VG_SYM(adc_il_eax) ":\n"
 | ||||
|  #endif | ||||
|   | ||||
|  "\tretq\n" | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|   | ||||
| diff --git a/none/tests/amd64/shrld.c b/none/tests/amd64/shrld.c
 | ||||
| index ca9d699e2..d77cfbdc9 100644
 | ||||
| --- a/none/tests/amd64/shrld.c
 | ||||
| +++ b/none/tests/amd64/shrld.c
 | ||||
| @@ -30,6 +30,7 @@ ULong flags_out;
 | ||||
|   | ||||
|  extern void shld64 ( void ); | ||||
|  asm("\n" | ||||
| +".text\n"
 | ||||
|  "shld64:\n" | ||||
|  "\tpushq %rsi\n" | ||||
|  "\tpushq %r11\n" | ||||
| @@ -47,10 +48,12 @@ asm("\n"
 | ||||
|  "\tpopq %r11\n" | ||||
|  "\tpopq %rsi\n" | ||||
|  "\tret\n" | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|  extern void shld32 ( void ); | ||||
|  asm("\n" | ||||
| +".text\n"
 | ||||
|  "shld32:\n" | ||||
|  "\tpushq %rsi\n" | ||||
|  "\tpushq %r11\n" | ||||
| @@ -68,10 +71,12 @@ asm("\n"
 | ||||
|  "\tpopq %r11\n" | ||||
|  "\tpopq %rsi\n" | ||||
|  "\tret\n" | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|  extern void shld16 ( void ); | ||||
|  asm("\n" | ||||
| +".text\n"
 | ||||
|  "shld16:\n" | ||||
|  "\tpushq %rsi\n" | ||||
|  "\tpushq %r11\n" | ||||
| @@ -89,11 +94,13 @@ asm("\n"
 | ||||
|  "\tpopq %r11\n" | ||||
|  "\tpopq %rsi\n" | ||||
|  "\tret\n" | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|   | ||||
|  extern void shrd64 ( void ); | ||||
|  asm("\n" | ||||
| +".text\n"
 | ||||
|  "shrd64:\n" | ||||
|  "\tpushq %rsi\n" | ||||
|  "\tpushq %r11\n" | ||||
| @@ -111,10 +118,12 @@ asm("\n"
 | ||||
|  "\tpopq %r11\n" | ||||
|  "\tpopq %rsi\n" | ||||
|  "\tret\n" | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|  extern void shrd32 ( void ); | ||||
|  asm("\n" | ||||
| +".text\n"
 | ||||
|  "shrd32:\n" | ||||
|  "\tpushq %rsi\n" | ||||
|  "\tpushq %r11\n" | ||||
| @@ -132,10 +141,12 @@ asm("\n"
 | ||||
|  "\tpopq %r11\n" | ||||
|  "\tpopq %rsi\n" | ||||
|  "\tret\n" | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|  extern void shrd16 ( void ); | ||||
|  asm("\n" | ||||
| +".text\n"
 | ||||
|  "shrd16:\n" | ||||
|  "\tpushq %rsi\n" | ||||
|  "\tpushq %r11\n" | ||||
| @@ -153,6 +164,7 @@ asm("\n"
 | ||||
|  "\tpopq %r11\n" | ||||
|  "\tpopq %rsi\n" | ||||
|  "\tret\n" | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|   | ||||
| diff --git a/none/tests/amd64/slahf-amd64.c b/none/tests/amd64/slahf-amd64.c
 | ||||
| index 31857ecba..361b6791b 100644
 | ||||
| --- a/none/tests/amd64/slahf-amd64.c
 | ||||
| +++ b/none/tests/amd64/slahf-amd64.c
 | ||||
| @@ -5,6 +5,7 @@ typedef unsigned long long int ULong;
 | ||||
|   | ||||
|  extern ULong lahf_1 ( void ); | ||||
|  asm("\n" | ||||
| +".text\n"
 | ||||
|  "lahf_1:\n" | ||||
|  "\tpushq $0\n" | ||||
|  "\tpopfq\n" | ||||
| @@ -13,10 +14,12 @@ asm("\n"
 | ||||
|  "\tsubq %rax, %rdx\n" | ||||
|  "\t.byte 0x9F\n" /* lahf */ | ||||
|  "\tret\n" | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|  extern ULong lahf_0 ( void ); | ||||
|  asm("\n" | ||||
| +".text\n"
 | ||||
|  "lahf_0:\n" | ||||
|  "\tpushq $0\n" | ||||
|  "\tpopfq\n" | ||||
| @@ -25,16 +28,19 @@ asm("\n"
 | ||||
|  "\tsubq %rax, %rdx\n" | ||||
|  "\t.byte 0x9F\n" /* lahf */ | ||||
|  "\tret\n" | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|  extern ULong sahf_then_lahf ( ULong ); | ||||
|  asm("\n" | ||||
| +".text\n"
 | ||||
|  "sahf_then_lahf:\n" | ||||
|  "\tmovq %rdi, %rax\n" | ||||
|  "\t.byte 0x9E\n" /* sahf */ | ||||
|  "\tmovabsq $0, %rax\n" | ||||
|  "\t.byte 0x9F\n" /* lahf */ | ||||
|  "\tret\n" | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|  int main ( void ) | ||||
| diff --git a/none/tests/x86/cmpxchg8b.c b/none/tests/x86/cmpxchg8b.c
 | ||||
| index 3588840a8..9ca56afa6 100644
 | ||||
| --- a/none/tests/x86/cmpxchg8b.c
 | ||||
| +++ b/none/tests/x86/cmpxchg8b.c
 | ||||
| @@ -14,6 +14,7 @@ UInt zout;
 | ||||
|   | ||||
|  extern void foo ( void ); | ||||
|  asm("\n" | ||||
| +    ".text\n"
 | ||||
|      VG_SYM(foo) ":\n" | ||||
|      "\tpushl %eax\n" | ||||
|      "\tpushl %ebx\n" | ||||
| @@ -40,6 +41,7 @@ asm("\n"
 | ||||
|      "\tpopl %ebx\n" | ||||
|      "\tpopl %eax\n" | ||||
|      "\tret\n" | ||||
| +    ".previous\n"
 | ||||
|      ); | ||||
|   | ||||
|  int main ( void ) | ||||
| diff --git a/none/tests/x86/fxtract.c b/none/tests/x86/fxtract.c
 | ||||
| index 235cda72c..f8c9bc41a 100644
 | ||||
| --- a/none/tests/x86/fxtract.c
 | ||||
| +++ b/none/tests/x86/fxtract.c
 | ||||
| @@ -6,13 +6,15 @@ double arg, res1, res2;
 | ||||
|   | ||||
|  extern void do_fxtract ( void ); | ||||
|  asm("\n" | ||||
| +".text\n"
 | ||||
|  VG_SYM(do_fxtract) ":\n" | ||||
|  "\tfinit\n" | ||||
|  "\tfldl " VG_SYM(arg) "\n" | ||||
|  "\tfxtract\n" | ||||
|  "\tfstpl " VG_SYM(res1) "\n" | ||||
|  "\tfstpl " VG_SYM(res2) "\n" | ||||
| -"\tret"
 | ||||
| +"\tret\n"
 | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|  void try ( double x ) | ||||
| diff --git a/none/tests/x86/lahf.c b/none/tests/x86/lahf.c
 | ||||
| index fc09352ac..a04c10da9 100644
 | ||||
| --- a/none/tests/x86/lahf.c
 | ||||
| +++ b/none/tests/x86/lahf.c
 | ||||
| @@ -3,6 +3,7 @@
 | ||||
|   | ||||
|  extern int foo_1 ( void ); | ||||
|  asm("\n" | ||||
| +".text\n"
 | ||||
|  VG_SYM(foo_1) ":\n" | ||||
|  "\tpushl $0\n" | ||||
|  "\tpopfl\n" | ||||
| @@ -11,10 +12,12 @@ VG_SYM(foo_1) ":\n"
 | ||||
|  "\tsubl %eax, %edx\n" | ||||
|  "\tlahf\n" | ||||
|  "\tret\n" | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|  extern int foo_0 ( void ); | ||||
|  asm("\n" | ||||
| +".text\n"
 | ||||
|  VG_SYM(foo_0) ":\n" | ||||
|  "\tpushl $0\n" | ||||
|  "\tpopfl\n" | ||||
| @@ -23,6 +26,7 @@ VG_SYM(foo_0) ":\n"
 | ||||
|  "\tsubl %eax, %edx\n" | ||||
|  "\tlahf\n" | ||||
|  "\tret\n" | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|  int main ( void ) | ||||
| diff --git a/none/tests/x86/looper.c b/none/tests/x86/looper.c
 | ||||
| index 60554ec76..7f7ace8ad 100644
 | ||||
| --- a/none/tests/x86/looper.c
 | ||||
| +++ b/none/tests/x86/looper.c
 | ||||
| @@ -21,6 +21,7 @@ VG_SYM(loop_plain) ":\n"
 | ||||
|  "\tmovl %eax, " VG_SYM(res) "\n" | ||||
|  "\tpopl %ecx\n" | ||||
|  "\tret\n" | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|  extern void loop_ne ( void ); | ||||
| @@ -40,6 +41,7 @@ VG_SYM(loop_ne) ":\n"
 | ||||
|  "\tmovl %eax, " VG_SYM(res) "\n" | ||||
|  "\tpopl %ecx\n" | ||||
|  "\tret\n" | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|  extern void loop_e ( void ); | ||||
| @@ -63,6 +65,7 @@ VG_SYM(loop_e) ":\n"
 | ||||
|  "\tmovl %eax, " VG_SYM(res) "\n" | ||||
|  "\tpopl %ecx\n" | ||||
|  "\tret\n" | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|  int main ( void ) | ||||
| diff --git a/none/tests/x86/sbbmisc.c b/none/tests/x86/sbbmisc.c
 | ||||
| index 322d6e17d..7c4585d95 100644
 | ||||
| --- a/none/tests/x86/sbbmisc.c
 | ||||
| +++ b/none/tests/x86/sbbmisc.c
 | ||||
| @@ -9,6 +9,7 @@ int in_l, out_l1, out_l2;
 | ||||
|   | ||||
|  extern void sbb_ib_al ( void ); | ||||
|  asm("\n" | ||||
| +".text\n"
 | ||||
|  VG_SYM(sbb_ib_al) ":\n" | ||||
|   | ||||
|  "\tmovb " VG_SYM(in_b) ", %al\n" | ||||
| @@ -22,11 +23,13 @@ VG_SYM(sbb_ib_al) ":\n"
 | ||||
|  "\tmovb %al, " VG_SYM(out_b2) "\n" | ||||
|   | ||||
|  "\tret\n" | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|   | ||||
|  extern void sbb_iw_ax ( void ); | ||||
|  asm("\n" | ||||
| +".text\n"
 | ||||
|  VG_SYM(sbb_iw_ax) ":\n" | ||||
|   | ||||
|  "\tmovw " VG_SYM(in_w) ", %ax\n" | ||||
| @@ -40,11 +43,13 @@ VG_SYM(sbb_iw_ax) ":\n"
 | ||||
|  "\tmovw %ax, " VG_SYM(out_w2) "\n" | ||||
|   | ||||
|  "\tret\n" | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|   | ||||
|  extern void sbb_il_eax ( void ); | ||||
|  asm("\n" | ||||
| +".text\n"
 | ||||
|  VG_SYM(sbb_il_eax) ":\n" | ||||
|   | ||||
|  "\tmovl " VG_SYM(in_l) ", %eax\n" | ||||
| @@ -58,11 +63,13 @@ VG_SYM(sbb_il_eax) ":\n"
 | ||||
|  "\tmovl %eax, " VG_SYM(out_l2) "\n" | ||||
|   | ||||
|  "\tret\n" | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|   | ||||
|  extern void sbb_eb_gb ( void ); | ||||
|  asm("\n" | ||||
| +".text\n"
 | ||||
|  VG_SYM(sbb_eb_gb) ":\n" | ||||
|   | ||||
|  "\tmovb " VG_SYM(in_b) ", %al\n" | ||||
| @@ -76,11 +83,13 @@ VG_SYM(sbb_eb_gb) ":\n"
 | ||||
|  "\tmovb %al, " VG_SYM(out_b2) "\n" | ||||
|   | ||||
|  "\tret\n" | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|   | ||||
|  extern void sbb_eb_gb_2 ( void ); | ||||
|  asm("\n" | ||||
| +".text\n"
 | ||||
|  VG_SYM(sbb_eb_gb_2) ":\n" | ||||
|  "\tpushl %ecx\n" | ||||
|   | ||||
| @@ -98,11 +107,13 @@ VG_SYM(sbb_eb_gb_2) ":\n"
 | ||||
|   | ||||
|  "\tpopl %ecx\n" | ||||
|  "\tret\n" | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|   | ||||
|  extern void adc_eb_gb ( void ); | ||||
|  asm("\n" | ||||
| +".text\n"
 | ||||
|  VG_SYM(adc_eb_gb) ":\n" | ||||
|   | ||||
|  "\tmovb " VG_SYM(in_b) ", %al\n" | ||||
| @@ -116,11 +127,13 @@ VG_SYM(adc_eb_gb) ":\n"
 | ||||
|  "\tmovb %al, " VG_SYM(out_b2) "\n" | ||||
|   | ||||
|  "\tret\n" | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|   | ||||
|  extern void adc_eb_gb_2 ( void ); | ||||
|  asm("\n" | ||||
| +".text\n"
 | ||||
|  VG_SYM(adc_eb_gb_2) ":\n" | ||||
|  "\tpushl %ecx\n" | ||||
|   | ||||
| @@ -138,10 +151,12 @@ VG_SYM(adc_eb_gb_2) ":\n"
 | ||||
|   | ||||
|  "\tpopl %ecx\n" | ||||
|  "\tret\n" | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|  extern void adc_ib_al ( void ); | ||||
|  asm("\n" | ||||
| +".text\n"
 | ||||
|  VG_SYM(adc_ib_al) ":\n" | ||||
|   | ||||
|  "\tmovb " VG_SYM(in_b) ", %al\n" | ||||
| @@ -155,11 +170,13 @@ VG_SYM(adc_ib_al) ":\n"
 | ||||
|  "\tmovb %al, " VG_SYM(out_b2) "\n" | ||||
|   | ||||
|  "\tret\n" | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|   | ||||
|  extern void adc_iw_ax ( void ); | ||||
|  asm("\n" | ||||
| +".text\n"
 | ||||
|  VG_SYM(adc_iw_ax) ":\n" | ||||
|   | ||||
|  "\tmovw " VG_SYM(in_w) ", %ax\n" | ||||
| @@ -173,11 +190,13 @@ VG_SYM(adc_iw_ax) ":\n"
 | ||||
|  "\tmovw %ax, " VG_SYM(out_w2) "\n" | ||||
|   | ||||
|  "\tret\n" | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|   | ||||
|  extern void adc_il_eax ( void ); | ||||
|  asm("\n" | ||||
| +".text\n"
 | ||||
|  VG_SYM(adc_il_eax) ":\n" | ||||
|   | ||||
|  "\tmovl " VG_SYM(in_l) ", %eax\n" | ||||
| @@ -191,6 +210,7 @@ VG_SYM(adc_il_eax) ":\n"
 | ||||
|  "\tmovl %eax, " VG_SYM(out_l2) "\n" | ||||
|   | ||||
|  "\tret\n" | ||||
| +".previous\n"
 | ||||
|  ); | ||||
|   | ||||
|   | ||||
| @ -1,89 +0,0 @@ | ||||
| diff --git a/none/tests/ppc64/test_isa_2_07_part1.c b/none/tests/ppc64/test_isa_2_07_part1.c
 | ||||
| index 187af3741..0efd39c1c 100644
 | ||||
| --- a/none/tests/ppc64/test_isa_2_07_part1.c
 | ||||
| +++ b/none/tests/ppc64/test_isa_2_07_part1.c
 | ||||
| @@ -384,27 +384,27 @@ static void test_fmrgow (void)
 | ||||
|  // VSX move instructions | ||||
|  static void test_mfvsrd (void) | ||||
|  { | ||||
| -   __asm__ __volatile__ ("mfvsrd %0,%x1" : "=r" (r14) : "ws" (vec_inA));
 | ||||
| +   __asm__ __volatile__ ("mfvsrd %0,%x1" : "=r" (r14) : "wa" (vec_inA));
 | ||||
|  }; | ||||
|   | ||||
|  static void test_mfvsrwz (void) | ||||
|  { | ||||
| -   __asm__ __volatile__ ("mfvsrwz %0,%x1" : "=r" (r14) : "ws" (vec_inA));
 | ||||
| +   __asm__ __volatile__ ("mfvsrwz %0,%x1" : "=r" (r14) : "wa" (vec_inA));
 | ||||
|  }; | ||||
|   | ||||
|  static void test_mtvsrd (void) | ||||
|  { | ||||
| -   __asm__ __volatile__ ("mtvsrd %x0,%1" : "=ws" (vec_out) : "r" (r14));
 | ||||
| +   __asm__ __volatile__ ("mtvsrd %x0,%1" : "=wa" (vec_out) : "r" (r14));
 | ||||
|  }; | ||||
|   | ||||
|  static void test_mtvsrwz (void) | ||||
|  { | ||||
| -   __asm__ __volatile__ ("mtvsrwz %x0,%1" : "=ws" (vec_out) : "r" (r14));
 | ||||
| +   __asm__ __volatile__ ("mtvsrwz %x0,%1" : "=wa" (vec_out) : "r" (r14));
 | ||||
|  }; | ||||
|   | ||||
|  static void test_mtvsrwa (void) | ||||
|  { | ||||
| -   __asm__ __volatile__ ("mtvsrwa %x0,%1" : "=ws" (vec_out) : "r" (r14));
 | ||||
| +   __asm__ __volatile__ ("mtvsrwa %x0,%1" : "=wa" (vec_out) : "r" (r14));
 | ||||
|  }; | ||||
|   | ||||
|  static void test_mtfprwa (void) | ||||
| diff --git a/none/tests/ppc64/test_isa_3_0.c b/none/tests/ppc64/test_isa_3_0.c
 | ||||
| index 78b5130c1..cf9df8ac9 100644
 | ||||
| --- a/none/tests/ppc64/test_isa_3_0.c
 | ||||
| +++ b/none/tests/ppc64/test_isa_3_0.c
 | ||||
| @@ -1177,23 +1177,23 @@ static void test_xscmpexpdp(void) {
 | ||||
|  } | ||||
|   | ||||
|  static void test_xscmpeqdp(void) { | ||||
| -   __asm__ __volatile__ ("xscmpeqdp   %x0, %x1, %x2 " : "+wa" (vec_xt): "ww" (vec_xa), "ww" (vec_xb));
 | ||||
| +   __asm__ __volatile__ ("xscmpeqdp   %x0, %x1, %x2 " : "+wa" (vec_xt): "wa" (vec_xa), "wa" (vec_xb));
 | ||||
|  } | ||||
|   | ||||
|  static void test_xscmpgtdp(void) { | ||||
| -   __asm__ __volatile__ ("xscmpgtdp   %x0, %x1, %x2 " : "+wa" (vec_xt): "ww" (vec_xa), "ww" (vec_xb));
 | ||||
| +   __asm__ __volatile__ ("xscmpgtdp   %x0, %x1, %x2 " : "+wa" (vec_xt): "wa" (vec_xa), "wa" (vec_xb));
 | ||||
|  } | ||||
|   | ||||
|  static void test_xscmpgedp(void) { | ||||
| -   __asm__ __volatile__ ("xscmpgedp   %x0, %x1, %x2 " : "+wa" (vec_xt): "ww" (vec_xa), "ww" (vec_xb));
 | ||||
| +   __asm__ __volatile__ ("xscmpgedp   %x0, %x1, %x2 " : "+wa" (vec_xt): "wa" (vec_xa), "wa" (vec_xb));
 | ||||
|  } | ||||
|   | ||||
|  static void test_xsmincdp(void) { | ||||
| -   __asm__ __volatile__ ("xsmincdp   %x0, %x1, %x2 " : "+wa" (vec_xt): "ww" (vec_xa), "ww" (vec_xb));
 | ||||
| +   __asm__ __volatile__ ("xsmincdp   %x0, %x1, %x2 " : "+wa" (vec_xt): "wa" (vec_xa), "wa" (vec_xb));
 | ||||
|  } | ||||
|   | ||||
|  static void test_xsmaxcdp(void) { | ||||
| -   __asm__ __volatile__ ("xsmaxcdp   %x0, %x1, %x2 " : "+wa" (vec_xt): "ww" (vec_xa), "ww" (vec_xb));
 | ||||
| +   __asm__ __volatile__ ("xsmaxcdp   %x0, %x1, %x2 " : "+wa" (vec_xt): "wa" (vec_xa), "wa" (vec_xb));
 | ||||
|  } | ||||
|   | ||||
|  static test_list_t testgroup_vector_scalar_compare_double[] = { | ||||
| @@ -1827,15 +1827,15 @@ static void test_xscvhpdp(void) {
 | ||||
|  } | ||||
|   | ||||
|  static void test_xscvdphp(void) { | ||||
| -   __asm__ __volatile__ ("xscvdphp %x0, %x1 " : "+wi" (vec_xt) : "wi" (vec_xb));
 | ||||
| +   __asm__ __volatile__ ("xscvdphp %x0, %x1 " : "+wa" (vec_xt) : "wa" (vec_xb));
 | ||||
|  } | ||||
|   | ||||
|  static void test_xvcvhpsp(void) { | ||||
| -   __asm__ __volatile__ ("xvcvhpsp %x0, %x1 " : "+ww" (vec_xt) : "ww" (vec_xb));
 | ||||
| +   __asm__ __volatile__ ("xvcvhpsp %x0, %x1 " : "+wa" (vec_xt) : "wa" (vec_xb));
 | ||||
|  } | ||||
|   | ||||
|  static void test_xvcvsphp(void) { | ||||
| -   __asm__ __volatile__ ("xvcvsphp %x0, %x1 " : "+ww" (vec_xt) : "ww" (vec_xb));
 | ||||
| +   __asm__ __volatile__ ("xvcvsphp %x0, %x1 " : "+wa" (vec_xt) : "wa" (vec_xb));
 | ||||
|  } | ||||
|   | ||||
|  static test_list_t testgroup_vector_scalar_two_double[] = { | ||||
| @ -1,42 +0,0 @@ | ||||
| diff --git a/glibc-2.X.supp.in b/glibc-2.X.supp.in
 | ||||
| index 126e8b338..eeefa3935 100644
 | ||||
| --- a/glibc-2.X.supp.in
 | ||||
| +++ b/glibc-2.X.supp.in
 | ||||
| @@ -248,3 +248,37 @@
 | ||||
|     Memcheck:Cond | ||||
|     fun:_dl_runtime_resolve_avx_slow | ||||
|  } | ||||
| +
 | ||||
| +# The main thread dynamic thread vector, DTV, which contains pointers
 | ||||
| +# to thread local variables, isn't freed.  There are a couple of call
 | ||||
| +# patterns that can cause it to be extended.
 | ||||
| +{
 | ||||
| +  dtv-addr-tail
 | ||||
| +  Memcheck:Leak
 | ||||
| +  match-leak-kinds: possible,reachable
 | ||||
| +  fun:malloc
 | ||||
| +  fun:tls_get_addr_tail*
 | ||||
| +  fun:__tls_get_addr
 | ||||
| +}
 | ||||
| +
 | ||||
| +{
 | ||||
| +  dtv-addr-resize
 | ||||
| +  Memcheck:Leak
 | ||||
| +  match-leak-kinds: possible,reachable
 | ||||
| +  fun:malloc
 | ||||
| +  fun:_dl_resize_dtv
 | ||||
| +  fun:_dl_update_slotinfo
 | ||||
| +  fun:update_get_addr
 | ||||
| +  fun:__tls_get_addr
 | ||||
| +}
 | ||||
| +
 | ||||
| +{
 | ||||
| +  dtv-addr-init
 | ||||
| +  Memcheck:Leak
 | ||||
| +  match-leak-kinds: possible,reachable
 | ||||
| +  fun:malloc
 | ||||
| +  fun:allocate_dtv_entry
 | ||||
| +  fun:allocate_and_init
 | ||||
| +  fun:tls_get_addr_tail*
 | ||||
| +  fun:__tls_get_addr
 | ||||
| +}
 | ||||
| @ -1,226 +0,0 @@ | ||||
| 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. */ | ||||
| @ -1,22 +0,0 @@ | ||||
| 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'                                 \ | ||||
| @ -1,20 +0,0 @@ | ||||
| ---
 | ||||
|  coregrind/m_sigframe/sigframe-ppc64-linux.c | 2 +- | ||||
|  1 file changed, 1 insertion(+), 1 deletion(-) | ||||
| 
 | ||||
| diff --git a/coregrind/m_sigframe/sigframe-ppc64-linux.c b/coregrind/m_sigframe/
 | ||||
| sigframe-ppc64-linux.c | ||||
| index 0406f3c..b54c4e0 100644
 | ||||
| --- a/coregrind/m_sigframe/sigframe-ppc64-linux.c
 | ||||
| +++ b/coregrind/m_sigframe/sigframe-ppc64-linux.c
 | ||||
| @@ -112,7 +112,7 @@ struct rt_sigframe {
 | ||||
|     vki_siginfo_t         info; | ||||
|     struct vg_sig_private priv; | ||||
|     UChar                 abigap[288];   // unused | ||||
| -};
 | ||||
| +} __attribute__ ((aligned (16)));
 | ||||
|   | ||||
|  #define SET_SIGNAL_LR(zztst, zzval)                          \ | ||||
|     do { tst->arch.vex.guest_LR = (zzval);                    \ | ||||
| -- 
 | ||||
| 2.7.4 | ||||
| @ -1,751 +0,0 @@ | ||||
| commit b0861063a8d2a55bb7423e90d26806bab0f78a12 | ||||
| Author: Alexandra Hájková <ahajkova@redhat.com> | ||||
| Date:   Tue Jun 4 13:47:14 2019 +0200 | ||||
| 
 | ||||
|     Add support for preadv2 and pwritev2 syscalls | ||||
|      | ||||
|     Support for amd64, x86 - 64 and 32 bit, arm64, ppc64, ppc64le, | ||||
|     s390x, mips64. This should work identically on all | ||||
|     arches, tested on x86 32bit and 64bit one, but enabled on all. | ||||
|      | ||||
|     Refactor the code to be reusable between old/new syscalls. Resolve TODO | ||||
|     items in the code. Add the testcase for the preadv2/pwritev2 and also | ||||
|     add the (similar) testcase for the older preadv/pwritev syscalls. | ||||
|      | ||||
|     Trying to test handling an uninitialized flag argument for the v2 syscalls | ||||
|     does not work because the flag always comes out as defined zero. | ||||
|     Turns out glibc does this deliberately on 64bit architectures because | ||||
|     the kernel does actually have a low_offset and high_offset argument, but | ||||
|     ignores the high_offset/assumes it is zero. | ||||
|     https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=601cc11d054ae4b5e9b5babec3d8e4667a2cb9b5 | ||||
|      | ||||
|     https://bugs.kde.org/408414 | ||||
| 
 | ||||
| diff --git a/configure.ac b/configure.ac
 | ||||
| index 352892565..3596d2fec 100755
 | ||||
| --- a/configure.ac
 | ||||
| +++ b/configure.ac
 | ||||
| @@ -4173,6 +4173,10 @@ AC_CHECK_FUNCS([     \
 | ||||
|          process_vm_readv  \ | ||||
|          process_vm_writev \ | ||||
|          copy_file_range \ | ||||
| +        preadv \
 | ||||
| +        pwritev \
 | ||||
| +        preadv2 \
 | ||||
| +        pwritev2 \
 | ||||
|          ]) | ||||
|   | ||||
|  # AC_CHECK_LIB adds any library found to the variable LIBS, and links these | ||||
| @@ -4190,6 +4194,10 @@ 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]) | ||||
| +AM_CONDITIONAL([HAVE_PREADV_PWRITEV],
 | ||||
| +               [test x$ac_cv_func_preadv = xyes && test x$ac_cv_func_pwritev = xyes])
 | ||||
| +AM_CONDITIONAL([HAVE_PREADV2_PWRITEV2],
 | ||||
| +               [test x$ac_cv_func_preadv2 = xyes && test x$ac_cv_func_pwritev2 = 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-generic.h b/coregrind/m_syswrap/priv_syswrap-generic.h
 | ||||
| index 3e1c8b682..73f9224f7 100644
 | ||||
| --- a/coregrind/m_syswrap/priv_syswrap-generic.h
 | ||||
| +++ b/coregrind/m_syswrap/priv_syswrap-generic.h
 | ||||
| @@ -109,6 +109,19 @@ ML_(handle_auxv_open)(SyscallStatus *status, const HChar *filename,
 | ||||
|  /* Helper function for generic mprotect and linux pkey_mprotect. */ | ||||
|  extern void handle_sys_mprotect (ThreadId tid, SyscallStatus *status, | ||||
|                                   Addr *addr, SizeT *len, Int *prot); | ||||
| +/* Helper functions for preadv/preadv2. */
 | ||||
| +extern
 | ||||
| +void handle_pre_sys_preadv(ThreadId tid, SyscallStatus* status,
 | ||||
| +                           Int fd, Addr vector, Int count,
 | ||||
| +                           const char *str);
 | ||||
| +extern
 | ||||
| +void handle_post_sys_preadv(ThreadId tid, SyscallStatus* status, Addr vector, Int count);
 | ||||
| +
 | ||||
| +/* Helper function for pwritev/pwritev2. */
 | ||||
| +extern
 | ||||
| +void handle_sys_pwritev(ThreadId tid, SyscallStatus* status,
 | ||||
| +                        Int fd, Addr vector, Int count,
 | ||||
| +                        const char *str);
 | ||||
|   | ||||
|  DECL_TEMPLATE(generic, sys_ni_syscall);            // * P -- unimplemented | ||||
|  DECL_TEMPLATE(generic, sys_exit); | ||||
| diff --git a/coregrind/m_syswrap/priv_syswrap-linux.h b/coregrind/m_syswrap/priv_syswrap-linux.h
 | ||||
| index be2f9bdde..8ce8ef3d5 100644
 | ||||
| --- a/coregrind/m_syswrap/priv_syswrap-linux.h
 | ||||
| +++ b/coregrind/m_syswrap/priv_syswrap-linux.h
 | ||||
| @@ -46,7 +46,9 @@ DECL_TEMPLATE(linux, sys_oldumount);
 | ||||
|  DECL_TEMPLATE(linux, sys_umount); | ||||
|  DECL_TEMPLATE(linux, sys_perf_event_open); | ||||
|  DECL_TEMPLATE(linux, sys_preadv); | ||||
| +DECL_TEMPLATE(linux, sys_preadv2);
 | ||||
|  DECL_TEMPLATE(linux, sys_pwritev); | ||||
| +DECL_TEMPLATE(linux, sys_pwritev2);
 | ||||
|  DECL_TEMPLATE(linux, sys_sendmmsg); | ||||
|  DECL_TEMPLATE(linux, sys_recvmmsg); | ||||
|  DECL_TEMPLATE(linux, sys_dup3); | ||||
| diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c
 | ||||
| index 382dc65cf..9b8068d0f 100644
 | ||||
| --- a/coregrind/m_syswrap/syswrap-amd64-linux.c
 | ||||
| +++ b/coregrind/m_syswrap/syswrap-amd64-linux.c
 | ||||
| @@ -857,6 +857,8 @@ static SyscallTableEntry syscall_table[] = {
 | ||||
|  //   LIN__(__NR_kexec_file_load,   sys_ni_syscall),       // 320 | ||||
|     LINXY(__NR_bpf,               sys_bpf),              // 321 | ||||
|   | ||||
| +   LINXY(__NR_preadv2,           sys_preadv2),           // 327
 | ||||
| +   LINX_(__NR_pwritev2,          sys_pwritev2),          // 328
 | ||||
|   | ||||
|     LINXY(__NR_statx,             sys_statx),             // 332 | ||||
|   | ||||
| diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c
 | ||||
| index c700e3dbe..d12d40632 100644
 | ||||
| --- a/coregrind/m_syswrap/syswrap-arm64-linux.c
 | ||||
| +++ b/coregrind/m_syswrap/syswrap-arm64-linux.c
 | ||||
| @@ -818,8 +818,8 @@ static SyscallTableEntry syscall_main_table[] = {
 | ||||
|     LINX_(__NR_membarrier,        sys_membarrier),        // 283 | ||||
|     //   (__NR_mlock2,            sys_ni_syscall),        // 284 | ||||
|     LINX_(__NR_copy_file_range,   sys_copy_file_range),   // 285 | ||||
| -   //   (__NR_preadv2,           sys_ni_syscall),        // 286
 | ||||
| -   //   (__NR_pwritev2,          sys_ni_syscall),        // 287
 | ||||
| +   LINX_(__NR_preadv2,           sys_ni_syscall),        // 286
 | ||||
| +   LINX_(__NR_pwritev2,          sys_ni_syscall),        // 287
 | ||||
|     //   (__NR_pkey_mprotect,     sys_ni_syscall),        // 288 | ||||
|     //   (__NR_pkey_alloc,        sys_ni_syscall),        // 289 | ||||
|     //   (__NR_pkey_free,         sys_ni_syscall),        // 290 | ||||
| diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c
 | ||||
| index 36d09d6e0..2fe15d97b 100644
 | ||||
| --- a/coregrind/m_syswrap/syswrap-linux.c
 | ||||
| +++ b/coregrind/m_syswrap/syswrap-linux.c
 | ||||
| @@ -5501,12 +5501,57 @@ POST(sys_open_by_handle_at)
 | ||||
|  /* --------------------------------------------------------------------- | ||||
|     p{read,write}v wrappers | ||||
|     ------------------------------------------------------------------ */ | ||||
| +/* This handles the common part of the PRE macro for preadv and preadv2. */
 | ||||
| +void handle_pre_sys_preadv(ThreadId tid, SyscallStatus* status,
 | ||||
| +                           Int fd, Addr vector, Int count, const char *str)
 | ||||
| +{
 | ||||
| +   struct vki_iovec * vec;
 | ||||
| +   Int i;
 | ||||
| +   /* safe size for the "preadv/preadv2(vector[i])" string */
 | ||||
| +   char tmp[30];
 | ||||
| +
 | ||||
| +   if (!ML_(fd_allowed)(fd, str, tid, False)) {
 | ||||
| +      SET_STATUS_Failure( VKI_EBADF );
 | ||||
| +   } else if (count > 0) {
 | ||||
| +      VG_(strcpy) (tmp, str);
 | ||||
| +      VG_(strcat) (tmp, "(vector)");
 | ||||
| +      PRE_MEM_READ( tmp, vector, count * sizeof(struct vki_iovec) );
 | ||||
| +
 | ||||
| +      if (ML_(safe_to_deref) ((void *)(Addr)vector,
 | ||||
| +                              count * sizeof(struct vki_iovec))) {
 | ||||
| +         vec = (struct vki_iovec *)(Addr)vector;
 | ||||
| +         for (i = 0; i < count; i++) {
 | ||||
| +            VG_(snprintf) (tmp, 30, "%s(vector[%d])", str, i);
 | ||||
| +            PRE_MEM_WRITE( tmp, (Addr)vec[i].iov_base, vec[i].iov_len );
 | ||||
| +         }
 | ||||
| +      }
 | ||||
| +   }
 | ||||
| +}
 | ||||
| +
 | ||||
| +/* This handles the common part of the POST macro for preadv and preadv2. */
 | ||||
| +void handle_post_sys_preadv(ThreadId tid, SyscallStatus* status, Addr vector, Int count)
 | ||||
| +{
 | ||||
| +    vg_assert(SUCCESS);
 | ||||
| +    if (RES > 0) {
 | ||||
| +        Int i;
 | ||||
| +        struct vki_iovec * vec = (struct vki_iovec *)(Addr)vector;
 | ||||
| +        Int remains = RES;
 | ||||
| +
 | ||||
| +        /* RES holds the number of bytes read. */
 | ||||
| +        for (i = 0; i < count; i++) {
 | ||||
| +            Int nReadThisBuf = vec[i].iov_len;
 | ||||
| +            if (nReadThisBuf > remains) nReadThisBuf = remains;
 | ||||
| +            POST_MEM_WRITE( (Addr)vec[i].iov_base, nReadThisBuf );
 | ||||
| +            remains -= nReadThisBuf;
 | ||||
| +            if (remains < 0) VG_(core_panic)("preadv: remains < 0");
 | ||||
| +        }
 | ||||
| +    }
 | ||||
| +}
 | ||||
|   | ||||
|  PRE(sys_preadv) | ||||
|  { | ||||
| -   Int i;
 | ||||
| -   struct vki_iovec * vec;
 | ||||
|     *flags |= SfMayBlock; | ||||
| +   const char *str = "preadv";
 | ||||
|  #if VG_WORDSIZE == 4 | ||||
|     /* Note that the offset argument here is in lo+hi order on both | ||||
|        big and little endian platforms... */ | ||||
| @@ -5525,45 +5570,89 @@ PRE(sys_preadv)
 | ||||
|  #else | ||||
|  #  error Unexpected word size | ||||
|  #endif | ||||
| -   if (!ML_(fd_allowed)(ARG1, "preadv", tid, False)) {
 | ||||
| -      SET_STATUS_Failure( VKI_EBADF );
 | ||||
| -   } else {
 | ||||
| -      PRE_MEM_READ( "preadv(vector)", ARG2, ARG3 * sizeof(struct vki_iovec) );
 | ||||
| +   Int fd = ARG1;
 | ||||
| +   Addr vector = ARG2;
 | ||||
| +   Int count = ARG3;
 | ||||
| +
 | ||||
| +   handle_pre_sys_preadv(tid, status, fd, vector, count, str);
 | ||||
|   | ||||
| -      if (ARG2 != 0) {
 | ||||
| -         /* ToDo: don't do any of the following if the vector is invalid */
 | ||||
| -         vec = (struct vki_iovec *)(Addr)ARG2;
 | ||||
| -         for (i = 0; i < (Int)ARG3; i++)
 | ||||
| -            PRE_MEM_WRITE( "preadv(vector[...])",
 | ||||
| -                           (Addr)vec[i].iov_base, vec[i].iov_len );
 | ||||
| -      }
 | ||||
| -   }
 | ||||
|  } | ||||
|   | ||||
|  POST(sys_preadv) | ||||
|  { | ||||
| -   vg_assert(SUCCESS);
 | ||||
| -   if (RES > 0) {
 | ||||
| -      Int i;
 | ||||
| -      struct vki_iovec * vec = (struct vki_iovec *)(Addr)ARG2;
 | ||||
| -      Int remains = RES;
 | ||||
| +   Addr vector = ARG2;
 | ||||
| +   Int count = ARG3;
 | ||||
|   | ||||
| -      /* RES holds the number of bytes read. */
 | ||||
| -      for (i = 0; i < (Int)ARG3; i++) {
 | ||||
| -	 Int nReadThisBuf = vec[i].iov_len;
 | ||||
| -	 if (nReadThisBuf > remains) nReadThisBuf = remains;
 | ||||
| -	 POST_MEM_WRITE( (Addr)vec[i].iov_base, nReadThisBuf );
 | ||||
| -	 remains -= nReadThisBuf;
 | ||||
| -	 if (remains < 0) VG_(core_panic)("preadv: remains < 0");
 | ||||
| +   handle_post_sys_preadv(tid, status, vector, count);
 | ||||
| +}
 | ||||
| +
 | ||||
| +PRE(sys_preadv2)
 | ||||
| +{
 | ||||
| +   *flags |= SfMayBlock;
 | ||||
| +   const char *str = "preadv2";
 | ||||
| +#if VG_WORDSIZE == 4
 | ||||
| +   /* Note that the offset argument here is in lo+hi order on both
 | ||||
| +      big and little endian platforms... */
 | ||||
| +   PRINT("sys_preadv2 ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x, %" FMT_REGWORD
 | ||||
| +         "u, %lld, %" FMT_REGWORD "u )",
 | ||||
| +         ARG1, ARG2, ARG3, (Long)LOHI64(ARG4,ARG5), ARG6);
 | ||||
| +   PRE_REG_READ6(ssize_t, "preadv2",
 | ||||
| +                 unsigned long, fd, const struct iovec *, vector,
 | ||||
| +                 unsigned long, count, vki_u32, offset_low,
 | ||||
| +                 vki_u32, offset_high, unsigned long, flags);
 | ||||
| +#elif VG_WORDSIZE == 8
 | ||||
| +   PRINT("sys_preadv2 ( %lu, %#lx, %lu, %ld, %lu )", ARG1, ARG2, ARG3, SARG4, ARG5);
 | ||||
| +   PRE_REG_READ5(ssize_t, "preadv2",
 | ||||
| +                 unsigned long, fd, const struct iovec *, vector,
 | ||||
| +                 unsigned long, count, Word, offset, unsigned long, flags);
 | ||||
| +#else
 | ||||
| +#  error Unexpected word size
 | ||||
| +#endif
 | ||||
| +   Int fd = ARG1;
 | ||||
| +   Addr vector = ARG2;
 | ||||
| +   Int count = ARG3;
 | ||||
| +
 | ||||
| +   handle_pre_sys_preadv(tid, status, fd, vector, count, str);
 | ||||
| +}
 | ||||
| +
 | ||||
| +POST(sys_preadv2)
 | ||||
| +{
 | ||||
| +   Addr vector = ARG2;
 | ||||
| +   Int count = ARG3;
 | ||||
| +
 | ||||
| +   handle_post_sys_preadv(tid, status, vector, count);
 | ||||
| +}
 | ||||
| +
 | ||||
| +/* This handles the common part of the PRE macro for pwritev and pwritev2. */
 | ||||
| +void handle_sys_pwritev(ThreadId tid, SyscallStatus* status,
 | ||||
| +                        Int fd, Addr vector, Int count, const char *str)
 | ||||
| +{
 | ||||
| +   Int i;
 | ||||
| +   struct vki_iovec * vec;
 | ||||
| +   /* safe size for the "preadv/preadv2(vector[i])" string */
 | ||||
| +   char tmp[30];
 | ||||
| +
 | ||||
| +   if (!ML_(fd_allowed)(fd, str, tid, False)) {
 | ||||
| +      SET_STATUS_Failure( VKI_EBADF );
 | ||||
| +   } else if (count > 0) {
 | ||||
| +      VG_(strcpy) (tmp, str);
 | ||||
| +      VG_(strcat) (tmp, "(vector)");
 | ||||
| +      PRE_MEM_READ( tmp, vector, count * sizeof(struct vki_iovec) );
 | ||||
| +      if (ML_(safe_to_deref) ((void *)(Addr)vector,
 | ||||
| +                              count * sizeof(struct vki_iovec))) {
 | ||||
| +         vec = (struct vki_iovec *)(Addr)vector;
 | ||||
| +         for (i = 0; i < count; i++) {
 | ||||
| +            VG_(snprintf) (tmp, 30, "%s(vector[%d])", str, i);
 | ||||
| +            PRE_MEM_READ( tmp, (Addr)vec[i].iov_base, vec[i].iov_len );
 | ||||
| +         }
 | ||||
|        } | ||||
|     } | ||||
|  } | ||||
|   | ||||
|  PRE(sys_pwritev) | ||||
|  { | ||||
| -   Int i;
 | ||||
| -   struct vki_iovec * vec;
 | ||||
|     *flags |= SfMayBlock; | ||||
| +   const char *str = "pwritev";
 | ||||
|  #if VG_WORDSIZE == 4 | ||||
|     /* Note that the offset argument here is in lo+hi order on both | ||||
|        big and little endian platforms... */ | ||||
| @@ -5581,19 +5670,41 @@ PRE(sys_pwritev)
 | ||||
|  #else | ||||
|  #  error Unexpected word size | ||||
|  #endif | ||||
| -   if (!ML_(fd_allowed)(ARG1, "pwritev", tid, False)) {
 | ||||
| -      SET_STATUS_Failure( VKI_EBADF );
 | ||||
| -   } else {
 | ||||
| -      PRE_MEM_READ( "pwritev(vector)", 
 | ||||
| -		     ARG2, ARG3 * sizeof(struct vki_iovec) );
 | ||||
| -      if (ARG2 != 0) {
 | ||||
| -         /* ToDo: don't do any of the following if the vector is invalid */
 | ||||
| -         vec = (struct vki_iovec *)(Addr)ARG2;
 | ||||
| -         for (i = 0; i < (Int)ARG3; i++)
 | ||||
| -            PRE_MEM_READ( "pwritev(vector[...])",
 | ||||
| -                           (Addr)vec[i].iov_base, vec[i].iov_len );
 | ||||
| -      }
 | ||||
| -   }
 | ||||
| +   Int fd = ARG1;
 | ||||
| +   Addr vector = ARG2;
 | ||||
| +   Int count = ARG3;
 | ||||
| +
 | ||||
| +   handle_sys_pwritev(tid, status, fd, vector, count, str);
 | ||||
| +}
 | ||||
| +
 | ||||
| +PRE(sys_pwritev2)
 | ||||
| +{
 | ||||
| +   *flags |= SfMayBlock;
 | ||||
| +   const char *str = "pwritev2";
 | ||||
| +#if VG_WORDSIZE == 4
 | ||||
| +   /* Note that the offset argument here is in lo+hi order on both
 | ||||
| +      big and little endian platforms... */
 | ||||
| +   PRINT("sys_pwritev2 ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x, %" FMT_REGWORD
 | ||||
| +         "u, %lld, %" FMT_REGWORD "u )",
 | ||||
| +         ARG1, ARG2, ARG3, (Long)LOHI64(ARG4,ARG5), ARG6);
 | ||||
| +   PRE_REG_READ6(ssize_t, "pwritev2",
 | ||||
| +                 unsigned long, fd, const struct iovec *, vector,
 | ||||
| +                 unsigned long, count, vki_u32, offset_low,
 | ||||
| +                 vki_u32, offset_high, unsigned long, flags);
 | ||||
| +#elif VG_WORDSIZE == 8
 | ||||
| +   /* Note offset_high isn't actually used?  */
 | ||||
| +   PRE_REG_READ6(ssize_t, "pwritev2",
 | ||||
| +                 unsigned long, fd, const struct iovec *, vector,
 | ||||
| +                 unsigned long, count, Word, offset,
 | ||||
| +		 Word, offset_high, unsigned long, flags);
 | ||||
| +#else
 | ||||
| +#  error Unexpected word size
 | ||||
| +#endif
 | ||||
| +   Int fd = ARG1;
 | ||||
| +   Addr vector = ARG2;
 | ||||
| +   Int count = ARG3;
 | ||||
| +
 | ||||
| +   handle_sys_pwritev(tid, status, fd, vector, count, str);
 | ||||
|  } | ||||
|   | ||||
|  /* --------------------------------------------------------------------- | ||||
| diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c
 | ||||
| index baa2934ab..d65a664dd 100644
 | ||||
| --- a/coregrind/m_syswrap/syswrap-ppc64-linux.c
 | ||||
| +++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c
 | ||||
| @@ -1006,6 +1006,8 @@ static SyscallTableEntry syscall_table[] = {
 | ||||
|     LINX_(__NR_membarrier,        sys_membarrier),       // 365 | ||||
|   | ||||
|     LINX_(__NR_copy_file_range,   sys_copy_file_range),  // 379 | ||||
| +   LINX_(__NR_preadv2,           sys_preadv2),          // 380
 | ||||
| +   LINX_(__NR_pwritev2,          sys_pwritev2),         // 381
 | ||||
|   | ||||
|     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 1481e768b..3354d41c0 100644
 | ||||
| --- a/coregrind/m_syswrap/syswrap-s390x-linux.c
 | ||||
| +++ b/coregrind/m_syswrap/syswrap-s390x-linux.c
 | ||||
| @@ -853,6 +853,8 @@ static SyscallTableEntry syscall_table[] = {
 | ||||
|     LINX_(__NR_shutdown, sys_shutdown),                                // 373 | ||||
|   | ||||
|     LINX_(__NR_copy_file_range, sys_copy_file_range),                  // 375 | ||||
| +   LINXY(__NR_preadv2, sys_preadv2),                                  // 376
 | ||||
| +   LINX_(__NR_pwritev2, sys_pwritev2),                                // 377
 | ||||
|   | ||||
|     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 9ff53a92a..33d1213a3 100644
 | ||||
| --- a/coregrind/m_syswrap/syswrap-x86-linux.c
 | ||||
| +++ b/coregrind/m_syswrap/syswrap-x86-linux.c
 | ||||
| @@ -1607,6 +1607,8 @@ static SyscallTableEntry syscall_table[] = {
 | ||||
|     LINX_(__NR_membarrier,        sys_membarrier),       // 375 | ||||
|   | ||||
|     LINX_(__NR_copy_file_range,   sys_copy_file_range),   // 377 | ||||
| +   LINXY(__NR_preadv2,           sys_preadv2),           // 378
 | ||||
| +   LINX_(__NR_pwritev2,          sys_pwritev2),          // 379
 | ||||
|   | ||||
|     LINXY(__NR_pkey_mprotect,     sys_pkey_mprotect),    // 380 | ||||
|     LINX_(__NR_pkey_alloc,        sys_pkey_alloc),       // 381 | ||||
| diff --git a/memcheck/tests/linux/Makefile.am b/memcheck/tests/linux/Makefile.am
 | ||||
| index 00e99a52a..e13325869 100644
 | ||||
| --- a/memcheck/tests/linux/Makefile.am
 | ||||
| +++ b/memcheck/tests/linux/Makefile.am
 | ||||
| @@ -26,7 +26,9 @@ EXTRA_DIST = \
 | ||||
|  	timerfd-syscall.vgtest timerfd-syscall.stderr.exp \ | ||||
|  	with-space.stderr.exp with-space.stdout.exp with-space.vgtest \ | ||||
|  	proc-auxv.vgtest proc-auxv.stderr.exp getregset.vgtest \ | ||||
| -	getregset.stderr.exp getregset.stdout.exp
 | ||||
| +	getregset.stderr.exp getregset.stdout.exp \
 | ||||
| +	sys-preadv_pwritev.vgtest sys-preadv_pwritev.stderr.exp \
 | ||||
| +	sys-preadv2_pwritev2.vgtest sys-preadv2_pwritev2.stderr.exp
 | ||||
|   | ||||
|  check_PROGRAMS = \ | ||||
|  	brk \ | ||||
| @@ -54,6 +56,14 @@ if HAVE_COPY_FILE_RANGE
 | ||||
|          check_PROGRAMS += sys-copy_file_range | ||||
|  endif | ||||
|   | ||||
| +if HAVE_PREADV_PWRITEV
 | ||||
| +        check_PROGRAMS += sys-preadv_pwritev
 | ||||
| +endif
 | ||||
| +
 | ||||
| +if HAVE_PREADV2_PWRITEV2
 | ||||
| +        check_PROGRAMS += sys-preadv2_pwritev2
 | ||||
| +endif
 | ||||
| +
 | ||||
|  AM_CFLAGS   += $(AM_FLAG_M3264_PRI) | ||||
|  AM_CXXFLAGS += $(AM_FLAG_M3264_PRI) | ||||
|   | ||||
| diff --git a/memcheck/tests/linux/sys-preadv2_pwritev2.c b/memcheck/tests/linux/sys-preadv2_pwritev2.c
 | ||||
| new file mode 100644 | ||||
| index 000000000..942eab68b
 | ||||
| --- /dev/null
 | ||||
| +++ b/memcheck/tests/linux/sys-preadv2_pwritev2.c
 | ||||
| @@ -0,0 +1,79 @@
 | ||||
| +#define _GNU_SOURCE
 | ||||
| +#include <fcntl.h>
 | ||||
| +#include <stdio.h>
 | ||||
| +#include <stdlib.h>
 | ||||
| +#include <sys/stat.h>
 | ||||
| +#include <unistd.h>
 | ||||
| +#include <sys/syscall.h>
 | ||||
| +#include <sys/uio.h>
 | ||||
| +#include <string.h>
 | ||||
| +#include "../../memcheck.h"
 | ||||
| +
 | ||||
| +#include <errno.h>
 | ||||
| +
 | ||||
| +int main(int argc, char **argv)
 | ||||
| +{
 | ||||
| +    char str0[] = "hello ";
 | ||||
| +    char str1[] = "world\n";
 | ||||
| +    struct iovec iov[2];
 | ||||
| +    int fd;
 | ||||
| +
 | ||||
| +    fd = open("prwv2_source", O_CREAT | O_RDWR, 0644);
 | ||||
| +    if (fd == -1) {
 | ||||
| +        perror("prwv2_source");
 | ||||
| +        exit(EXIT_FAILURE);
 | ||||
| +    }
 | ||||
| +
 | ||||
| +    iov[0].iov_base = str0;
 | ||||
| +    iov[0].iov_len = strlen(str0);
 | ||||
| +    iov[1].iov_base = str1;
 | ||||
| +    iov[1].iov_len = strlen(str1);
 | ||||
| +
 | ||||
| +    /* Check pwritev2 and preadv2 called with the correct arguments works. */
 | ||||
| +    if (pwritev2(fd, iov, 2, 0, 0) == -1) {
 | ||||
| +        perror("pwritev2");
 | ||||
| +        exit(EXIT_FAILURE);
 | ||||
| +    }
 | ||||
| +
 | ||||
| +    if (preadv2(fd, iov, 2, 0, 0) == -1) {
 | ||||
| +        perror("preadv2");
 | ||||
| +        printf("errno: %d\n", errno);
 | ||||
| +        exit(EXIT_FAILURE);
 | ||||
| +    }
 | ||||
| +
 | ||||
| +    /* Check valgrind will produce expected warnings for the
 | ||||
| +       various wrong arguments. */
 | ||||
| +    do {
 | ||||
| +        /* always allocate 16 bytes to not to have different .exps for different reg sizes */
 | ||||
| +        char *mem = malloc(16);
 | ||||
| +        void *t = (void *) &mem[0];
 | ||||
| +        void *z = (void *) -1;
 | ||||
| +	int c = *((int *) &mem[4]);
 | ||||
| +        int flag = *((int *) &mem[8]);
 | ||||
| +        pwritev2(fd, NULL, 2, 0, 0);
 | ||||
| +        pwritev2(fd, z, 2, 0, 0);
 | ||||
| +        pwritev2(fd, t, 2, 0, 0);
 | ||||
| +        pwritev2(fd, iov, -1, 0, 0);
 | ||||
| +        pwritev2(fd, iov, c, 0, 0);
 | ||||
| +        pwritev2(fd, iov, 2, -5, 0);
 | ||||
| +        pwritev2(-1, iov, 2, -5, 0);
 | ||||
| +        pwritev2(fd, iov, 2, -5, flag);
 | ||||
| +
 | ||||
| +        preadv2(fd, NULL, 2, 0, 0);
 | ||||
| +        preadv2(fd, z, 2, 0, 0);
 | ||||
| +        preadv2(fd, t, 2, 0, 0);
 | ||||
| +        preadv2(fd, iov, -1, 0, 0);
 | ||||
| +        preadv2(fd, iov, c, 0, 0);
 | ||||
| +        preadv2(fd, iov, 2, -5, 0);
 | ||||
| +        preadv2(-1, iov, 2, -5, 0);
 | ||||
| +
 | ||||
| +        iov[1].iov_base = (void *) -1;
 | ||||
| +        pwritev2(fd, iov, 2, 0, 0);
 | ||||
| +        preadv2(fd, iov, 2, 0, 0);
 | ||||
| +        free(mem);
 | ||||
| +    } while (0);
 | ||||
| +
 | ||||
| +    close(fd);
 | ||||
| +    unlink("prwv2_source");
 | ||||
| +    exit(EXIT_SUCCESS);
 | ||||
| +}
 | ||||
| diff --git a/memcheck/tests/linux/sys-preadv2_pwritev2.stderr.exp b/memcheck/tests/linux/sys-preadv2_pwritev2.stderr.exp
 | ||||
| new file mode 100644 | ||||
| index 000000000..e11f2a51d
 | ||||
| --- /dev/null
 | ||||
| +++ b/memcheck/tests/linux/sys-preadv2_pwritev2.stderr.exp
 | ||||
| @@ -0,0 +1,56 @@
 | ||||
| +Syscall param pwritev2(vector) points to unaddressable byte(s)
 | ||||
| +   ...
 | ||||
| +   by 0x........: main (sys-preadv2_pwritev2.c:53)
 | ||||
| + Address 0x........ is not stack'd, malloc'd or (recently) free'd
 | ||||
| +
 | ||||
| +Syscall param pwritev2(vector) points to unaddressable byte(s)
 | ||||
| +   ...
 | ||||
| +   by 0x........: main (sys-preadv2_pwritev2.c:54)
 | ||||
| + Address 0x........ is not stack'd, malloc'd or (recently) free'd
 | ||||
| +
 | ||||
| +Syscall param pwritev2(vector) points to uninitialised byte(s)
 | ||||
| +   ...
 | ||||
| +   by 0x........: main (sys-preadv2_pwritev2.c:55)
 | ||||
| + Address 0x........ is 0 bytes inside a block of size 16 alloc'd
 | ||||
| +   at 0x........: malloc (vg_replace_malloc.c:...)
 | ||||
| +   by 0x........: main (sys-preadv2_pwritev2.c:48)
 | ||||
| +
 | ||||
| +Syscall param pwritev2(count) contains uninitialised byte(s)
 | ||||
| +   ...
 | ||||
| +   by 0x........: main (sys-preadv2_pwritev2.c:57)
 | ||||
| +
 | ||||
| +Syscall param pwritev2(flags) contains uninitialised byte(s)
 | ||||
| +   ...
 | ||||
| +   by 0x........: main (sys-preadv2_pwritev2.c:60)
 | ||||
| +
 | ||||
| +Syscall param preadv2(vector) points to unaddressable byte(s)
 | ||||
| +   ...
 | ||||
| +   by 0x........: main (sys-preadv2_pwritev2.c:62)
 | ||||
| + Address 0x........ is not stack'd, malloc'd or (recently) free'd
 | ||||
| +
 | ||||
| +Syscall param preadv2(vector) points to unaddressable byte(s)
 | ||||
| +   ...
 | ||||
| +   by 0x........: main (sys-preadv2_pwritev2.c:63)
 | ||||
| + Address 0x........ is not stack'd, malloc'd or (recently) free'd
 | ||||
| +
 | ||||
| +Syscall param preadv2(vector) points to uninitialised byte(s)
 | ||||
| +   ...
 | ||||
| +   by 0x........: main (sys-preadv2_pwritev2.c:64)
 | ||||
| + Address 0x........ is 0 bytes inside a block of size 16 alloc'd
 | ||||
| +   at 0x........: malloc (vg_replace_malloc.c:...)
 | ||||
| +   by 0x........: main (sys-preadv2_pwritev2.c:48)
 | ||||
| +
 | ||||
| +Syscall param preadv2(count) contains uninitialised byte(s)
 | ||||
| +   ...
 | ||||
| +   by 0x........: main (sys-preadv2_pwritev2.c:66)
 | ||||
| +
 | ||||
| +Syscall param pwritev2(vector[1]) points to unaddressable byte(s)
 | ||||
| +   ...
 | ||||
| +   by 0x........: main (sys-preadv2_pwritev2.c:71)
 | ||||
| + Address 0x........ is not stack'd, malloc'd or (recently) free'd
 | ||||
| +
 | ||||
| +Syscall param preadv2(vector[1]) points to unaddressable byte(s)
 | ||||
| +   ...
 | ||||
| +   by 0x........: main (sys-preadv2_pwritev2.c:72)
 | ||||
| + Address 0x........ is not stack'd, malloc'd or (recently) free'd
 | ||||
| +
 | ||||
| diff --git a/memcheck/tests/linux/sys-preadv2_pwritev2.vgtest b/memcheck/tests/linux/sys-preadv2_pwritev2.vgtest
 | ||||
| new file mode 100644 | ||||
| index 000000000..5cd23aacd
 | ||||
| --- /dev/null
 | ||||
| +++ b/memcheck/tests/linux/sys-preadv2_pwritev2.vgtest
 | ||||
| @@ -0,0 +1,3 @@
 | ||||
| +prereq: test -e sys-preadv2_pwritev2
 | ||||
| +prog: sys-preadv2_pwritev2
 | ||||
| +vgopts: -q
 | ||||
| diff --git a/memcheck/tests/linux/sys-preadv_pwritev.c b/memcheck/tests/linux/sys-preadv_pwritev.c
 | ||||
| new file mode 100644 | ||||
| index 000000000..f5087dddc
 | ||||
| --- /dev/null
 | ||||
| +++ b/memcheck/tests/linux/sys-preadv_pwritev.c
 | ||||
| @@ -0,0 +1,77 @@
 | ||||
| +#define _GNU_SOURCE
 | ||||
| +#include <fcntl.h>
 | ||||
| +#include <stdio.h>
 | ||||
| +#include <stdlib.h>
 | ||||
| +#include <sys/stat.h>
 | ||||
| +#include <unistd.h>
 | ||||
| +#include <sys/syscall.h>
 | ||||
| +#include <sys/uio.h>
 | ||||
| +#include <string.h>
 | ||||
| +#include "../../memcheck.h"
 | ||||
| +
 | ||||
| +#include <errno.h>
 | ||||
| +
 | ||||
| +int main(int argc, char **argv)
 | ||||
| +{
 | ||||
| +    char str0[] = "hello ";
 | ||||
| +    char str1[] = "world\n";
 | ||||
| +    struct iovec iov[2];
 | ||||
| +    int fd;
 | ||||
| +
 | ||||
| +    fd = open("prwv_source", O_CREAT | O_RDWR, 0644);
 | ||||
| +    if (fd == -1) {
 | ||||
| +        perror("prwv2_source");
 | ||||
| +        exit(EXIT_FAILURE);
 | ||||
| +    }
 | ||||
| +
 | ||||
| +    iov[0].iov_base = str0;
 | ||||
| +    iov[0].iov_len = strlen(str0);
 | ||||
| +    iov[1].iov_base = str1;
 | ||||
| +    iov[1].iov_len = strlen(str1);
 | ||||
| +
 | ||||
| +    /* Check pwritev and preadv called with the correct arguments works. */
 | ||||
| +    if (pwritev(fd, iov, 2, 0) == -1) {
 | ||||
| +        perror("pwritev");
 | ||||
| +        exit(EXIT_FAILURE);
 | ||||
| +    }
 | ||||
| +
 | ||||
| +    if (preadv(fd, iov, 2, 0) == -1) {
 | ||||
| +        perror("preadv");
 | ||||
| +        printf("errno: %d\n", errno);
 | ||||
| +        exit(EXIT_FAILURE);
 | ||||
| +    }
 | ||||
| +
 | ||||
| +    /* Check valgrind will produce expected warnings for the
 | ||||
| +       various wrong arguments. */
 | ||||
| +    do {
 | ||||
| +        /* always allocate 16 bytes to not to have different .exps for different reg sizes */
 | ||||
| +        char *mem = malloc(16);
 | ||||
| +        void *t = (void *) &mem[0];
 | ||||
| +        void *z = (void *) -1;
 | ||||
| +        int c = *((int *) &mem[4]);
 | ||||
| +        pwritev(fd, NULL, 2, 0);
 | ||||
| +        pwritev(fd, z, 2, 0);
 | ||||
| +        pwritev(fd, t, 2, 0);
 | ||||
| +        pwritev(fd, iov, -1, 0);
 | ||||
| +        pwritev(fd, iov, c, 0);
 | ||||
| +        pwritev(fd, iov, 2, -5);
 | ||||
| +        pwritev(-1, iov, 2, -5);
 | ||||
| +
 | ||||
| +        preadv(fd, NULL, 2, 0);
 | ||||
| +        preadv(fd, z, 2, 0);
 | ||||
| +        preadv(fd, t, 2, 0);
 | ||||
| +        preadv(fd, iov, -1, 0);
 | ||||
| +        preadv(fd, iov, c, 0);
 | ||||
| +        preadv(fd, iov, 2, -5);
 | ||||
| +        preadv(-1, iov, 2, -5);
 | ||||
| +
 | ||||
| +        iov[1].iov_base = (void *) -1;
 | ||||
| +        pwritev(fd, iov, 2, 0);
 | ||||
| +        preadv(fd, iov, 2, 0);
 | ||||
| +        free(mem);
 | ||||
| +    } while (0);
 | ||||
| +
 | ||||
| +    close(fd);
 | ||||
| +    unlink("prwv_source");
 | ||||
| +    exit(EXIT_SUCCESS);
 | ||||
| +}
 | ||||
| diff --git a/memcheck/tests/linux/sys-preadv_pwritev.stderr.exp b/memcheck/tests/linux/sys-preadv_pwritev.stderr.exp
 | ||||
| new file mode 100644 | ||||
| index 000000000..4fede44d8
 | ||||
| --- /dev/null
 | ||||
| +++ b/memcheck/tests/linux/sys-preadv_pwritev.stderr.exp
 | ||||
| @@ -0,0 +1,52 @@
 | ||||
| +Syscall param pwritev(vector) points to unaddressable byte(s)
 | ||||
| +   ...
 | ||||
| +   by 0x........: main (sys-preadv_pwritev.c:52)
 | ||||
| + Address 0x........ is not stack'd, malloc'd or (recently) free'd
 | ||||
| +
 | ||||
| +Syscall param pwritev(vector) points to unaddressable byte(s)
 | ||||
| +   ...
 | ||||
| +   by 0x........: main (sys-preadv_pwritev.c:53)
 | ||||
| + Address 0x........ is not stack'd, malloc'd or (recently) free'd
 | ||||
| +
 | ||||
| +Syscall param pwritev(vector) points to uninitialised byte(s)
 | ||||
| +   ...
 | ||||
| +   by 0x........: main (sys-preadv_pwritev.c:54)
 | ||||
| + Address 0x........ is 0 bytes inside a block of size 16 alloc'd
 | ||||
| +   at 0x........: malloc (vg_replace_malloc.c:...)
 | ||||
| +   by 0x........: main (sys-preadv_pwritev.c:48)
 | ||||
| +
 | ||||
| +Syscall param pwritev(count) contains uninitialised byte(s)
 | ||||
| +   ...
 | ||||
| +   by 0x........: main (sys-preadv_pwritev.c:56)
 | ||||
| +
 | ||||
| +Syscall param preadv(vector) points to unaddressable byte(s)
 | ||||
| +   ...
 | ||||
| +   by 0x........: main (sys-preadv_pwritev.c:60)
 | ||||
| + Address 0x........ is not stack'd, malloc'd or (recently) free'd
 | ||||
| +
 | ||||
| +Syscall param preadv(vector) points to unaddressable byte(s)
 | ||||
| +   ...
 | ||||
| +   by 0x........: main (sys-preadv_pwritev.c:61)
 | ||||
| + Address 0x........ is not stack'd, malloc'd or (recently) free'd
 | ||||
| +
 | ||||
| +Syscall param preadv(vector) points to uninitialised byte(s)
 | ||||
| +   ...
 | ||||
| +   by 0x........: main (sys-preadv_pwritev.c:62)
 | ||||
| + Address 0x........ is 0 bytes inside a block of size 16 alloc'd
 | ||||
| +   at 0x........: malloc (vg_replace_malloc.c:...)
 | ||||
| +   by 0x........: main (sys-preadv_pwritev.c:48)
 | ||||
| +
 | ||||
| +Syscall param preadv(count) contains uninitialised byte(s)
 | ||||
| +   ...
 | ||||
| +   by 0x........: main (sys-preadv_pwritev.c:64)
 | ||||
| +
 | ||||
| +Syscall param pwritev(vector[1]) points to unaddressable byte(s)
 | ||||
| +   ...
 | ||||
| +   by 0x........: main (sys-preadv_pwritev.c:69)
 | ||||
| + Address 0x........ is not stack'd, malloc'd or (recently) free'd
 | ||||
| +
 | ||||
| +Syscall param preadv(vector[1]) points to unaddressable byte(s)
 | ||||
| +   ...
 | ||||
| +   by 0x........: main (sys-preadv_pwritev.c:70)
 | ||||
| + Address 0x........ is not stack'd, malloc'd or (recently) free'd
 | ||||
| +
 | ||||
| diff --git a/memcheck/tests/linux/sys-preadv_pwritev.vgtest b/memcheck/tests/linux/sys-preadv_pwritev.vgtest
 | ||||
| new file mode 100644 | ||||
| index 000000000..f07dc2935
 | ||||
| --- /dev/null
 | ||||
| +++ b/memcheck/tests/linux/sys-preadv_pwritev.vgtest
 | ||||
| @@ -0,0 +1,3 @@
 | ||||
| +prereq: test -e sys-preadv_pwritev
 | ||||
| +prog: sys-preadv_pwritev
 | ||||
| +vgopts: -q
 | ||||
| 
 | ||||
| commit 514f899388e05142513ff3f679a9e0131145e34e | ||||
| Author: Mark Wielaard <mark@klomp.org> | ||||
| Date:   Wed Jul 3 10:27:17 2019 +0200 | ||||
| 
 | ||||
|     Hook up preadv2 and pwritev2 correctly for arm64. | ||||
|      | ||||
|     Use the correct generic linux sys wrapper. | ||||
|      | ||||
|     Followup for https://bugs.kde.org/408414 | ||||
| 
 | ||||
| diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c
 | ||||
| index d12d40632..91329b682 100644
 | ||||
| --- a/coregrind/m_syswrap/syswrap-arm64-linux.c
 | ||||
| +++ b/coregrind/m_syswrap/syswrap-arm64-linux.c
 | ||||
| @@ -818,8 +818,8 @@ static SyscallTableEntry syscall_main_table[] = {
 | ||||
|     LINX_(__NR_membarrier,        sys_membarrier),        // 283 | ||||
|     //   (__NR_mlock2,            sys_ni_syscall),        // 284 | ||||
|     LINX_(__NR_copy_file_range,   sys_copy_file_range),   // 285 | ||||
| -   LINX_(__NR_preadv2,           sys_ni_syscall),        // 286
 | ||||
| -   LINX_(__NR_pwritev2,          sys_ni_syscall),        // 287
 | ||||
| +   LINXY(__NR_preadv2,           sys_preadv2),           // 286
 | ||||
| +   LINX_(__NR_pwritev2,          sys_pwritev2),          // 287
 | ||||
|     //   (__NR_pkey_mprotect,     sys_ni_syscall),        // 288 | ||||
|     //   (__NR_pkey_alloc,        sys_ni_syscall),        // 289 | ||||
|     //   (__NR_pkey_free,         sys_ni_syscall),        // 290 | ||||
| @ -1,170 +0,0 @@ | ||||
| commit 3bac39a10abf292d332bb20ab58c6dd5c28f9108 | ||||
| Author: Eugene Syromyatnikov <evgsyr@gmail.com> | ||||
| Date:   Fri Mar 8 04:07:00 2019 +0100 | ||||
| 
 | ||||
|     include/vki: fix vki_siginfo_t definition on amd64, arm64, and ppc64 | ||||
|      | ||||
|     As it turned out, the size of vki_siginfo_t is incorrect on these 64-bit | ||||
|     architectures: | ||||
|      | ||||
|         (gdb) p sizeof(vki_siginfo_t) | ||||
|         $1 = 136 | ||||
|         (gdb) ptype struct vki_siginfo | ||||
|         type = struct vki_siginfo { | ||||
|             int si_signo; | ||||
|             int si_errno; | ||||
|             int si_code; | ||||
|             union { | ||||
|                 int _pad[29]; | ||||
|                 struct {...} _kill; | ||||
|                 struct {...} _timer; | ||||
|                 struct {...} _rt; | ||||
|                 struct {...} _sigchld; | ||||
|                 struct {...} _sigfault; | ||||
|                 struct {...} _sigpoll; | ||||
|             } _sifields; | ||||
|         } | ||||
|      | ||||
|     It looks like that for this architecture, __VKI_ARCH_SI_PREAMBLE_SIZE | ||||
|     hasn't been defined properly, which resulted in incorrect | ||||
|     VKI_SI_PAD_SIZE calculation (29 instead of 28). | ||||
|      | ||||
|         <6a9e4>   DW_AT_name        : (indirect string, offset: 0xcf59): _sifields | ||||
|         <6a9ef>   DW_AT_data_member_location: 16 | ||||
|      | ||||
|     This issue has been discovered with strace's "make check-valgrind-memcheck", | ||||
|     which produced false out-of-bounds writes on ptrace(PTRACE_GETSIGINFO) calls: | ||||
|      | ||||
|         SYSCALL[24264,1](101) sys_ptrace ( 16898, 24283, 0x0, 0x606bd40 ) | ||||
|         ==24264== Syscall param ptrace(getsiginfo) points to unaddressable byte(s) | ||||
|         ==24264==    at 0x575C06E: ptrace (ptrace.c:45) | ||||
|         ==24264==    by 0x443244: next_event (strace.c:2431) | ||||
|         ==24264==    by 0x443D30: main (strace.c:2845) | ||||
|         ==24264==  Address 0x606bdc0 is 0 bytes after a block of size 144 alloc'd | ||||
|      | ||||
|     (Note that the address passed is 0x606bd40 and the address reported is | ||||
|     0x606bdc0). | ||||
|      | ||||
|     After the patch, no such errors observed. | ||||
|      | ||||
|     * include/vki/vki-amd64-linux.h [__x86_64__ && __ILP32__] | ||||
|     (__vki_kernel_si_clock_t): New typedef. | ||||
|     [__x86_64__ && __ILP32__] (__VKI_ARCH_SI_CLOCK_T, | ||||
|     __VKI_ARCH_SI_ATTRIBUTES): New macros. | ||||
|     [__x86_64__ && !__ILP32__] (__VKI_ARCH_SI_PREAMBLE_SIZE): New macro, | ||||
|     define to 4 ints. | ||||
|     * include/vki/vki-arm64-linux.h (__VKI_ARCH_SI_PREAMBLE_SIZE): Likewise. | ||||
|     * include/vki/vki-ppc64-linux.h [__powerpc64__] (__VKI_ARCH_SI_PREAMBLE_SIZE): | ||||
|     Likewise. | ||||
|     * include/vki/vki-linux.h [!__VKI_ARCH_SI_CLOCK_T] | ||||
|     (__VKI_ARCH_SI_CLOCK_T): New macro, define to vki_clock_t. | ||||
|     [!__VKI_ARCH_SI_ATTRIBUTES] (__VKI_ARCH_SI_ATTRIBUTES): New macro, | ||||
|     define to nil. | ||||
|     (struct vki_siginfo): Use __VKI_ARCH_SI_CLOCK_T type for _utime and | ||||
|     _stime fields.  Add __VKI_ARCH_SI_ATTRIBUTES. | ||||
|      | ||||
|     Resolves: https://bugs.kde.org/show_bug.cgi?id=405201 | ||||
|     Reported-by: Dmitry V. Levin <ldv@altlinux.org> | ||||
|     Signed-off-by: Eugene Syromyatnikov <evgsyr@gmail.com> | ||||
| 
 | ||||
| diff --git a/include/vki/vki-amd64-linux.h b/include/vki/vki-amd64-linux.h
 | ||||
| index d6a5a77e6..fbd353aed 100644
 | ||||
| --- a/include/vki/vki-amd64-linux.h
 | ||||
| +++ b/include/vki/vki-amd64-linux.h
 | ||||
| @@ -297,6 +297,21 @@ struct vki_f_owner_ex {
 | ||||
|  #define VKI_RLIMIT_CORE		4	/* max core file size */ | ||||
|  #define VKI_RLIMIT_NOFILE	7	/* max number of open files */ | ||||
|   | ||||
| +//----------------------------------------------------------------------
 | ||||
| +// From linux-5.0.0/arch/x86/include/uapi/asm/siginfo.h
 | ||||
| +//----------------------------------------------------------------------
 | ||||
| +
 | ||||
| +/* We need that to ensure that sizeof(siginfo) == 128. */
 | ||||
| +#ifdef __x86_64__
 | ||||
| +# ifdef __ILP32__
 | ||||
| +typedef long long __vki_kernel_si_clock_t __attribute__((aligned(4)));
 | ||||
| +#  define __VKI_ARCH_SI_CLOCK_T             __vki_kernel_si_clock_t
 | ||||
| +#  define __VKI_ARCH_SI_ATTRIBUTES          __attribute__((aligned(8)))
 | ||||
| +# else
 | ||||
| +#  define __VKI_ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
 | ||||
| +# endif
 | ||||
| +#endif
 | ||||
| +
 | ||||
|  //---------------------------------------------------------------------- | ||||
|  // From linux-2.6.9/include/asm-x86_64/socket.h | ||||
|  //---------------------------------------------------------------------- | ||||
| diff --git a/include/vki/vki-arm64-linux.h b/include/vki/vki-arm64-linux.h
 | ||||
| index ecea8cc78..69fb3ed00 100644
 | ||||
| --- a/include/vki/vki-arm64-linux.h
 | ||||
| +++ b/include/vki/vki-arm64-linux.h
 | ||||
| @@ -193,6 +193,12 @@ struct vki_sigcontext {
 | ||||
|          __vki_u8 __reserved[4096] __attribute__((__aligned__(16))); | ||||
|  }; | ||||
|   | ||||
| +//----------------------------------------------------------------------
 | ||||
| +// From linux-5.0.0/arch/arm64/include/uapi/asm/siginfo.h
 | ||||
| +//----------------------------------------------------------------------
 | ||||
| +
 | ||||
| +#define __VKI_ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
 | ||||
| +
 | ||||
|  //---------------------------------------------------------------------- | ||||
|  // From linux-3.10.5/uapi/include/asm-generic/mman-common.h | ||||
|  //---------------------------------------------------------------------- | ||||
| diff --git a/include/vki/vki-linux.h b/include/vki/vki-linux.h
 | ||||
| index 6024f2165..6903c77db 100644
 | ||||
| --- a/include/vki/vki-linux.h
 | ||||
| +++ b/include/vki/vki-linux.h
 | ||||
| @@ -426,6 +426,14 @@ typedef union vki_sigval {
 | ||||
|  #define __VKI_ARCH_SI_BAND_T long | ||||
|  #endif | ||||
|   | ||||
| +#ifndef __VKI_ARCH_SI_CLOCK_T
 | ||||
| +#define __VKI_ARCH_SI_CLOCK_T vki_clock_t
 | ||||
| +#endif
 | ||||
| +
 | ||||
| +#ifndef __VKI_ARCH_SI_ATTRIBUTES
 | ||||
| +#define __VKI_ARCH_SI_ATTRIBUTES
 | ||||
| +#endif
 | ||||
| +
 | ||||
|  // [[Nb: this type changed between 2.4 and 2.6, but not in a way that | ||||
|  // affects Valgrind.]] | ||||
|  typedef struct vki_siginfo { | ||||
| @@ -463,8 +471,8 @@ typedef struct vki_siginfo {
 | ||||
|  			vki_pid_t _pid;		/* which child */ | ||||
|  			__VKI_ARCH_SI_UID_T _uid;	/* sender's uid */ | ||||
|  			int _status;		/* exit code */ | ||||
| -			vki_clock_t _utime;
 | ||||
| -			vki_clock_t _stime;
 | ||||
| +			__VKI_ARCH_SI_CLOCK_T _utime;
 | ||||
| +			__VKI_ARCH_SI_CLOCK_T _stime;
 | ||||
|  		} _sigchld; | ||||
|   | ||||
|  		/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ | ||||
| @@ -481,7 +489,7 @@ typedef struct vki_siginfo {
 | ||||
|  			int _fd; | ||||
|  		} _sigpoll; | ||||
|  	} _sifields; | ||||
| -} vki_siginfo_t;
 | ||||
| +} __VKI_ARCH_SI_ATTRIBUTES vki_siginfo_t;
 | ||||
|  #endif | ||||
|   | ||||
|  #define __VKI_SI_FAULT	0 | ||||
| diff --git a/include/vki/vki-ppc64-linux.h b/include/vki/vki-ppc64-linux.h
 | ||||
| index a5e64dd39..04f72048a 100644
 | ||||
| --- a/include/vki/vki-ppc64-linux.h
 | ||||
| +++ b/include/vki/vki-ppc64-linux.h
 | ||||
| @@ -335,6 +335,14 @@ struct vki_sigcontext {
 | ||||
|    long             vmx_reserve[VKI_ELF_NVRREG+VKI_ELF_NVRREG+1]; | ||||
|  }; | ||||
|   | ||||
| +//----------------------------------------------------------------------
 | ||||
| +// From linux-5.0.0/arch/powerpc/include/uapi/asm/siginfo.h
 | ||||
| +//----------------------------------------------------------------------
 | ||||
| +
 | ||||
| +#ifdef __powerpc64__
 | ||||
| +# define __VKI_ARCH_SI_PREAMBLE_SIZE     (4 * sizeof(int))
 | ||||
| +#endif
 | ||||
| +
 | ||||
|  //---------------------------------------------------------------------- | ||||
|  // From linux-2.6.13/include/asm-ppc64/mman.h | ||||
|  //---------------------------------------------------------------------- | ||||
| @ -1,153 +0,0 @@ | ||||
| From abbd80e7e23deb1f27fb50410c8b3a3f7cdfb646 Mon Sep 17 00:00:00 2001 | ||||
| From: Andreas Arnez <arnez@linux.ibm.com> | ||||
| Date: Wed, 12 Feb 2020 14:13:55 +0100 | ||||
| Subject: [PATCH] Bug 417452 - s390_insn_store_emit: dst->tag for HRcVec128 | ||||
| 
 | ||||
| It was seen that the s390 instruction selector chose a wrong addressing | ||||
| mode for storing a vector register.  The VST instruction only handles | ||||
| short (12-bit unsigned) displacements, but a long (20-bit signed) | ||||
| displacement was generated instead, resulting in a panic: | ||||
| 
 | ||||
| vex: the `impossible' happened: | ||||
|    s390_insn_store_emit: unknown dst->tag for HRcVec128 | ||||
| 
 | ||||
| The fix prevents long displacements for vector store operations.  It also | ||||
| optimizes vector store operations from an Iex_Get, by converting them to a | ||||
| memory copy.  This optimization was already performed for integer | ||||
| registers. | ||||
| ---
 | ||||
|  VEX/priv/host_s390_defs.c |  2 +- | ||||
|  VEX/priv/host_s390_isel.c | 67 +++++++++++++++++++++++++++------------ | ||||
|  2 files changed, 48 insertions(+), 21 deletions(-) | ||||
| 
 | ||||
| diff --git a/VEX/priv/host_s390_defs.c b/VEX/priv/host_s390_defs.c
 | ||||
| index 9ad7240c4..47928cbe1 100644
 | ||||
| --- a/VEX/priv/host_s390_defs.c
 | ||||
| +++ b/VEX/priv/host_s390_defs.c
 | ||||
| @@ -6314,7 +6314,7 @@ s390_insn_memcpy(UChar size, s390_amode *dst, s390_amode *src)
 | ||||
|     insn->variant.memcpy.src = src; | ||||
|     insn->variant.memcpy.dst = dst; | ||||
|   | ||||
| -   vassert(size == 1 || size == 2 || size == 4 || size == 8);
 | ||||
| +   vassert(size == 1 || size == 2 || size == 4 || size == 8 || size == 16);
 | ||||
|   | ||||
|     return insn; | ||||
|  } | ||||
| diff --git a/VEX/priv/host_s390_isel.c b/VEX/priv/host_s390_isel.c
 | ||||
| index 97614c873..fff81fe0f 100644
 | ||||
| --- a/VEX/priv/host_s390_isel.c
 | ||||
| +++ b/VEX/priv/host_s390_isel.c
 | ||||
| @@ -302,12 +302,14 @@ ulong_fits_signed_8bit(ULong val)
 | ||||
|     return val == v; | ||||
|  } | ||||
|   | ||||
| -/* EXPR is an expression that is used as an address. Return an s390_amode
 | ||||
| -   for it. If select_b12_b20_only is true the returned amode must be either
 | ||||
| -   S390_AMODE_B12 or S390_AMODE_B20. */
 | ||||
| +/* EXPR is an expression that is used as an address. Return an s390_amode for
 | ||||
| +   it. If no_index is true the returned amode must be either S390_AMODE_B12 or
 | ||||
| +   S390_AMODE_B20. If short_displacement is true it must be either
 | ||||
| +   S390_AMODE_B12 or S390_AMODE_BX12. */
 | ||||
|  static s390_amode * | ||||
|  s390_isel_amode_wrk(ISelEnv *env, IRExpr *expr, | ||||
| -                    Bool select_b12_b20_only __attribute__((unused)))
 | ||||
| +                    Bool no_index __attribute__((unused)),
 | ||||
| +                    Bool short_displacement)
 | ||||
|  { | ||||
|     if (expr->tag == Iex_Binop && expr->Iex.Binop.op == Iop_Add64) { | ||||
|        IRExpr *arg1 = expr->Iex.Binop.arg1; | ||||
| @@ -328,7 +330,7 @@ s390_isel_amode_wrk(ISelEnv *env, IRExpr *expr,
 | ||||
|           if (ulong_fits_unsigned_12bit(value)) { | ||||
|              return s390_amode_b12((Int)value, s390_isel_int_expr(env, arg1)); | ||||
|           } | ||||
| -         if (ulong_fits_signed_20bit(value)) {
 | ||||
| +         if (!short_displacement && ulong_fits_signed_20bit(value)) {
 | ||||
|              return s390_amode_b20((Int)value, s390_isel_int_expr(env, arg1)); | ||||
|           } | ||||
|        } | ||||
| @@ -348,7 +350,25 @@ s390_isel_amode(ISelEnv *env, IRExpr *expr)
 | ||||
|     /* Address computation should yield a 64-bit value */ | ||||
|     vassert(typeOfIRExpr(env->type_env, expr) == Ity_I64); | ||||
|   | ||||
| -   am = s390_isel_amode_wrk(env, expr, /* B12, B20 only */ False);
 | ||||
| +   am = s390_isel_amode_wrk(env, expr, False, False);
 | ||||
| +
 | ||||
| +   /* Check post-condition */
 | ||||
| +   vassert(s390_amode_is_sane(am));
 | ||||
| +
 | ||||
| +   return am;
 | ||||
| +}
 | ||||
| +
 | ||||
| +/* Sometimes we need an amode with short (12-bit) displacement. An example is
 | ||||
| +   the vector-store opcode. */
 | ||||
| +static s390_amode *
 | ||||
| +s390_isel_amode_short(ISelEnv *env, IRExpr *expr)
 | ||||
| +{
 | ||||
| +   s390_amode *am;
 | ||||
| +
 | ||||
| +   /* Address computation should yield a 64-bit value */
 | ||||
| +   vassert(typeOfIRExpr(env->type_env, expr) == Ity_I64);
 | ||||
| +
 | ||||
| +   am = s390_isel_amode_wrk(env, expr, False, True);
 | ||||
|   | ||||
|     /* Check post-condition */ | ||||
|     vassert(s390_amode_is_sane(am)); | ||||
| @@ -379,7 +399,7 @@ s390_isel_amode_b12_b20(ISelEnv *env, IRExpr *expr)
 | ||||
|     /* Address computation should yield a 64-bit value */ | ||||
|     vassert(typeOfIRExpr(env->type_env, expr) == Ity_I64); | ||||
|   | ||||
| -   am = s390_isel_amode_wrk(env, expr, /* B12, B20 only */ True);
 | ||||
| +   am = s390_isel_amode_wrk(env, expr, True, False);
 | ||||
|   | ||||
|     /* Check post-condition */ | ||||
|     vassert(s390_amode_is_sane(am) && | ||||
| @@ -4727,7 +4747,26 @@ s390_isel_stmt(ISelEnv *env, IRStmt *stmt)
 | ||||
|   | ||||
|        if (stmt->Ist.Store.end != Iend_BE) goto stmt_fail; | ||||
|   | ||||
| -      am = s390_isel_amode(env, stmt->Ist.Store.addr);
 | ||||
| +      if (tyd == Ity_V128) {
 | ||||
| +         am = s390_isel_amode_short(env, stmt->Ist.Store.addr);
 | ||||
| +      } else {
 | ||||
| +         am = s390_isel_amode(env, stmt->Ist.Store.addr);
 | ||||
| +      }
 | ||||
| +
 | ||||
| +      /* Check whether we can use a memcpy. Currently, the restriction
 | ||||
| +         is that both amodes need to be B12, so MVC can be emitted.
 | ||||
| +         We do not consider a store whose data expression is a load because
 | ||||
| +         we don't want to deal with overlapping locations. */
 | ||||
| +      /* store(get) never overlaps*/
 | ||||
| +      if (am->tag == S390_AMODE_B12 &&
 | ||||
| +          stmt->Ist.Store.data->tag == Iex_Get) {
 | ||||
| +         UInt offset = stmt->Ist.Store.data->Iex.Get.offset;
 | ||||
| +         s390_amode *from = s390_amode_for_guest_state(offset);
 | ||||
| +         if (from->tag == S390_AMODE_B12) {
 | ||||
| +            addInstr(env, s390_insn_memcpy(sizeofIRType(tyd), am, from));
 | ||||
| +            return;
 | ||||
| +         }
 | ||||
| +      }
 | ||||
|   | ||||
|        switch (tyd) { | ||||
|        case Ity_I8: | ||||
| @@ -4742,18 +4781,6 @@ s390_isel_stmt(ISelEnv *env, IRStmt *stmt)
 | ||||
|              addInstr(env, s390_insn_mimm(sizeofIRType(tyd), am, value)); | ||||
|              return; | ||||
|           } | ||||
| -         /* Check whether we can use a memcpy here. Currently, the restriction
 | ||||
| -            is that both amodes need to be B12, so MVC can be emitted.
 | ||||
| -            We do not consider a store whose data expression is a load because
 | ||||
| -            we don't want to deal with overlapping locations. */
 | ||||
| -         /* store(get) never overlaps*/
 | ||||
| -         if (am->tag == S390_AMODE_B12 &&
 | ||||
| -             stmt->Ist.Store.data->tag == Iex_Get) {
 | ||||
| -            UInt offset = stmt->Ist.Store.data->Iex.Get.offset;
 | ||||
| -            s390_amode *from = s390_amode_for_guest_state(offset);
 | ||||
| -            addInstr(env, s390_insn_memcpy(sizeofIRType(tyd), am, from));
 | ||||
| -            return;
 | ||||
| -         }
 | ||||
|           /* General case: compile data into a register */ | ||||
|           src = s390_isel_int_expr(env, stmt->Ist.Store.data); | ||||
|           break; | ||||
| -- 
 | ||||
| 2.23.0 | ||||
| 
 | ||||
| @ -1,436 +0,0 @@ | ||||
| diff --git a/README.s390 b/README.s390
 | ||||
| index ac9485a62..7df386ef4 100644
 | ||||
| --- a/README.s390
 | ||||
| +++ b/README.s390
 | ||||
| @@ -11,7 +11,10 @@ Limitations
 | ||||
|  ----------- | ||||
|  - 31-bit client programs are not supported. | ||||
|  - Hexadecimal floating point is not supported. | ||||
| -- Transactional memory is not supported.
 | ||||
| +- Transactional memory is not supported. The transactional-execution
 | ||||
| +  facility is masked off from HWCAP.
 | ||||
| +- FP signalling is not accurate. E.g., the "compare and signal"
 | ||||
| +  instructions behave like their non-signalling counterparts.
 | ||||
|  - memcheck, cachegrind, drd, helgrind, massif, lackey, and none are | ||||
|    supported.  | ||||
|  - On machine models predating z10, cachegrind will assume a z10 cache | ||||
| @@ -21,8 +24,6 @@ Limitations
 | ||||
|  - Some gcc versions use mvc to copy 4/8 byte values. This will affect | ||||
|    certain debug messages. For example, memcheck will complain about | ||||
|    4 one-byte reads/writes instead of just a single read/write. | ||||
| -- The transactional-execution facility is not supported; it is masked
 | ||||
| -  off from HWCAP.
 | ||||
|   | ||||
|   | ||||
|  Hardware facilities | ||||
| diff --git a/VEX/priv/guest_s390_toIR.c b/VEX/priv/guest_s390_toIR.c
 | ||||
| index a8f0d3a07..1f626f722 100644
 | ||||
| --- a/VEX/priv/guest_s390_toIR.c
 | ||||
| +++ b/VEX/priv/guest_s390_toIR.c
 | ||||
| @@ -1204,6 +1204,16 @@ get_dpr_dw0(UInt archreg)
 | ||||
|     return IRExpr_Get(fpr_dw0_offset(archreg), Ity_D64); | ||||
|  } | ||||
|   | ||||
| +/* Read a float of given type from an fpr. */
 | ||||
| +static IRExpr *
 | ||||
| +get_fpr_float(UInt archreg, IRType type)
 | ||||
| +{
 | ||||
| +   if (type == Ity_F128)
 | ||||
| +      return get_fpr_pair(archreg);
 | ||||
| +   else
 | ||||
| +      return IRExpr_Get(fpr_offset(archreg), type);
 | ||||
| +}
 | ||||
| +
 | ||||
|  /*------------------------------------------------------------*/ | ||||
|  /*--- gpr registers                                        ---*/ | ||||
|  /*------------------------------------------------------------*/ | ||||
| @@ -14055,94 +14065,102 @@ s390_irgen_AXBR(UChar r1, UChar r2)
 | ||||
|     return "axbr"; | ||||
|  } | ||||
|   | ||||
| +/* Helper for "compare" insns CEBR, CDBR, CXBR, and their signalling
 | ||||
| +   counterparts. */
 | ||||
|  static const HChar * | ||||
| -s390_irgen_CEBR(UChar r1, UChar r2)
 | ||||
| +s390_irgen_CxBR(const HChar *mnem, UChar r1, UChar r2, IRType type, IROp cmp_op)
 | ||||
|  { | ||||
| -   IRTemp op1 = newTemp(Ity_F32);
 | ||||
| -   IRTemp op2 = newTemp(Ity_F32);
 | ||||
| +   IRTemp op1 = newTemp(type);
 | ||||
| +   IRTemp op2 = newTemp(type);
 | ||||
|     IRTemp cc_vex  = newTemp(Ity_I32); | ||||
|     IRTemp cc_s390 = newTemp(Ity_I32); | ||||
|   | ||||
| -   assign(op1, get_fpr_w0(r1));
 | ||||
| -   assign(op2, get_fpr_w0(r2));
 | ||||
| -   assign(cc_vex, binop(Iop_CmpF32, mkexpr(op1), mkexpr(op2)));
 | ||||
| +   assign(op1, get_fpr_float(r1, type));
 | ||||
| +   assign(op2, get_fpr_float(r2, type));
 | ||||
| +   assign(cc_vex, binop(cmp_op, mkexpr(op1), mkexpr(op2)));
 | ||||
|   | ||||
|     assign(cc_s390, convert_vex_bfpcc_to_s390(cc_vex)); | ||||
|     s390_cc_thunk_put1(S390_CC_OP_SET, cc_s390, False); | ||||
| +   return mnem;
 | ||||
| +}
 | ||||
| +
 | ||||
| +static const HChar *
 | ||||
| +s390_irgen_CEBR(UChar r1, UChar r2)
 | ||||
| +{
 | ||||
| +   return s390_irgen_CxBR("cebr", r1, r2, Ity_F32, Iop_CmpF32);
 | ||||
| +}
 | ||||
|   | ||||
| -   return "cebr";
 | ||||
| +static const HChar *
 | ||||
| +s390_irgen_KEBR(UChar r1, UChar r2)
 | ||||
| +{
 | ||||
| +   return s390_irgen_CxBR("kebr", r1, r2, Ity_F32, Iop_CmpF32);
 | ||||
|  } | ||||
|   | ||||
|  static const HChar * | ||||
|  s390_irgen_CDBR(UChar r1, UChar r2) | ||||
|  { | ||||
| -   IRTemp op1 = newTemp(Ity_F64);
 | ||||
| -   IRTemp op2 = newTemp(Ity_F64);
 | ||||
| -   IRTemp cc_vex  = newTemp(Ity_I32);
 | ||||
| -   IRTemp cc_s390 = newTemp(Ity_I32);
 | ||||
| +   return s390_irgen_CxBR("cdbr", r1, r2, Ity_F64, Iop_CmpF64);
 | ||||
| +}
 | ||||
|   | ||||
| -   assign(op1, get_fpr_dw0(r1));
 | ||||
| -   assign(op2, get_fpr_dw0(r2));
 | ||||
| -   assign(cc_vex, binop(Iop_CmpF64, mkexpr(op1), mkexpr(op2)));
 | ||||
| +static const HChar *
 | ||||
| +s390_irgen_KDBR(UChar r1, UChar r2)
 | ||||
| +{
 | ||||
| +   return s390_irgen_CxBR("kdbr", r1, r2, Ity_F64, Iop_CmpF64);
 | ||||
| +}
 | ||||
|   | ||||
| -   assign(cc_s390, convert_vex_bfpcc_to_s390(cc_vex));
 | ||||
| -   s390_cc_thunk_put1(S390_CC_OP_SET, cc_s390, False);
 | ||||
| +static const HChar *
 | ||||
| +s390_irgen_CXBR(UChar r1, UChar r2)
 | ||||
| +{
 | ||||
| +   return s390_irgen_CxBR("cxbr", r1, r2, Ity_F128, Iop_CmpF128);
 | ||||
| +}
 | ||||
|   | ||||
| -   return "cdbr";
 | ||||
| +static const HChar *
 | ||||
| +s390_irgen_KXBR(UChar r1, UChar r2)
 | ||||
| +{
 | ||||
| +   return s390_irgen_CxBR("kxbr", r1, r2, Ity_F128, Iop_CmpF128);
 | ||||
|  } | ||||
|   | ||||
| +/* Helper for "compare" insns CEB, CDB, and their signalling counterparts. */
 | ||||
|  static const HChar * | ||||
| -s390_irgen_CXBR(UChar r1, UChar r2)
 | ||||
| +s390_irgen_CxB(const HChar *mnem, UChar r1, IRTemp op2addr, IRType type, IROp cmp_op)
 | ||||
|  { | ||||
| -   IRTemp op1 = newTemp(Ity_F128);
 | ||||
| -   IRTemp op2 = newTemp(Ity_F128);
 | ||||
| +   IRTemp op1 = newTemp(type);
 | ||||
| +   IRTemp op2 = newTemp(type);
 | ||||
|     IRTemp cc_vex  = newTemp(Ity_I32); | ||||
|     IRTemp cc_s390 = newTemp(Ity_I32); | ||||
|   | ||||
| -   assign(op1, get_fpr_pair(r1));
 | ||||
| -   assign(op2, get_fpr_pair(r2));
 | ||||
| -   assign(cc_vex, binop(Iop_CmpF128, mkexpr(op1), mkexpr(op2)));
 | ||||
| +   assign(op1, get_fpr_float(r1, type));
 | ||||
| +   assign(op2, load(type, mkexpr(op2addr)));
 | ||||
| +   assign(cc_vex,  binop(cmp_op, mkexpr(op1), mkexpr(op2)));
 | ||||
|   | ||||
|     assign(cc_s390, convert_vex_bfpcc_to_s390(cc_vex)); | ||||
|     s390_cc_thunk_put1(S390_CC_OP_SET, cc_s390, False); | ||||
| -
 | ||||
| -   return "cxbr";
 | ||||
| +   return mnem;
 | ||||
|  } | ||||
|   | ||||
|  static const HChar * | ||||
|  s390_irgen_CEB(UChar r1, IRTemp op2addr) | ||||
|  { | ||||
| -   IRTemp op1 = newTemp(Ity_F32);
 | ||||
| -   IRTemp op2 = newTemp(Ity_F32);
 | ||||
| -   IRTemp cc_vex  = newTemp(Ity_I32);
 | ||||
| -   IRTemp cc_s390 = newTemp(Ity_I32);
 | ||||
| -
 | ||||
| -   assign(op1, get_fpr_w0(r1));
 | ||||
| -   assign(op2, load(Ity_F32, mkexpr(op2addr)));
 | ||||
| -   assign(cc_vex,  binop(Iop_CmpF32, mkexpr(op1), mkexpr(op2)));
 | ||||
| -
 | ||||
| -   assign(cc_s390, convert_vex_bfpcc_to_s390(cc_vex));
 | ||||
| -   s390_cc_thunk_put1(S390_CC_OP_SET, cc_s390, False);
 | ||||
| +   return s390_irgen_CxB("ceb", r1, op2addr, Ity_F32, Iop_CmpF32);
 | ||||
| +}
 | ||||
|   | ||||
| -   return "ceb";
 | ||||
| +static const HChar *
 | ||||
| +s390_irgen_KEB(UChar r1, IRTemp op2addr)
 | ||||
| +{
 | ||||
| +   return s390_irgen_CxB("keb", r1, op2addr, Ity_F32, Iop_CmpF32);
 | ||||
| +   return "keb";
 | ||||
|  } | ||||
|   | ||||
|  static const HChar * | ||||
|  s390_irgen_CDB(UChar r1, IRTemp op2addr) | ||||
|  { | ||||
| -   IRTemp op1 = newTemp(Ity_F64);
 | ||||
| -   IRTemp op2 = newTemp(Ity_F64);
 | ||||
| -   IRTemp cc_vex  = newTemp(Ity_I32);
 | ||||
| -   IRTemp cc_s390 = newTemp(Ity_I32);
 | ||||
| -
 | ||||
| -   assign(op1, get_fpr_dw0(r1));
 | ||||
| -   assign(op2, load(Ity_F64, mkexpr(op2addr)));
 | ||||
| -   assign(cc_vex, binop(Iop_CmpF64, mkexpr(op1), mkexpr(op2)));
 | ||||
| -
 | ||||
| -   assign(cc_s390, convert_vex_bfpcc_to_s390(cc_vex));
 | ||||
| -   s390_cc_thunk_put1(S390_CC_OP_SET, cc_s390, False);
 | ||||
| +   return s390_irgen_CxB("cdb", r1, op2addr, Ity_F64, Iop_CmpF64);
 | ||||
| +}
 | ||||
|   | ||||
| -   return "cdb";
 | ||||
| +static const HChar *
 | ||||
| +s390_irgen_KDB(UChar r1, IRTemp op2addr)
 | ||||
| +{
 | ||||
| +   return s390_irgen_CxB("kdb", r1, op2addr, Ity_F64, Iop_CmpF64);
 | ||||
|  } | ||||
|   | ||||
|  static const HChar * | ||||
| @@ -19270,7 +19288,8 @@ s390_decode_4byte_and_irgen(const UChar *bytes)
 | ||||
|     case 0xb306: s390_format_RRE_FF(s390_irgen_LXEBR, RRE_r1(ovl), | ||||
|                                     RRE_r2(ovl));  goto ok; | ||||
|     case 0xb307: /* MXDBR */ goto unimplemented; | ||||
| -   case 0xb308: /* KEBR */ goto unimplemented;
 | ||||
| +   case 0xb308: s390_format_RRE_FF(s390_irgen_KEBR, RRE_r1(ovl),
 | ||||
| +                                   RRE_r2(ovl));  goto ok;
 | ||||
|     case 0xb309: s390_format_RRE_FF(s390_irgen_CEBR, RRE_r1(ovl), | ||||
|                                     RRE_r2(ovl));  goto ok; | ||||
|     case 0xb30a: s390_format_RRE_FF(s390_irgen_AEBR, RRE_r1(ovl), | ||||
| @@ -19300,7 +19319,8 @@ s390_decode_4byte_and_irgen(const UChar *bytes)
 | ||||
|                                     RRE_r2(ovl));  goto ok; | ||||
|     case 0xb317: s390_format_RRE_FF(s390_irgen_MEEBR, RRE_r1(ovl), | ||||
|                                     RRE_r2(ovl));  goto ok; | ||||
| -   case 0xb318: /* KDBR */ goto unimplemented;
 | ||||
| +   case 0xb318: s390_format_RRE_FF(s390_irgen_KDBR, RRE_r1(ovl),
 | ||||
| +                                   RRE_r2(ovl));  goto ok;
 | ||||
|     case 0xb319: s390_format_RRE_FF(s390_irgen_CDBR, RRE_r1(ovl), | ||||
|                                     RRE_r2(ovl));  goto ok; | ||||
|     case 0xb31a: s390_format_RRE_FF(s390_irgen_ADBR, RRE_r1(ovl), | ||||
| @@ -19351,7 +19371,8 @@ s390_decode_4byte_and_irgen(const UChar *bytes)
 | ||||
|     case 0xb347: s390_format_RRF_UUFF(s390_irgen_FIXBRA, RRF2_m3(ovl), | ||||
|                                       RRF2_m4(ovl), RRF2_r1(ovl), | ||||
|                                       RRF2_r2(ovl));  goto ok; | ||||
| -   case 0xb348: /* KXBR */ goto unimplemented;
 | ||||
| +   case 0xb348: s390_format_RRE_FF(s390_irgen_KXBR, RRE_r1(ovl),
 | ||||
| +                                   RRE_r2(ovl));  goto ok;
 | ||||
|     case 0xb349: s390_format_RRE_FF(s390_irgen_CXBR, RRE_r1(ovl), | ||||
|                                     RRE_r2(ovl));  goto ok; | ||||
|     case 0xb34a: s390_format_RRE_FF(s390_irgen_AXBR, RRE_r1(ovl), | ||||
| @@ -21408,7 +21429,9 @@ s390_decode_6byte_and_irgen(const UChar *bytes)
 | ||||
|                                                  RXE_x2(ovl), RXE_b2(ovl), | ||||
|                                                  RXE_d2(ovl));  goto ok; | ||||
|     case 0xed0000000007ULL: /* MXDB */ goto unimplemented; | ||||
| -   case 0xed0000000008ULL: /* KEB */ goto unimplemented;
 | ||||
| +   case 0xed0000000008ULL: s390_format_RXE_FRRD(s390_irgen_KEB, RXE_r1(ovl),
 | ||||
| +                                                RXE_x2(ovl), RXE_b2(ovl),
 | ||||
| +                                                RXE_d2(ovl));  goto ok;
 | ||||
|     case 0xed0000000009ULL: s390_format_RXE_FRRD(s390_irgen_CEB, RXE_r1(ovl), | ||||
|                                                  RXE_x2(ovl), RXE_b2(ovl), | ||||
|                                                  RXE_d2(ovl));  goto ok; | ||||
| @@ -21448,7 +21471,9 @@ s390_decode_6byte_and_irgen(const UChar *bytes)
 | ||||
|     case 0xed0000000017ULL: s390_format_RXE_FRRD(s390_irgen_MEEB, RXE_r1(ovl), | ||||
|                                                  RXE_x2(ovl), RXE_b2(ovl), | ||||
|                                                  RXE_d2(ovl));  goto ok; | ||||
| -   case 0xed0000000018ULL: /* KDB */ goto unimplemented;
 | ||||
| +   case 0xed0000000018ULL: s390_format_RXE_FRRD(s390_irgen_KDB, RXE_r1(ovl),
 | ||||
| +                                                RXE_x2(ovl), RXE_b2(ovl),
 | ||||
| +                                                RXE_d2(ovl));  goto ok;
 | ||||
|     case 0xed0000000019ULL: s390_format_RXE_FRRD(s390_irgen_CDB, RXE_r1(ovl), | ||||
|                                                  RXE_x2(ovl), RXE_b2(ovl), | ||||
|                                                  RXE_d2(ovl));  goto ok; | ||||
| diff --git a/none/tests/s390x/bfp-4.c b/none/tests/s390x/bfp-4.c
 | ||||
| index c2d88818c..645421294 100644
 | ||||
| --- a/none/tests/s390x/bfp-4.c
 | ||||
| +++ b/none/tests/s390x/bfp-4.c
 | ||||
| @@ -1,61 +1,77 @@
 | ||||
|  #include <stdio.h> | ||||
|   | ||||
| -/* Test BFP comparison for  32/64-bit. */
 | ||||
| +#define TEST_CxBR(insn, fmt, v1, v2)            \
 | ||||
| +   do {                                         \
 | ||||
| +   int cc;                                      \
 | ||||
| +                                                \
 | ||||
| +   __asm__ volatile(insn " %[r1],%[r2]\n\t"                             \
 | ||||
| +                    "ipm   %[psw]\n\t"                                  \
 | ||||
| +                    "srl   %[psw],28\n\t"                               \
 | ||||
| +                    : [psw]"=d"(cc) : [r1]"f"(v1), [r2]"f"(v2) : "cc"); \
 | ||||
| +   if (cc == 0)                                                         \
 | ||||
| +      printf(insn ":  " fmt " == " fmt "\n", v1, v2);                   \
 | ||||
| +   else if (cc == 1)                                                    \
 | ||||
| +      printf(insn ":  " fmt " < " fmt "\n", v1, v2);                    \
 | ||||
| +   else if (cc == 2)                                                    \
 | ||||
| +      printf(insn ":  " fmt " > " fmt "\n", v1, v2);                    \
 | ||||
| +   else                                                                 \
 | ||||
| +      printf(insn ":  " fmt " ?? " fmt "\n", v1, v2);                   \
 | ||||
| +   } while (0)
 | ||||
|   | ||||
| -void cebr(float v1, float v2)
 | ||||
| +/* Test BFP comparison for 32/64/128-bit. */
 | ||||
| +
 | ||||
| +void cebr(float a, float b)
 | ||||
| +{
 | ||||
| +   TEST_CxBR("cebr", "%g", a, b);
 | ||||
| +}
 | ||||
| +
 | ||||
| +void cdbr(double a, double b)
 | ||||
| +{
 | ||||
| +   TEST_CxBR("cdbr", "%g", a, b);
 | ||||
| +}
 | ||||
| +
 | ||||
| +void cxbr(long double a, long double b)
 | ||||
|  { | ||||
| -   int cc;
 | ||||
| +   TEST_CxBR("cxbr", "%Lg", a, b);
 | ||||
| +}
 | ||||
|   | ||||
| -   __asm__ volatile("cebr %[r1],%[r2]\n\t"
 | ||||
| -                    "ipm   %[psw]\n\t"
 | ||||
| -                    "srl   %[psw],28\n\t"
 | ||||
| -                    : [psw]"=d"(cc) : [r1]"f"(v1), [r2]"f"(v2) : "cc");
 | ||||
| -   if (cc == 0)
 | ||||
| -      printf("cfebr:  %f == %f\n", v1, v2);
 | ||||
| -   if (cc == 1)
 | ||||
| -      printf("cfebr:  %f < %f\n", v1, v2);
 | ||||
| -   if (cc == 2)
 | ||||
| -      printf("cfebr:  %f > %f\n", v1, v2);
 | ||||
| +void kebr(float a, float b)
 | ||||
| +{
 | ||||
| +   TEST_CxBR("kebr", "%g", a, b);
 | ||||
|  } | ||||
|   | ||||
| -void cdbr(double v1, double v2)
 | ||||
| +void kdbr(double a, double b)
 | ||||
|  { | ||||
| -   int cc;
 | ||||
| +   TEST_CxBR("kdbr", "%g", a, b);
 | ||||
| +}
 | ||||
|   | ||||
| -   __asm__ volatile("cdbr %[r1],%[r2]\n\t"
 | ||||
| -                    "ipm   %[psw]\n\t"
 | ||||
| -                    "srl   %[psw],28\n\t"
 | ||||
| -                    : [psw]"=d"(cc) : [r1]"f"(v1), [r2]"f"(v2) : "cc");
 | ||||
| -   if (cc == 0)
 | ||||
| -      printf("cdebr:  %f == %f\n", v1, v2);
 | ||||
| -   if (cc == 1)
 | ||||
| -      printf("cdebr:  %f < %f\n", v1, v2);
 | ||||
| -   if (cc == 2)
 | ||||
| -      printf("cdebr:  %f > %f\n", v1, v2);
 | ||||
| +void kxbr(long double a, long double b)
 | ||||
| +{
 | ||||
| +   TEST_CxBR("kxbr", "%Lg", a, b);
 | ||||
| +}
 | ||||
| +
 | ||||
| +void do_compare(float a, float b)
 | ||||
| +{
 | ||||
| +   cebr(a, b);
 | ||||
| +   kebr(a, b);
 | ||||
| +   cdbr((double) a, (double) b);
 | ||||
| +   kdbr((double) a, (double) b);
 | ||||
| +   cxbr((long double) a, (long double) b);
 | ||||
| +   kxbr((long double) a, (long double) b);
 | ||||
|  } | ||||
|   | ||||
|  int main(void) | ||||
|  { | ||||
| -   float f1, f2;
 | ||||
| -   float d1, d2;
 | ||||
| -
 | ||||
| -   // compare 4 bytes
 | ||||
| -   f1 = 3.14f;
 | ||||
| -   f2 = f1;
 | ||||
| -   cebr(f1, f2);
 | ||||
| -   f2 = f1 + 10.;
 | ||||
| -   cebr(f1, f2);
 | ||||
| -   f2 = f1 - 100.;
 | ||||
| -   cebr(f1, f2);
 | ||||
| -
 | ||||
| -   // compare 8 bytes
 | ||||
| -   d1 = 2.78;
 | ||||
| -   d2 = d1;
 | ||||
| -   cdbr(d1, d2);
 | ||||
| -   d2 = d1 + 10.;
 | ||||
| -   cdbr(d1, d2);
 | ||||
| -   d2 = d1 - 100.;
 | ||||
| -   cdbr(d1, d2);
 | ||||
| +   float inf = 1.f / 0.;
 | ||||
| +   float neg_inf = -1.f / 0.;
 | ||||
|   | ||||
| +   do_compare(3.14f, 3.14f);
 | ||||
| +   do_compare(-2.78f, 2.78f);
 | ||||
| +   do_compare(inf, inf);
 | ||||
| +   do_compare(inf, neg_inf);
 | ||||
| +   do_compare(neg_inf, neg_inf);
 | ||||
| +   do_compare(inf, 1.f);
 | ||||
| +   do_compare(neg_inf, -1.f);
 | ||||
| +   do_compare(1.f / inf, -1.f / inf);
 | ||||
|     return 0; | ||||
|  } | ||||
| diff --git a/none/tests/s390x/bfp-4.stdout.exp b/none/tests/s390x/bfp-4.stdout.exp
 | ||||
| index eff136654..027b1587a 100644
 | ||||
| --- a/none/tests/s390x/bfp-4.stdout.exp
 | ||||
| +++ b/none/tests/s390x/bfp-4.stdout.exp
 | ||||
| @@ -1,6 +1,48 @@
 | ||||
| -cfebr:  3.140000 == 3.140000
 | ||||
| -cfebr:  3.140000 < 13.140000
 | ||||
| -cfebr:  3.140000 > -96.860001
 | ||||
| -cdebr:  2.780000 == 2.780000
 | ||||
| -cdebr:  2.780000 < 12.780000
 | ||||
| -cdebr:  2.780000 > -97.220001
 | ||||
| +cebr:  3.14 == 3.14
 | ||||
| +kebr:  3.14 == 3.14
 | ||||
| +cdbr:  3.14 == 3.14
 | ||||
| +kdbr:  3.14 == 3.14
 | ||||
| +cxbr:  3.14 == 3.14
 | ||||
| +kxbr:  3.14 == 3.14
 | ||||
| +cebr:  -2.78 < 2.78
 | ||||
| +kebr:  -2.78 < 2.78
 | ||||
| +cdbr:  -2.78 < 2.78
 | ||||
| +kdbr:  -2.78 < 2.78
 | ||||
| +cxbr:  -2.78 < 2.78
 | ||||
| +kxbr:  -2.78 < 2.78
 | ||||
| +cebr:  inf == inf
 | ||||
| +kebr:  inf == inf
 | ||||
| +cdbr:  inf == inf
 | ||||
| +kdbr:  inf == inf
 | ||||
| +cxbr:  inf == inf
 | ||||
| +kxbr:  inf == inf
 | ||||
| +cebr:  inf > -inf
 | ||||
| +kebr:  inf > -inf
 | ||||
| +cdbr:  inf > -inf
 | ||||
| +kdbr:  inf > -inf
 | ||||
| +cxbr:  inf > -inf
 | ||||
| +kxbr:  inf > -inf
 | ||||
| +cebr:  -inf == -inf
 | ||||
| +kebr:  -inf == -inf
 | ||||
| +cdbr:  -inf == -inf
 | ||||
| +kdbr:  -inf == -inf
 | ||||
| +cxbr:  -inf == -inf
 | ||||
| +kxbr:  -inf == -inf
 | ||||
| +cebr:  inf > 1
 | ||||
| +kebr:  inf > 1
 | ||||
| +cdbr:  inf > 1
 | ||||
| +kdbr:  inf > 1
 | ||||
| +cxbr:  inf > 1
 | ||||
| +kxbr:  inf > 1
 | ||||
| +cebr:  -inf < -1
 | ||||
| +kebr:  -inf < -1
 | ||||
| +cdbr:  -inf < -1
 | ||||
| +kdbr:  -inf < -1
 | ||||
| +cxbr:  -inf < -1
 | ||||
| +kxbr:  -inf < -1
 | ||||
| +cebr:  0 == -0
 | ||||
| +kebr:  0 == -0
 | ||||
| +cdbr:  0 == -0
 | ||||
| +kdbr:  0 == -0
 | ||||
| +cxbr:  0 == -0
 | ||||
| +kxbr:  0 == -0
 | ||||
| @ -1,194 +0,0 @@ | ||||
| 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 | ||||
| 
 | ||||
| @ -1,83 +0,0 @@ | ||||
| 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"); | ||||
| @ -1,137 +0,0 @@ | ||||
| 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"); | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -1,126 +0,0 @@ | ||||
| commit 3a2711c659ac839934f13e0529e14d6c15325383 | ||||
| Author: Andreas Arnez <arnez@linux.ibm.com> | ||||
| Date:   Thu Feb 27 15:52:53 2020 +0100 | ||||
| 
 | ||||
|     s390x: Add CPU model for z15 | ||||
|      | ||||
|     Make the z15 CPU models known to Valgrind.  Add test case output for z15 | ||||
|     to the "ecag" test.  Also ensure that the facility bits for CPU facilities | ||||
|     unsupported by Valgrind are unset, particularly for the new | ||||
|     deflate-conversion facility. | ||||
| 
 | ||||
| diff --git a/VEX/priv/guest_s390_helpers.c b/VEX/priv/guest_s390_helpers.c
 | ||||
| index 525e7000c..a470d9f8d 100644
 | ||||
| --- a/VEX/priv/guest_s390_helpers.c
 | ||||
| +++ b/VEX/priv/guest_s390_helpers.c
 | ||||
| @@ -377,6 +377,9 @@ s390x_dirtyhelper_STFLE(VexGuestS390XState *guest_state, ULong *addr)
 | ||||
|     s390_set_facility_bit(addr, S390_FAC_CTREXE, 0); | ||||
|     s390_set_facility_bit(addr, S390_FAC_TREXE,  0); | ||||
|     s390_set_facility_bit(addr, S390_FAC_MSA4,   0); | ||||
| +   s390_set_facility_bit(addr, S390_FAC_VXE,    0);
 | ||||
| +   s390_set_facility_bit(addr, S390_FAC_VXE2,   0);
 | ||||
| +   s390_set_facility_bit(addr, S390_FAC_DFLT,   0);
 | ||||
|   | ||||
|     return cc; | ||||
|  } | ||||
| diff --git a/VEX/pub/libvex.h b/VEX/pub/libvex.h
 | ||||
| index 359d10809..6da26dcb5 100644
 | ||||
| --- a/VEX/pub/libvex.h
 | ||||
| +++ b/VEX/pub/libvex.h
 | ||||
| @@ -147,7 +147,8 @@ typedef
 | ||||
|  #define VEX_S390X_MODEL_Z13S     13 | ||||
|  #define VEX_S390X_MODEL_Z14      14 | ||||
|  #define VEX_S390X_MODEL_Z14_ZR1  15 | ||||
| -#define VEX_S390X_MODEL_UNKNOWN  16     /* always last in list */
 | ||||
| +#define VEX_S390X_MODEL_Z15      16
 | ||||
| +#define VEX_S390X_MODEL_UNKNOWN  17     /* always last in list */
 | ||||
|  #define VEX_S390X_MODEL_MASK     0x3F | ||||
|   | ||||
|  #define VEX_HWCAPS_S390X_LDISP (1<<6)   /* Long-displacement facility */ | ||||
| diff --git a/VEX/pub/libvex_s390x_common.h b/VEX/pub/libvex_s390x_common.h
 | ||||
| index d945a4472..289421677 100644
 | ||||
| --- a/VEX/pub/libvex_s390x_common.h
 | ||||
| +++ b/VEX/pub/libvex_s390x_common.h
 | ||||
| @@ -103,6 +103,9 @@
 | ||||
|  #define S390_FAC_TREXE   73  // transactional execution | ||||
|  #define S390_FAC_MSA4    77  // message-security-assist 4 | ||||
|  #define S390_FAC_VX      129 // vector facility | ||||
| +#define S390_FAC_VXE     135 // vector enhancements facility 1
 | ||||
| +#define S390_FAC_VXE2    148 // vector enhancements facility 2
 | ||||
| +#define S390_FAC_DFLT    151 // deflate-conversion facility
 | ||||
|   | ||||
|   | ||||
|  /*--------------------------------------------------------------*/ | ||||
| diff --git a/coregrind/m_machine.c b/coregrind/m_machine.c
 | ||||
| index 672a02124..0fd1d21c7 100644
 | ||||
| --- a/coregrind/m_machine.c
 | ||||
| +++ b/coregrind/m_machine.c
 | ||||
| @@ -581,6 +581,8 @@ static UInt VG_(get_machine_model)(void)
 | ||||
|        { "2965", VEX_S390X_MODEL_Z13S }, | ||||
|        { "3906", VEX_S390X_MODEL_Z14 }, | ||||
|        { "3907", VEX_S390X_MODEL_Z14_ZR1 }, | ||||
| +      { "8561", VEX_S390X_MODEL_Z15 },
 | ||||
| +      { "8562", VEX_S390X_MODEL_Z15 },
 | ||||
|     }; | ||||
|   | ||||
|     Int    model, n, fh; | ||||
| diff --git a/none/tests/s390x/Makefile.am b/none/tests/s390x/Makefile.am
 | ||||
| index c5b07f7a2..a0fb92ef5 100644
 | ||||
| --- a/none/tests/s390x/Makefile.am
 | ||||
| +++ b/none/tests/s390x/Makefile.am
 | ||||
| @@ -39,7 +39,7 @@ EXTRA_DIST = \
 | ||||
|  	$(addsuffix .stdout.exp,$(INSN_TESTS)) \ | ||||
|  	$(addsuffix .vgtest,$(INSN_TESTS)) \ | ||||
|  	ecag.stdout.exp-z10ec ecag.stdout.exp-z196 ecag.stdout.exp-zec12 \ | ||||
| -	ecag.stdout.exp-z13 ecag.stdout.exp-z14 \
 | ||||
| +	ecag.stdout.exp-z13 ecag.stdout.exp-z14 ecag.stdout.exp-z15 \
 | ||||
|  	op00.stderr.exp1 op00.stderr.exp2 op00.vgtest \ | ||||
|  	fixbr.vgtest fixbr.stderr.exp fixbr.stdout.exp \ | ||||
|  	fpext.vgtest fpext.stderr.exp fpext.stdout.exp \ | ||||
| diff --git a/none/tests/s390x/ecag.stdout.exp-z15 b/none/tests/s390x/ecag.stdout.exp-z15
 | ||||
| new file mode 100644 | ||||
| index 000000000..b98d81b78
 | ||||
| --- /dev/null
 | ||||
| +++ b/none/tests/s390x/ecag.stdout.exp-z15
 | ||||
| @@ -0,0 +1,28 @@
 | ||||
| +L1 topology: separate data and instruction; private
 | ||||
| +L1 cache line size data: 256
 | ||||
| +L1 cache line size insn: 256
 | ||||
| +L1 total cachesize data: 131072
 | ||||
| +L1 total cachesize insn: 131072
 | ||||
| +L1 set. assoc.     data: 8
 | ||||
| +L1 set. assoc.     insn: 8
 | ||||
| +L2 topology: separate data and instruction; private
 | ||||
| +L2 cache line size data: 256
 | ||||
| +L2 cache line size insn: 256
 | ||||
| +L2 total cachesize data: 4194304
 | ||||
| +L2 total cachesize insn: 4194304
 | ||||
| +L2 set. assoc.     data: 8
 | ||||
| +L2 set. assoc.     insn: 8
 | ||||
| +L3 topology: unified data and instruction; shared
 | ||||
| +L3 cache line size data: 256
 | ||||
| +L3 cache line size insn: 256
 | ||||
| +L3 total cachesize data: 268435456
 | ||||
| +L3 total cachesize insn: 268435456
 | ||||
| +L3 set. assoc.     data: 32
 | ||||
| +L3 set. assoc.     insn: 32
 | ||||
| +L4 topology: unified data and instruction; shared
 | ||||
| +L4 cache line size data: 256
 | ||||
| +L4 cache line size insn: 256
 | ||||
| +L4 total cachesize data: 1006632960
 | ||||
| +L4 total cachesize insn: 1006632960
 | ||||
| +L4 set. assoc.     data: 60
 | ||||
| +L4 set. assoc.     insn: 60
 | ||||
| diff --git a/tests/s390x_features.c b/tests/s390x_features.c
 | ||||
| index baa349311..25b98f3a3 100644
 | ||||
| --- a/tests/s390x_features.c
 | ||||
| +++ b/tests/s390x_features.c
 | ||||
| @@ -116,6 +116,8 @@ model_info models[] = {
 | ||||
|     { "2965", "z13s"   }, | ||||
|     { "3906", "z14"    }, | ||||
|     { "3907", "z14 ZR1"}, | ||||
| +   { "8561", "z15"    },
 | ||||
| +   { "8562", "z15"    },
 | ||||
|  }; | ||||
|   | ||||
|   | ||||
							
								
								
									
										149
									
								
								valgrind.spec
									
									
									
									
									
								
							
							
						
						
									
										149
									
								
								valgrind.spec
									
									
									
									
									
								
							| @ -2,8 +2,8 @@ | ||||
| 
 | ||||
| Summary: Tool for finding memory management bugs in programs | ||||
| Name: %{?scl_prefix}valgrind | ||||
| Version: 3.15.0 | ||||
| Release: 20%{?dist} | ||||
| Version: 3.16.0 | ||||
| Release: 0.2.GIT%{?dist} | ||||
| Epoch: 1 | ||||
| License: GPLv2+ | ||||
| URL: http://www.valgrind.org/ | ||||
| @ -71,7 +71,7 @@ URL: http://www.valgrind.org/ | ||||
| # So those will already have their full symbol table. | ||||
| %undefine _include_minidebuginfo | ||||
| 
 | ||||
| Source0: ftp://sourceware.org/pub/valgrind/valgrind-%{version}.tar.bz2 | ||||
| Source0: ftp://sourceware.org/pub/valgrind/valgrind-%{version}.GIT.tar.bz2 | ||||
| 
 | ||||
| # Needs investigation and pushing upstream | ||||
| Patch1: valgrind-3.9.0-cachegrind-improvements.patch | ||||
| @ -85,94 +85,13 @@ Patch3: valgrind-3.9.0-ldso-supp.patch | ||||
| # We want all executables and libraries in libexec instead of lib | ||||
| # so they are only available for valgrind usage itself and so the | ||||
| # same directory is used independent of arch. | ||||
| Patch4: valgrind-3.15.0-pkglibexecdir.patch | ||||
| 
 | ||||
| # KDE#398649 s390x z13 support doesn't build with older gcc/binutils | ||||
| # Disable z13 support (on rhel6) | ||||
| Patch5: valgrind-3.15.0-disable-s390x-z13.patch | ||||
| Patch4: valgrind-3.16.0-pkglibexecdir.patch | ||||
| 
 | ||||
| # Add some stack-protector | ||||
| Patch6: valgrind-3.15.0-some-stack-protector.patch | ||||
| 
 | ||||
| # KDE#406561  mcinfcallWSRU gdbserver_test fails on ppc64 | ||||
| Patch7: valgrind-3.15.0-ppc64-filter_gdb.patch | ||||
| 
 | ||||
| # KDE#407218 Add support for the copy_file_range syscall | ||||
| Patch8: valgrind-3.15.0-copy_file_range.patch | ||||
| 
 | ||||
| # KDE#407307 Intercept stpcpy also in ld.so for arm64 | ||||
| Patch9: valgrind-3.15.0-arm64-ld-stpcpy.patch | ||||
| 
 | ||||
| # commit 59784c aarch64 (arm64) isn't a supported architecture for exp-sgcheck. | ||||
| Patch10: valgrind-3.15.0-exp-sgcheck-no-aarch64.patch | ||||
| 
 | ||||
| # commit 917e42 Make memcheck/tests/arm64-linux/scalar work under root | ||||
| Patch11: valgrind-3.15.0-scalar-arm64.patch | ||||
| 
 | ||||
| # commit abc09f Make memcheck/tests/x86-linux/scalar test work under root. | ||||
| Patch12: valgrind-3.15.0-scalar-x86.patch | ||||
| 
 | ||||
| # KDE#407764 s390x: drd fails on z13 due to function wrapping issue | ||||
| Patch13: valgrind-3.15.0-s390x-wrap-drd.patch | ||||
| Patch5: valgrind-3.16.0-some-stack-protector.patch | ||||
| 
 | ||||
| # Add some -Wl,z,now. | ||||
| Patch14: valgrind-3.15.0-some-Wl-z-now.patch | ||||
| 
 | ||||
| # KDE#408009 Expose rdrand and f16c even on avx if host cpu supports them | ||||
| Patch15: valgrind-3.15.0-avx-rdrand-f16c.patch | ||||
| 
 | ||||
| # KDE#408091 Missing pkey syscalls | ||||
| Patch16: valgrind-3.15.0-pkey.patch | ||||
| 
 | ||||
| # KDE#408414 Add support for preadv2 and pwritev2 syscalls | ||||
| Patch17: valgrind-3.15.0-preadv2-pwritev2.patch | ||||
| 
 | ||||
| # Upstream commit 9616e9bc9a1950f70ab1abd1c6ca9abc3f26eb7f | ||||
| Patch18: valgrind-3.15.0-arm-membarrier.patch | ||||
| 
 | ||||
| # KDE#404406 s390x: z14 miscellaneous instructions not implemented | ||||
| Patch19: valgrind-3.15.0-z14-misc.patch | ||||
| 
 | ||||
| # KDE#405201 Incorrect size of struct vki_siginfo on 64-bit Linux architectures | ||||
| Patch20: valgrind-3.15.0-ptrace-siginfo.patch | ||||
| 
 | ||||
| # RHBZ#1794482 guest_s390_defs.h:291: multiple definition of `s390x_vec_op_t' | ||||
| Patch21: valgrind-3.15.0-gcc-10-typedef-enum.patch | ||||
| 
 | ||||
| # GCC10 build error bad asm on i686 | ||||
| # Upstream commit 2dab3249867615055a680cad7fccb22411587579 | ||||
| Patch22: valgrind-3.15.0-gcc-10-i686-asm-test.patch | ||||
| 
 | ||||
| # KDE#416667 gcc10 ppc64le impossible constraint in 'asm' in test_isa | ||||
| Patch23: valgrind-3.15.0-gcc10-ppc64-asm-constraints.patch | ||||
| 
 | ||||
| # KDE#416301 s390x: "compare and signal" not supported | ||||
| Patch24: valgrind-3.15.0-s390x-compare-and-signal.patch | ||||
| 
 | ||||
| # KDE#417452 s390_insn_store_emit: dst->tag for HRcVec128 | ||||
| Patch25: valgrind-3.15.0-s390x-HRcVec128.patch | ||||
| 
 | ||||
| # KDE#417578 - Add suppressions for glibc DTV leaks | ||||
| Patch26: valgrind-3.15.0-glibc-dtv-supp.patch | ||||
| 
 | ||||
| # KDE#416760 Assertion 'VG_IS_16_ALIGNED(sizeof(struct rt_sigframe))' failed | ||||
| # KDE#417427 commit to fix vki_siginfo_t definition created errors on PPC64 | ||||
| Patch27: valgrind-3.15.0-ppc64-sigframe.patch | ||||
| 
 | ||||
| # KDE#416753 new 32bit time syscalls for 2038+ | ||||
| Patch28: valgrind-3.15.0-time64.patch | ||||
| 
 | ||||
| # Upstream commit 2d040ce2c7fd328b4e8b0c2363ebe0c2ea2cbc9f | ||||
| Patch29: valgrind-3.15.0-arm-preadv2-pwritev2.patch | ||||
| 
 | ||||
| # Upstream commit ce094ba912b1fb1539242e4d6b2a76c513a3d132 | ||||
| Patch30: valgrind-3.15.0-avx_estimate_insn-test.patch | ||||
| 
 | ||||
| # Upstream commit fe6805efc1b6db0cfa5f1cd5fb1854775cbfa31a | ||||
| Patch31: valgrind-3.15.0-gcc-10-x86-amd64-asm-test.patch | ||||
| 
 | ||||
| # Upstream commit 3a2711c659ac839934f13e0529e14d6c15325383 | ||||
| Patch32: valgrind-3.15.0-z15.patch | ||||
| Patch6: valgrind-3.16.0-some-Wl-z-now.patch | ||||
| 
 | ||||
| BuildRequires: glibc-devel | ||||
| 
 | ||||
| @ -289,60 +208,13 @@ Valgrind User Manual for details. | ||||
| %endif | ||||
| 
 | ||||
| %prep | ||||
| %setup -q -n %{?scl:%{pkg_name}}%{!?scl:%{name}}-%{version} | ||||
| %setup -q -n %{?scl:%{pkg_name}}%{!?scl:%{name}}-%{version}.GIT | ||||
| 
 | ||||
| %patch1 -p1 | ||||
| %patch2 -p1 | ||||
| %patch3 -p1 | ||||
| %patch4 -p1 | ||||
| 
 | ||||
| # Disable s390x z13 support on old rhel, binutils is just too old. | ||||
| %if 0%{?rhel} == 6 | ||||
| %patch5 -p1 | ||||
| %endif | ||||
| 
 | ||||
| # Old rhel gcc doesn't have -fstack-protector-strong. | ||||
| %if 0%{?fedora} || 0%{?rhel} >= 7 | ||||
| %patch6 -p1 | ||||
| %endif | ||||
| 
 | ||||
| %patch7 -p1 | ||||
| %patch8 -p1 | ||||
| %patch9 -p1 | ||||
| %patch10 -p1 | ||||
| %patch11 -p1 | ||||
| %patch12 -p1 | ||||
| %patch13 -p1 | ||||
| 
 | ||||
| # This depends on patch6, old rhel gcc doesn't have -fstack-protector-strong. | ||||
| %if 0%{?fedora} || 0%{?rhel} >= 7 | ||||
| %patch14 -p1 | ||||
| %endif | ||||
| 
 | ||||
| %patch15 -p1 | ||||
| %patch16 -p1 | ||||
| %patch17 -p1 | ||||
| %patch18 -p1 | ||||
| 
 | ||||
| # Don't add s390x z14 support on old rhel, binutils is just too old. | ||||
| %if 0%{?fedora} || 0%{?rhel} >= 7 | ||||
| %patch19 -p1 | ||||
| %endif | ||||
| 
 | ||||
| %patch20 -p1 | ||||
| %patch21 -p1 | ||||
| %patch22 -p1 | ||||
| %patch23 -p1 | ||||
| %patch24 -p1 | ||||
| %patch25 -p1 | ||||
| %patch26 -p1 | ||||
| %patch27 -p1 | ||||
| %patch28 -p1 | ||||
| %patch29 -p1 | ||||
| %patch30 -p1 | ||||
| %patch31 -p1 | ||||
| %patch32 -p1 | ||||
| 
 | ||||
| %build | ||||
| 
 | ||||
| # Some patches (might) touch Makefile.am or configure.ac files. | ||||
| @ -562,6 +434,13 @@ fi | ||||
| %endif | ||||
| 
 | ||||
| %changelog | ||||
| * Fri May  1 2020 Mark Wielaard <mjw@fedoraproject.org> - 3.16.0-0.2.GIT | ||||
| - Update to upstream 3.16.0 branch point (commit 55cdb7c4e) | ||||
| 
 | ||||
| * Fri Apr 17 2020 Mark Wielaard <mjw@fedoraproject.org> - 3.16.0-0.1.GIT | ||||
| - Update to upstream 3.16.0-GIT (commit 52d02fe23) | ||||
|   - Drop all streamed patches. | ||||
| 
 | ||||
| * Wed Mar  4 2020 Mark Wielaard <mjw@fedoraproject.org> - 3.15.0-20 | ||||
| - Add valgrind-3.15.0-z15.patch | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user