valgrind-3.14.0-0.1-GIT

This commit is contained in:
Mark Wielaard 2018-09-14 23:37:11 +02:00
parent 7f4edd4554
commit c14588c528
27 changed files with 11 additions and 190084 deletions

1
.gitignore vendored
View File

@ -28,3 +28,4 @@
/valgrind-3.12.0.tar.bz2
/valgrind-3.13.0.RC1.tar.bz2
/valgrind-3.13.0.tar.bz2
/valgrind-3.14.0.GIT.tar.bz2

View File

@ -1 +1 @@
SHA512 (valgrind-3.13.0.tar.bz2) = 34e1013cd3815d30a459b86220e871bb0a6209cc9e87af968f347083693779f022e986f211bdf1a5184ad7370cde12ff2cfca8099967ff94732970bd04a97009
SHA512 (valgrind-3.14.0.GIT.tar.bz2) = b88c587c35e6c89e6c5d275ae7fadae60dcbf5f7b92264c813c56091effbd2ca97d68acb6f0971c69d8f6c5f8aa6d4f43a64075948950ab37cc2e85530d4cb3c

File diff suppressed because it is too large Load Diff

View File

@ -1,31 +0,0 @@
diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c
index 0f2ad8c51..407af7f76 100644
--- a/coregrind/m_syswrap/syswrap-amd64-linux.c
+++ b/coregrind/m_syswrap/syswrap-amd64-linux.c
@@ -249,6 +249,7 @@ PRE(sys_rt_sigreturn)
PRE(sys_arch_prctl)
{
ThreadState* tst;
+ Bool known_option = True;
PRINT( "arch_prctl ( %ld, %lx )", SARG1, ARG2 );
vg_assert(VG_(is_valid_tid)(tid));
@@ -283,13 +284,16 @@ PRE(sys_arch_prctl)
POST_MEM_WRITE(ARG2, sizeof(unsigned long));
}
else {
- VG_(core_panic)("Unsupported arch_prctl option");
+ known_option = False;
}
/* Note; the Status writeback to guest state that happens after
this wrapper returns does not change guest_FS_CONST or guest_GS_CONST;
hence that direct assignment to the guest state is safe here. */
- SET_STATUS_Success( 0 );
+ if (known_option)
+ SET_STATUS_Success( 0 );
+ else
+ SET_STATUS_Failure( VKI_EINVAL );
}
// Parts of this are amd64-specific, but the *PEEK* cases are generic.

View File

@ -1,86 +0,0 @@
diff --git a/coregrind/m_redir.c b/coregrind/m_redir.c
index b8cc022..d54cae7 100644
--- a/coregrind/m_redir.c
+++ b/coregrind/m_redir.c
@@ -1485,6 +1485,17 @@ void VG_(redir_initialise) ( void )
(Addr)&VG_(arm_linux_REDIR_FOR_strcmp),
complain_about_stripped_glibc_ldso
);
+ /* index */
+ add_hardwired_spec(
+ "ld-linux.so.3", "index",
+ (Addr)&VG_(arm_linux_REDIR_FOR_index),
+ complain_about_stripped_glibc_ldso
+ );
+ add_hardwired_spec(
+ "ld-linux-armhf.so.3", "index",
+ (Addr)&VG_(arm_linux_REDIR_FOR_index),
+ complain_about_stripped_glibc_ldso
+ );
}
# elif defined(VGP_arm64_linux)
diff --git a/coregrind/m_trampoline.S b/coregrind/m_trampoline.S
index a532071..0488b54 100644
--- a/coregrind/m_trampoline.S
+++ b/coregrind/m_trampoline.S
@@ -625,26 +625,26 @@ VG_(arm_linux_REDIR_FOR_strlen):
bx lr
UD2_4
-//.global VG_(arm_linux_REDIR_FOR_index)
-//VG_(arm_linux_REDIR_FOR_index):
-// ldrb r3, [r0, #0] @ zero_extendqisi2
-// and r1, r1, #255
-// cmp r3, r1
-// @ lr needed for prologue
-// bne .L9
-// bx lr
-//.L12:
-// ldrb r3, [r0, #1]! @ zero_extendqisi2
-// cmp r3, r1
-// beq .L11
-//.L9:
-// cmp r3, #0
-// bne .L12
-// mov r0, #0
-// bx lr
-//.L11:
-// bx lr
-// UD2_4
+.global VG_(arm_linux_REDIR_FOR_index)
+VG_(arm_linux_REDIR_FOR_index):
+ ldrb r3, [r0, #0] @ zero_extendqisi2
+ and r1, r1, #255
+ cmp r3, r1
+ @ lr needed for prologue
+ bne .L9
+ bx lr
+.L12:
+ ldrb r3, [r0, #1]! @ zero_extendqisi2
+ cmp r3, r1
+ beq .L11
+.L9:
+ cmp r3, #0
+ bne .L12
+ mov r0, #0
+ bx lr
+.L11:
+ bx lr
+ UD2_4
.global VG_(arm_linux_REDIR_FOR_memcpy)
VG_(arm_linux_REDIR_FOR_memcpy):
diff --git a/coregrind/pub_core_trampoline.h b/coregrind/pub_core_trampoline.h
index 3a9bafe..e29427d 100644
--- a/coregrind/pub_core_trampoline.h
+++ b/coregrind/pub_core_trampoline.h
@@ -100,7 +100,7 @@ extern Addr VG_(ppctoc_magic_redirect_return_stub);
extern Addr VG_(arm_linux_SUBST_FOR_sigreturn);
extern Addr VG_(arm_linux_SUBST_FOR_rt_sigreturn);
extern UInt VG_(arm_linux_REDIR_FOR_strlen)( void* );
-//extern void* VG_(arm_linux_REDIR_FOR_index) ( void*, Int );
+extern void* VG_(arm_linux_REDIR_FOR_index) ( void*, Int );
extern void* VG_(arm_linux_REDIR_FOR_memcpy)( void*, void*, Int );
extern void* VG_(arm_linux_REDIR_FOR_strcmp)( void*, void* );
#endif

View File

@ -1,79 +0,0 @@
commit 6bb6c8a65a341a67bd059ec6e1c805813eb17264
Author: Mark Wielaard <mark@klomp.org>
Date: Tue Jun 19 18:00:45 2018 +0200
Mask AT_HWCAPS on arm64 to those instructions VEX implements.
This patch makes sure that the process running under valgrind only sees
the AES, PMULL, SHA1, SHA2, CRC32, FP, and ASIMD features in auxv AT_HWCAPS.
https://bugs.kde.org/show_bug.cgi?id=381556
diff --git a/coregrind/m_initimg/initimg-linux.c b/coregrind/m_initimg/initimg-linux.c
index 30e1f85..61cc458 100644
--- a/coregrind/m_initimg/initimg-linux.c
+++ b/coregrind/m_initimg/initimg-linux.c
@@ -703,6 +703,19 @@ Addr setup_client_stack( void* init_sp,
(and anything above) are not supported by Valgrind. */
auxv->u.a_val &= VKI_HWCAP_S390_TE - 1;
}
+# elif defined(VGP_arm64_linux)
+ {
+ /* Limit the AT_HWCAP to just those features we explicitly
+ support in VEX. */
+#define ARM64_SUPPORTED_HWCAP (VKI_HWCAP_AES \
+ | VKI_HWCAP_PMULL \
+ | VKI_HWCAP_SHA1 \
+ | VKI_HWCAP_SHA2 \
+ | VKI_HWCAP_CRC32 \
+ | VKI_HWCAP_FP \
+ | VKI_HWCAP_ASIMD)
+ auxv->u.a_val &= ARM64_SUPPORTED_HWCAP;
+ }
# endif
break;
# if defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux)
diff --git a/include/vki/vki-arm64-linux.h b/include/vki/vki-arm64-linux.h
index af6b435..54b0428 100644
--- a/include/vki/vki-arm64-linux.h
+++ b/include/vki/vki-arm64-linux.h
@@ -692,6 +692,39 @@ struct vki_shminfo64 {
#define VKI_TIOCSSERIAL 0x541F
//----------------------------------------------------------------------
+// From linux-4.17/include/uapi/asm-generic/ioctls.h
+//----------------------------------------------------------------------
+
+#define VKI_HWCAP_FP (1 << 0)
+#define VKI_HWCAP_ASIMD (1 << 1)
+#define VKI_HWCAP_EVTSTRM (1 << 2)
+#define VKI_HWCAP_AES (1 << 3)
+#define VKI_HWCAP_PMULL (1 << 4)
+#define VKI_HWCAP_SHA1 (1 << 5)
+#define VKI_HWCAP_SHA2 (1 << 6)
+#define VKI_HWCAP_CRC32 (1 << 7)
+#define VKI_HWCAP_ATOMICS (1 << 8)
+#define VKI_HWCAP_FPHP (1 << 9)
+#define VKI_HWCAP_ASIMDHP (1 << 10)
+#define VKI_HWCAP_CPUID (1 << 11)
+#define VKI_HWCAP_ASIMDRDM (1 << 12)
+#define VKI_HWCAP_JSCVT (1 << 13)
+#define VKI_HWCAP_FCMA (1 << 14)
+#define VKI_HWCAP_LRCPC (1 << 15)
+#define VKI_HWCAP_DCPOP (1 << 16)
+#define VKI_HWCAP_SHA3 (1 << 17)
+#define VKI_HWCAP_SM3 (1 << 18)
+#define VKI_HWCAP_SM4 (1 << 19)
+#define VKI_HWCAP_ASIMDDP (1 << 20)
+#define VKI_HWCAP_SHA512 (1 << 21)
+#define VKI_HWCAP_SVE (1 << 22)
+#define VKI_HWCAP_ASIMDFHM (1 << 23)
+#define VKI_HWCAP_DIT (1 << 24)
+#define VKI_HWCAP_USCAT (1 << 25)
+#define VKI_HWCAP_ILRCPC (1 << 26)
+#define VKI_HWCAP_FLAGM (1 << 27)
+
+//----------------------------------------------------------------------
// And that's it!
//----------------------------------------------------------------------

View File

@ -1,235 +0,0 @@
commit 122225d7ed260f6bd9de4472e5260ec768ce972d
Author: Mark Wielaard <mark@klomp.org>
Date: Tue Jun 19 18:26:43 2018 +0200
Implement ptrace syscall wrapper for arm64-linux.
With this valgrind is able to run gdb on arm64.
Also fixes the memcheck/tests/linux/getregset testcase.
https://bugs.kde.org/show_bug.cgi?id=368913
diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c
index 32b87bf..24a6493 100644
--- a/coregrind/m_syswrap/syswrap-arm64-linux.c
+++ b/coregrind/m_syswrap/syswrap-arm64-linux.c
@@ -265,7 +265,7 @@ DECL_TEMPLATE(arm64_linux, sys_rt_sigreturn);
//ZZ DECL_TEMPLATE(arm_linux, sys_sigsuspend);
//ZZ DECL_TEMPLATE(arm_linux, sys_set_tls);
//ZZ DECL_TEMPLATE(arm_linux, sys_cacheflush);
-//ZZ DECL_TEMPLATE(arm_linux, sys_ptrace);
+DECL_TEMPLATE(arm64_linux, sys_ptrace);
//ZZ PRE(sys_mmap2)
//ZZ {
@@ -459,137 +459,70 @@ PRE(sys_rt_sigreturn)
//ZZ "PRE(sys_cacheflush)" );
//ZZ SET_STATUS_Success(0);
//ZZ }
-//ZZ
-//ZZ // ARG3 is only used for pointers into the traced process's address
-//ZZ // space and for offsets into the traced process's struct
-//ZZ // user_regs_struct. It is never a pointer into this process's memory
-//ZZ // space, and we should therefore not check anything it points to.
-//ZZ PRE(sys_ptrace)
-//ZZ {
-//ZZ PRINT("sys_ptrace ( %ld, %ld, %#lx, %#lx )", ARG1,ARG2,ARG3,ARG4);
-//ZZ PRE_REG_READ4(int, "ptrace",
-//ZZ long, request, long, pid, long, addr, long, data);
-//ZZ switch (ARG1) {
-//ZZ case VKI_PTRACE_PEEKTEXT:
-//ZZ case VKI_PTRACE_PEEKDATA:
-//ZZ case VKI_PTRACE_PEEKUSR:
-//ZZ PRE_MEM_WRITE( "ptrace(peek)", ARG4,
-//ZZ sizeof (long));
-//ZZ break;
-//ZZ case VKI_PTRACE_GETREGS:
-//ZZ PRE_MEM_WRITE( "ptrace(getregs)", ARG4,
-//ZZ sizeof (struct vki_user_regs_struct));
-//ZZ break;
-//ZZ case VKI_PTRACE_GETFPREGS:
-//ZZ PRE_MEM_WRITE( "ptrace(getfpregs)", ARG4,
-//ZZ sizeof (struct vki_user_fp));
-//ZZ break;
-//ZZ case VKI_PTRACE_GETWMMXREGS:
-//ZZ PRE_MEM_WRITE( "ptrace(getwmmxregs)", ARG4,
-//ZZ VKI_IWMMXT_SIZE);
-//ZZ break;
-//ZZ case VKI_PTRACE_GETCRUNCHREGS:
-//ZZ PRE_MEM_WRITE( "ptrace(getcrunchregs)", ARG4,
-//ZZ VKI_CRUNCH_SIZE);
-//ZZ break;
-//ZZ case VKI_PTRACE_GETVFPREGS:
-//ZZ PRE_MEM_WRITE( "ptrace(getvfpregs)", ARG4,
-//ZZ sizeof (struct vki_user_vfp) );
-//ZZ break;
-//ZZ case VKI_PTRACE_GETHBPREGS:
-//ZZ PRE_MEM_WRITE( "ptrace(gethbpregs)", ARG4,
-//ZZ sizeof (unsigned long) );
-//ZZ break;
-//ZZ case VKI_PTRACE_SETREGS:
-//ZZ PRE_MEM_READ( "ptrace(setregs)", ARG4,
-//ZZ sizeof (struct vki_user_regs_struct));
-//ZZ break;
-//ZZ case VKI_PTRACE_SETFPREGS:
-//ZZ PRE_MEM_READ( "ptrace(setfpregs)", ARG4,
-//ZZ sizeof (struct vki_user_fp));
-//ZZ break;
-//ZZ case VKI_PTRACE_SETWMMXREGS:
-//ZZ PRE_MEM_READ( "ptrace(setwmmxregs)", ARG4,
-//ZZ VKI_IWMMXT_SIZE);
-//ZZ break;
-//ZZ case VKI_PTRACE_SETCRUNCHREGS:
-//ZZ PRE_MEM_READ( "ptrace(setcrunchregs)", ARG4,
-//ZZ VKI_CRUNCH_SIZE);
-//ZZ break;
-//ZZ case VKI_PTRACE_SETVFPREGS:
-//ZZ PRE_MEM_READ( "ptrace(setvfpregs)", ARG4,
-//ZZ sizeof (struct vki_user_vfp));
-//ZZ break;
-//ZZ case VKI_PTRACE_SETHBPREGS:
-//ZZ PRE_MEM_READ( "ptrace(sethbpregs)", ARG4, sizeof(unsigned long));
-//ZZ break;
-//ZZ case VKI_PTRACE_GET_THREAD_AREA:
-//ZZ PRE_MEM_WRITE( "ptrace(get_thread_area)", ARG4, sizeof(unsigned long));
-//ZZ break;
-//ZZ case VKI_PTRACE_GETEVENTMSG:
-//ZZ PRE_MEM_WRITE( "ptrace(geteventmsg)", ARG4, sizeof(unsigned long));
-//ZZ break;
-//ZZ case VKI_PTRACE_GETSIGINFO:
-//ZZ PRE_MEM_WRITE( "ptrace(getsiginfo)", ARG4, sizeof(vki_siginfo_t));
-//ZZ break;
-//ZZ case VKI_PTRACE_SETSIGINFO:
-//ZZ PRE_MEM_READ( "ptrace(setsiginfo)", ARG4, sizeof(vki_siginfo_t));
-//ZZ break;
-//ZZ case VKI_PTRACE_GETREGSET:
-//ZZ ML_(linux_PRE_getregset)(tid, ARG3, ARG4);
-//ZZ break;
-//ZZ case VKI_PTRACE_SETREGSET:
-//ZZ ML_(linux_PRE_setregset)(tid, ARG3, ARG4);
-//ZZ break;
-//ZZ default:
-//ZZ break;
-//ZZ }
-//ZZ }
-//ZZ
-//ZZ POST(sys_ptrace)
-//ZZ {
-//ZZ switch (ARG1) {
-//ZZ case VKI_PTRACE_PEEKTEXT:
-//ZZ case VKI_PTRACE_PEEKDATA:
-//ZZ case VKI_PTRACE_PEEKUSR:
-//ZZ POST_MEM_WRITE( ARG4, sizeof (long));
-//ZZ break;
-//ZZ case VKI_PTRACE_GETREGS:
-//ZZ POST_MEM_WRITE( ARG4, sizeof (struct vki_user_regs_struct));
-//ZZ break;
-//ZZ case VKI_PTRACE_GETFPREGS:
-//ZZ POST_MEM_WRITE( ARG4, sizeof (struct vki_user_fp));
-//ZZ break;
-//ZZ case VKI_PTRACE_GETWMMXREGS:
-//ZZ POST_MEM_WRITE( ARG4, VKI_IWMMXT_SIZE);
-//ZZ break;
-//ZZ case VKI_PTRACE_GETCRUNCHREGS:
-//ZZ POST_MEM_WRITE( ARG4, VKI_CRUNCH_SIZE);
-//ZZ break;
-//ZZ case VKI_PTRACE_GETVFPREGS:
-//ZZ POST_MEM_WRITE( ARG4, sizeof(struct vki_user_vfp));
-//ZZ break;
-//ZZ case VKI_PTRACE_GET_THREAD_AREA:
-//ZZ case VKI_PTRACE_GETHBPREGS:
-//ZZ case VKI_PTRACE_GETEVENTMSG:
-//ZZ POST_MEM_WRITE( ARG4, sizeof(unsigned long));
-//ZZ break;
-//ZZ case VKI_PTRACE_GETSIGINFO:
-//ZZ /* XXX: This is a simplification. Different parts of the
-//ZZ * siginfo_t are valid depending on the type of signal.
-//ZZ */
-//ZZ POST_MEM_WRITE( ARG4, sizeof(vki_siginfo_t));
-//ZZ break;
-//ZZ case VKI_PTRACE_GETREGSET:
-//ZZ ML_(linux_POST_getregset)(tid, ARG3, ARG4);
-//ZZ break;
-//ZZ default:
-//ZZ break;
-//ZZ }
-//ZZ }
-//ZZ
-//ZZ #undef PRE
-//ZZ #undef POST
+
+// ARG3 is only used for pointers into the traced process's address
+// space and for offsets into the traced process's struct
+// user_regs_struct. It is never a pointer into this process's memory
+// space, and we should therefore not check anything it points to.
+PRE(sys_ptrace)
+{
+ PRINT("sys_ptrace ( %ld, %ld, %#lx, %#lx )", ARG1,ARG2,ARG3,ARG4);
+ PRE_REG_READ4(int, "ptrace",
+ long, request, long, pid, long, addr, long, data);
+ switch (ARG1) {
+ case VKI_PTRACE_PEEKTEXT:
+ case VKI_PTRACE_PEEKDATA:
+ case VKI_PTRACE_PEEKUSR:
+ PRE_MEM_WRITE( "ptrace(peek)", ARG4,
+ sizeof (long));
+ break;
+ case VKI_PTRACE_GETEVENTMSG:
+ PRE_MEM_WRITE( "ptrace(geteventmsg)", ARG4, sizeof(unsigned long));
+ break;
+ case VKI_PTRACE_GETSIGINFO:
+ PRE_MEM_WRITE( "ptrace(getsiginfo)", ARG4, sizeof(vki_siginfo_t));
+ break;
+ case VKI_PTRACE_SETSIGINFO:
+ PRE_MEM_READ( "ptrace(setsiginfo)", ARG4, sizeof(vki_siginfo_t));
+ break;
+ case VKI_PTRACE_GETREGSET:
+ ML_(linux_PRE_getregset)(tid, ARG3, ARG4);
+ break;
+ case VKI_PTRACE_SETREGSET:
+ ML_(linux_PRE_setregset)(tid, ARG3, ARG4);
+ break;
+ default:
+ break;
+ }
+}
+
+POST(sys_ptrace)
+{
+ switch (ARG1) {
+ case VKI_PTRACE_PEEKTEXT:
+ case VKI_PTRACE_PEEKDATA:
+ case VKI_PTRACE_PEEKUSR:
+ POST_MEM_WRITE( ARG4, sizeof (long));
+ break;
+ case VKI_PTRACE_GETEVENTMSG:
+ POST_MEM_WRITE( ARG4, sizeof(unsigned long));
+ break;
+ case VKI_PTRACE_GETSIGINFO:
+ /* XXX: This is a simplification. Different parts of the
+ * siginfo_t are valid depending on the type of signal.
+ */
+ POST_MEM_WRITE( ARG4, sizeof(vki_siginfo_t));
+ break;
+ case VKI_PTRACE_GETREGSET:
+ ML_(linux_POST_getregset)(tid, ARG3, ARG4);
+ break;
+ default:
+ break;
+ }
+}
+
+#undef PRE
+#undef POST
/* ---------------------------------------------------------------------
The arm64/Linux syscall table
@@ -730,7 +663,7 @@ static SyscallTableEntry syscall_main_table[] = {
LINXY(__NR_clock_getres, sys_clock_getres), // 114
LINXY(__NR_clock_nanosleep, sys_clock_nanosleep), // 115
LINXY(__NR_syslog, sys_syslog), // 116
- // (__NR_ptrace, sys_ptrace), // 117
+ PLAXY(__NR_ptrace, sys_ptrace), // 117
LINXY(__NR_sched_setparam, sys_sched_setparam), // 118
LINX_(__NR_sched_setscheduler,sys_sched_setscheduler),// 119
LINX_(__NR_sched_getscheduler,sys_sched_getscheduler),// 120

View File

@ -1,17 +0,0 @@
diff --git a/coregrind/m_debuginfo/readelf.c b/coregrind/m_debuginfo/readelf.c
index 70c28e629..8bd3e049c 100644
--- a/coregrind/m_debuginfo/readelf.c
+++ b/coregrind/m_debuginfo/readelf.c
@@ -1137,7 +1137,11 @@ HChar* find_buildid(DiImage* img, Bool rel_ok, Bool search_shdrs)
ElfXX_Ehdr ehdr;
ML_(img_get)(&ehdr, img, 0, sizeof(ehdr));
- for (i = 0; i < ehdr.e_phnum; i++) {
+ /* Skip the phdrs when we have to search the shdrs. In separate
+ .debug files the phdrs might not be valid (they are a copy of
+ the main ELF file) and might trigger assertions when getting
+ image notes based on them. */
+ for (i = 0; !search_shdrs && i < ehdr.e_phnum; i++) {
ElfXX_Phdr phdr;
ML_(img_get)(&phdr, img,
ehdr.e_phoff + i * ehdr.e_phentsize, sizeof(phdr));

View File

@ -1,160 +0,0 @@
commit be82bb5f9dfecd854c53eda321d1914f28f19790
Author: Mark Wielaard <mark@klomp.org>
Date: Sat Dec 9 23:01:29 2017 +0100
Fix gnu debug alt file resolving.
https://bugs.kde.org/show_bug.cgi?id=387773
The path to the alt file is relative to the actual debug file.
Make sure that we got the real file, not a (build-id) symlink.
Also handle the case where a debug or alt file is an absolute path.
diff --git a/coregrind/m_debuginfo/readelf.c b/coregrind/m_debuginfo/readelf.c
index e612250..c19ff21 100644
--- a/coregrind/m_debuginfo/readelf.c
+++ b/coregrind/m_debuginfo/readelf.c
@@ -33,6 +33,7 @@
#include "pub_core_basics.h"
#include "pub_core_vki.h"
+#include "pub_core_vkiscnums.h"
#include "pub_core_debuginfo.h"
#include "pub_core_libcbase.h"
#include "pub_core_libcprint.h"
@@ -40,6 +41,7 @@
#include "pub_core_machine.h" /* VG_ELF_CLASS */
#include "pub_core_options.h"
#include "pub_core_oset.h"
+#include "pub_core_syscall.h"
#include "pub_core_tooliface.h" /* VG_(needs) */
#include "pub_core_xarray.h"
#include "priv_misc.h" /* dinfo_zalloc/free/strdup */
@@ -1323,6 +1325,12 @@ DiImage* find_debug_file( struct _DebugInfo* di,
+ (extrapath ? VG_(strlen)(extrapath) : 0)
+ (serverpath ? VG_(strlen)(serverpath) : 0));
+ if (debugname[0] == '/') {
+ VG_(sprintf)(debugpath, "%s", debugname);
+ dimg = open_debug_file(debugpath, buildid, crc, rel_ok, NULL);
+ if (dimg != NULL) goto dimg_ok;
+ }
+
VG_(sprintf)(debugpath, "%s/%s", objdir, debugname);
dimg = open_debug_file(debugpath, buildid, crc, rel_ok, NULL);
if (dimg != NULL) goto dimg_ok;
@@ -1527,6 +1535,56 @@ static Bool check_compression(ElfXX_Shdr* h, DiSlice* s) {
return True;
}
+/* Helper function to get the readlink path. Returns a copy of path if the
+ file wasn't a symbolic link. Returns NULL on error. Unless NULL is
+ returned the result needs to be released with dinfo_free.
+*/
+static HChar* readlink_path (const HChar *path)
+{
+ SizeT bufsiz = VG_(strlen)(path);
+ HChar *buf = ML_(dinfo_strdup)("readlink_path.strdup", path);
+ UInt tries = 6;
+
+ while (tries > 0) {
+ SysRes res;
+#if defined(VGP_arm64_linux)
+ res = VG_(do_syscall4)(__NR_readlinkat, VKI_AT_FDCWD,
+ (UWord)path, (UWord)buf, bufsiz);
+#elif defined(VGO_linux) || defined(VGO_darwin)
+ res = VG_(do_syscall3)(__NR_readlink, (UWord)path, (UWord)buf, bufsiz);
+#elif defined(VGO_solaris)
+ res = VG_(do_syscall4)(__NR_readlinkat, VKI_AT_FDCWD, (UWord)path,
+ (UWord)buf, bufsiz);
+#else
+# error Unknown OS
+#endif
+ if (sr_isError(res)) {
+ if (sr_Err(res) == VKI_EINVAL)
+ return buf; // It wasn't a symbolic link, return the strdup result.
+ ML_(dinfo_free)(buf);
+ return NULL;
+ }
+
+ SSizeT r = sr_Res(res);
+ if (r < 0) break;
+ if (r == bufsiz) { // buffer too small; increase and retry
+ bufsiz *= 2 + 16;
+ buf = ML_(dinfo_realloc)("readlink_path.realloc", buf, bufsiz);
+ tries--;
+ continue;
+ }
+ buf[r] = '\0';
+ break;
+ }
+
+ if (tries == 0) { // We tried, but weird long path?
+ ML_(dinfo_free)(buf);
+ return NULL;
+ }
+
+ return buf;
+}
+
/* The central function for reading ELF debug info. For the
object/exe specified by the DebugInfo, find ELF sections, then read
the symbols, line number info, file name info, CFA (stack-unwind
@@ -2926,8 +2984,12 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di )
(debugaltlink_escn.szB - buildid_offset)
* 2 + 1);
- /* The altfile might be relative to the debug file or main file. */
+ /* The altfile might be relative to the debug file or main file.
+ Make sure that we got the real file, not a symlink. */
HChar *dbgname = di->fsm.dbgname ? di->fsm.dbgname : di->fsm.filename;
+ HChar* rdbgname = readlink_path (dbgname);
+ if (rdbgname == NULL)
+ rdbgname = ML_(dinfo_strdup)("rdbgname", dbgname);
for (j = 0; j < debugaltlink_escn.szB - buildid_offset; j++)
VG_(sprintf)(
@@ -2937,9 +2999,11 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di )
+ buildid_offset + j));
/* See if we can find a matching debug file */
- aimg = find_debug_file( di, dbgname, altbuildid,
+ aimg = find_debug_file( di, rdbgname, altbuildid,
altfile_str_m, 0, True );
+ ML_(dinfo_free)(rdbgname);
+
if (altfile_str_m)
ML_(dinfo_free)(altfile_str_m);
ML_(dinfo_free)(altbuildid);
diff --git a/coregrind/m_debuginfo/readelf.c b/coregrind/m_debuginfo/readelf.c
index c19ff212b..70c28e629 100644
--- a/coregrind/m_debuginfo/readelf.c
+++ b/coregrind/m_debuginfo/readelf.c
@@ -1582,6 +1582,24 @@ static HChar* readlink_path (const HChar *path)
return NULL;
}
+ if (buf[0] == '/')
+ return buf;
+
+ /* Relative path, add link dir. */
+ HChar *linkdirptr;
+ SizeT linkdir_len = VG_(strlen)(path);
+ if ((linkdirptr = VG_(strrchr)(path, '/')) != NULL)
+ linkdir_len -= VG_(strlen)(linkdirptr + 1);
+
+ SizeT buflen = VG_(strlen)(buf);
+ SizeT needed = linkdir_len + buflen + 1;
+ if (bufsiz < needed)
+ buf = ML_(dinfo_realloc)("readlink_path.linkdir", buf, needed);
+
+ VG_(memmove)(buf + linkdir_len, buf, buflen);
+ VG_(memcpy)(buf, path, linkdir_len);
+ buf[needed - 1] = '\0';
+
return buf;
}

View File

@ -1,36 +0,0 @@
commit 59af5db9c15d8ea03c1521736fb1f107d66bce08
Author: philippe <philippe@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Sun Jun 25 20:25:50 2017 +0000
After fork, vgdb activity is polled according to the nr of bbs done :
once the nr of bbs done reaches the next vgdb poll, a check for vgdb
activity is done.
This might lead to the activation of gdbserver after fork.
Such poll is however not expected, unless the children is
to be trace.
This spurious poll in the forked child can cause failures
depending on the nr of bbs done before the fork, and the
nr of bbs done between the fork and the exec.
=> disable vgdb poll in the child in the cleanup after fork
in the child, unless the children have to be traced.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16454 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_gdbserver/m_gdbserver.c b/coregrind/m_gdbserver/m_gdbserver.c
index 87fbce2..648d543 100644
--- a/coregrind/m_gdbserver/m_gdbserver.c
+++ b/coregrind/m_gdbserver/m_gdbserver.c
@@ -646,6 +646,10 @@ static void gdbserver_cleanup_in_child_after_fork(ThreadId me)
if (VG_(clo_trace_children)) {
VG_(gdbserver_prerun_action) (me);
+ } else {
+ /* After fork, if we do not trace the children, disable vgdb
+ poll to avoid gdbserver being called unexpectedly. */
+ VG_(disable_vgdb_poll) ();
}
}

View File

@ -1,68 +0,0 @@
commit 79865f0eed7cf0e0ad687ee0a59d59a1d505b514
Author: mjw <mjw@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Sat Jun 17 13:49:22 2017 +0000
epoll_pwait can have a NULL sigmask.
According to the epoll_pwait(2) man page:
The sigmask argument may be specified as NULL, in which case
epoll_pwait() is equivalent to epoll_wait().
But doing that under valgrind gives:
==13887== Syscall param epoll_pwait(sigmask) points to unaddressable byte(s)
==13887== at 0x4F2B940: epoll_pwait (epoll_pwait.c:43)
==13887== by 0x400ADE: main (syscalls-2007.c:89)
==13887== Address 0x0 is not stack'd, malloc'd or (recently) free'd
This is because the sys_epoll_pwait wrapper has:
if (ARG4)
PRE_MEM_READ( "epoll_pwait(sigmask)", ARG5, sizeof(vki_sigset_t) );
Which looks like a typo (ARG4 is timeout and ARG5 is sigmask).
This shows up with newer glibc which translates an epoll_wait call into
an epoll_pwait call with NULL sigmask.
Fix typo and add a testcase.
https://bugs.kde.org/show_bug.cgi?id=381289
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16451 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c
index 26e02fd..4120c1d 100644
--- a/coregrind/m_syswrap/syswrap-linux.c
+++ b/coregrind/m_syswrap/syswrap-linux.c
@@ -1901,7 +1901,7 @@ PRE(sys_epoll_pwait)
int, maxevents, int, timeout, vki_sigset_t *, sigmask,
vki_size_t, sigsetsize);
PRE_MEM_WRITE( "epoll_pwait(events)", ARG2, sizeof(struct vki_epoll_event)*ARG3);
- if (ARG4)
+ if (ARG5)
PRE_MEM_READ( "epoll_pwait(sigmask)", ARG5, sizeof(vki_sigset_t) );
}
POST(sys_epoll_pwait)
diff --git a/memcheck/tests/linux/syscalls-2007.c b/memcheck/tests/linux/syscalls-2007.c
index b61c6d5..5494623 100644
--- a/memcheck/tests/linux/syscalls-2007.c
+++ b/memcheck/tests/linux/syscalls-2007.c
@@ -79,5 +79,16 @@ int main (void)
}
#endif
+#if defined(HAVE_EPOLL_CREATE) && defined(HAVE_EPOLL_PWAIT)
+ {
+ int fd3;
+ struct epoll_event evs[10];
+
+ fd3 = epoll_create (10);
+ /* epoll_pwait can take a NULL sigmask. */
+ epoll_pwait (fd3, evs, 10, 1, NULL);
+ }
+#endif
+
return 0;
}

View File

@ -1,183 +0,0 @@
commit 21788250c945713fa25c16f2683e1f9cd0bb6ccf
Author: philippe <philippe@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Sun Jun 25 12:40:53 2017 +0000
Fix some tests failure with GDB 8.0
At the beginning of a Valgrind gdbserver test,
2 messages are produced when launching the command
target remote | vgdb
A message output by vgdb:
relaying data between gdb and process <pid>
(this message is read by GDB from the vgdb pipe, and re-output
on stderr)
and a message produced by GDB:
Remote debugging using | ./vgdb
GDB 8.0 changes the order in which the above messages are output.
This causes 2 tests to fail, as the 'relaying' line appears
then in a part of the output deleted by a filter script.
To avoid this, change the filter scripts to always remove
this 'relaying line', which is not particularly interesting to check.
All the .exp files containining such a 'relaying' line are updated
accordingly.
This has been tested with various gdb versions (7.5, 7.7, 7.12, 8.0)
on amd64 and/or ppc64.
Thanks to Mark Wielaard, which helped to investigate this problem
by bisecting the GDB patches in GDB 8.0 causing this change of
behaviour.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16453 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/gdbserver_tests/filter_gdb b/gdbserver_tests/filter_gdb
index 7177720..ed78cfe 100755
--- a/gdbserver_tests/filter_gdb
+++ b/gdbserver_tests/filter_gdb
@@ -72,7 +72,7 @@ sed -e '/Remote debugging using/,/vgdb launched process attached/d'
-e '/^Missing separate debuginfo/d' \
-e '/\/_exit.c: No such file or directory/d' \
-e '/^Try: zypper install -C/d' \
- -e 's/\(relaying data between gdb and process \)[0-9][0-9]*/\1..../' \
+ -e '/relaying data between gdb and process/d' \
-e 's/pid [0-9][0-9]*/pid ..../g' \
-e 's/Thread [0-9][0-9]*/Thread ..../g' \
-e '/\[Switching to Thread ....\]/d' \
diff --git a/gdbserver_tests/filter_vgdb b/gdbserver_tests/filter_vgdb
index 2442ec5..f8028a3 100755
--- a/gdbserver_tests/filter_vgdb
+++ b/gdbserver_tests/filter_vgdb
@@ -11,7 +11,7 @@ $dir/../tests/filter_addresses |
# pid
# gdb 7.2 sometimes tries to access address 0x0 (same as with standard gdbserver)
# filter a debian 6.0/ppc32 line
-sed -e 's/\(relaying data between gdb and process \)[0-9][0-9]*/\1..../' \
+sed -e '/relaying data between gdb and process/d' \
-e 's/\(sending command .* to pid \)[0-9][0-9]*/\1..../' \
-e '/Cannot access memory at address 0x......../d' \
-e '/^[1-9][0-9]* \.\.\/sysdeps\/powerpc\/powerpc32\/dl-start\.S: No such file or directory\./d' |
diff --git a/gdbserver_tests/hginfo.stderrB.exp b/gdbserver_tests/hginfo.stderrB.exp
index df47f11..669ff92 100644
--- a/gdbserver_tests/hginfo.stderrB.exp
+++ b/gdbserver_tests/hginfo.stderrB.exp
@@ -1,4 +1,3 @@
-relaying data between gdb and process ....
vgdb-error value changed from 0 to 999999
Lock ga 0x........ {
Address 0x........ is 0 bytes inside data symbol "mx"
diff --git a/gdbserver_tests/mcblocklistsearch.stderrB.exp b/gdbserver_tests/mcblocklistsearch.stderrB.exp
index 312d776..1313321 100644
--- a/gdbserver_tests/mcblocklistsearch.stderrB.exp
+++ b/gdbserver_tests/mcblocklistsearch.stderrB.exp
@@ -1,4 +1,3 @@
-relaying data between gdb and process ....
vgdb-error value changed from 0 to 999999
Breakpoint 1 at 0x........: file leak-tree.c, line 42.
Breakpoint 2 at 0x........: file leak-tree.c, line 67.
diff --git a/gdbserver_tests/mcbreak.stderrB.exp b/gdbserver_tests/mcbreak.stderrB.exp
index 65281d2..0f051d1 100644
--- a/gdbserver_tests/mcbreak.stderrB.exp
+++ b/gdbserver_tests/mcbreak.stderrB.exp
@@ -1,4 +1,3 @@
-relaying data between gdb and process ....
vgdb-error value changed from 0 to 999999
vgdb-error value changed from 999999 to 0
n_errs_found 1 n_errs_shown 1 (vgdb-error 0)
diff --git a/gdbserver_tests/mcclean_after_fork.stderrB.exp b/gdbserver_tests/mcclean_after_fork.stderrB.exp
index 995b42f..e812b8e 100644
--- a/gdbserver_tests/mcclean_after_fork.stderrB.exp
+++ b/gdbserver_tests/mcclean_after_fork.stderrB.exp
@@ -1,4 +1,3 @@
-relaying data between gdb and process ....
vgdb-error value changed from 0 to 999999
monitor command request to kill this process
Remote connection closed
diff --git a/gdbserver_tests/mcinfcallWSRU.stderrB.exp b/gdbserver_tests/mcinfcallWSRU.stderrB.exp
index 7789123..a2f2b87 100644
--- a/gdbserver_tests/mcinfcallWSRU.stderrB.exp
+++ b/gdbserver_tests/mcinfcallWSRU.stderrB.exp
@@ -1,4 +1,3 @@
-relaying data between gdb and process ....
vgdb-error value changed from 0 to 999999
Breakpoint 1 at 0x........: file sleepers.c, line 74.
Continuing.
diff --git a/gdbserver_tests/mcleak.stderrB.exp b/gdbserver_tests/mcleak.stderrB.exp
index 7782119..7ed3920 100644
--- a/gdbserver_tests/mcleak.stderrB.exp
+++ b/gdbserver_tests/mcleak.stderrB.exp
@@ -1,4 +1,3 @@
-relaying data between gdb and process ....
vgdb-error value changed from 0 to 999999
10 bytes in 1 blocks are still reachable in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
diff --git a/gdbserver_tests/mcmain_pic.stderrB.exp b/gdbserver_tests/mcmain_pic.stderrB.exp
index c90e1fa..53ec0ce 100644
--- a/gdbserver_tests/mcmain_pic.stderrB.exp
+++ b/gdbserver_tests/mcmain_pic.stderrB.exp
@@ -1,2 +1 @@
-relaying data between gdb and process ....
vgdb-error value changed from 0 to 999999
diff --git a/gdbserver_tests/mcvabits.stderrB.exp b/gdbserver_tests/mcvabits.stderrB.exp
index bdabb1e..f9ced7a 100644
--- a/gdbserver_tests/mcvabits.stderrB.exp
+++ b/gdbserver_tests/mcvabits.stderrB.exp
@@ -1,4 +1,3 @@
-relaying data between gdb and process ....
vgdb-error value changed from 0 to 999999
Address 0x........ len 10 addressable
Address 0x........ is 0 bytes inside data symbol "undefined"
diff --git a/gdbserver_tests/mssnapshot.stderrB.exp b/gdbserver_tests/mssnapshot.stderrB.exp
index 8bee8fc..e419ce6 100644
--- a/gdbserver_tests/mssnapshot.stderrB.exp
+++ b/gdbserver_tests/mssnapshot.stderrB.exp
@@ -1,4 +1,3 @@
-relaying data between gdb and process ....
vgdb-error value changed from 0 to 999999
general valgrind monitor commands:
help [debug] : monitor command help. With debug: + debugging commands
diff --git a/gdbserver_tests/nlgone_abrt.stderrB.exp b/gdbserver_tests/nlgone_abrt.stderrB.exp
index c8b2024..e69de29 100644
--- a/gdbserver_tests/nlgone_abrt.stderrB.exp
+++ b/gdbserver_tests/nlgone_abrt.stderrB.exp
@@ -1 +0,0 @@
-relaying data between gdb and process ....
diff --git a/gdbserver_tests/nlgone_exit.stderrB.exp b/gdbserver_tests/nlgone_exit.stderrB.exp
index c8b2024..e69de29 100644
--- a/gdbserver_tests/nlgone_exit.stderrB.exp
+++ b/gdbserver_tests/nlgone_exit.stderrB.exp
@@ -1 +0,0 @@
-relaying data between gdb and process ....
diff --git a/gdbserver_tests/nlgone_return.stderrB.exp b/gdbserver_tests/nlgone_return.stderrB.exp
index c8b2024..e69de29 100644
--- a/gdbserver_tests/nlgone_return.stderrB.exp
+++ b/gdbserver_tests/nlgone_return.stderrB.exp
@@ -1 +0,0 @@
-relaying data between gdb and process ....
diff --git a/gdbserver_tests/nlpasssigalrm.stderrB.exp b/gdbserver_tests/nlpasssigalrm.stderrB.exp
index c90e1fa..53ec0ce 100644
--- a/gdbserver_tests/nlpasssigalrm.stderrB.exp
+++ b/gdbserver_tests/nlpasssigalrm.stderrB.exp
@@ -1,2 +1 @@
-relaying data between gdb and process ....
vgdb-error value changed from 0 to 999999
diff --git a/gdbserver_tests/nlself_invalidate.stderrB.exp b/gdbserver_tests/nlself_invalidate.stderrB.exp
index c8b2024..e69de29 100644
--- a/gdbserver_tests/nlself_invalidate.stderrB.exp
+++ b/gdbserver_tests/nlself_invalidate.stderrB.exp
@@ -1 +0,0 @@
-relaying data between gdb and process ....
diff --git a/gdbserver_tests/nlsigvgdb.stderrB.exp b/gdbserver_tests/nlsigvgdb.stderrB.exp
index 672fea5..ed5bb61 100644
--- a/gdbserver_tests/nlsigvgdb.stderrB.exp
+++ b/gdbserver_tests/nlsigvgdb.stderrB.exp
@@ -1,4 +1,3 @@
-relaying data between gdb and process ....
vgdb-error value changed from 0 to 999999
gdbserver: continuing in 5000 ms ...
gdbserver: continuing after wait ...

View File

@ -1,93 +0,0 @@
commit 3bce9544deab0261c7c55ccdc46ce1f36e468040
Author: Mark Wielaard <mark@klomp.org>
Date: Thu Jul 12 13:56:00 2018 +0200
Accept read-only PT_LOAD segments and .rodata.
The new binutils ld -z separate-code option creates multiple read-only
PT_LOAD segments and might place .rodata in a non-executable segment.
Allow and keep track of separate read-only segments and allow a readonly
page with .rodata section.
Based on patches from Tom Hughes <tom@compton.nu> and
H.J. Lu <hjl.tools@gmail.com>.
https://bugs.kde.org/show_bug.cgi?id=395682
index 13991b6..c36d498 100644
--- a/coregrind/m_debuginfo/debuginfo.c
+++ b/coregrind/m_debuginfo/debuginfo.c
@@ -1126,9 +1126,7 @@ ULong VG_(di_notify_mmap)( Addr a, Bool allow_SkFileV, Int use_fd )
# error "Unknown platform"
# endif
-# if defined(VGP_x86_darwin) && DARWIN_VERS >= DARWIN_10_7
is_ro_map = seg->hasR && !seg->hasW && !seg->hasX;
-# endif
# if defined(VGO_solaris)
is_rx_map = seg->hasR && seg->hasX && !seg->hasW;
diff --git a/coregrind/m_debuginfo/readelf.c b/coregrind/m_debuginfo/readelf.c
index 62192f0..95b97d6 100644
--- a/coregrind/m_debuginfo/readelf.c
+++ b/coregrind/m_debuginfo/readelf.c
@@ -1881,7 +1881,7 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di )
Bool loaded = False;
for (j = 0; j < VG_(sizeXA)(di->fsm.maps); j++) {
const DebugInfoMapping* map = VG_(indexXA)(di->fsm.maps, j);
- if ( (map->rx || map->rw)
+ if ( (map->rx || map->rw || map->ro)
&& map->size > 0 /* stay sane */
&& a_phdr.p_offset >= map->foff
&& a_phdr.p_offset < map->foff + map->size
@@ -1912,6 +1912,16 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di )
i, (UWord)item.bias);
loaded = True;
}
+ if (map->ro
+ && (a_phdr.p_flags & (PF_R | PF_W | PF_X))
+ == PF_R) {
+ item.exec = False;
+ VG_(addToXA)(svma_ranges, &item);
+ TRACE_SYMTAB(
+ "PT_LOAD[%ld]: acquired as ro, bias 0x%lx\n",
+ i, (UWord)item.bias);
+ loaded = True;
+ }
}
}
if (!loaded) {
@@ -2179,17 +2189,25 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di )
}
}
- /* Accept .rodata where mapped as rx (data), even if zero-sized */
+ /* Accept .rodata where mapped as rx or rw (data), even if zero-sized */
if (0 == VG_(strcmp)(name, ".rodata")) {
- if (inrx && !di->rodata_present) {
- di->rodata_present = True;
+ if (!di->rodata_present) {
di->rodata_svma = svma;
- di->rodata_avma = svma + inrx->bias;
+ di->rodata_avma = svma;
di->rodata_size = size;
- di->rodata_bias = inrx->bias;
di->rodata_debug_svma = svma;
- di->rodata_debug_bias = inrx->bias;
- /* NB was 'inrw' prior to r11794 */
+ if (inrx) {
+ di->rodata_avma += inrx->bias;
+ di->rodata_bias = inrx->bias;
+ di->rodata_debug_bias = inrx->bias;
+ } else if (inrw) {
+ di->rodata_avma += inrw->bias;
+ di->rodata_bias = inrw->bias;
+ di->rodata_debug_bias = inrw->bias;
+ } else {
+ BAD(".rodata");
+ }
+ di->rodata_present = True;
TRACE_SYMTAB("acquiring .rodata svma = %#lx .. %#lx\n",
di->rodata_svma,
di->rodata_svma + di->rodata_size - 1);

View File

@ -1,161 +0,0 @@
commit 326d53c8378984c50f29bd124d3f2b4a1242306c
Author: mjw <mjw@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Fri Jun 16 09:33:35 2017 +0000
ppc64 doesn't compile test_isa_2_06_partx.c without VSX support
The #ifdef HAS_VSX guard is wrongly placed. It makes the standard
include headers not be used. Causing a build failure. Fix by moving
the #ifdef HAS_VSX after the standard includes.
https://bugs.kde.org/show_bug.cgi?id=381272
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16450 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/none/tests/ppc32/test_isa_2_06_part1.c b/none/tests/ppc32/test_isa_2_06_part1.c
index 7cd4930..7a14c6d 100644
--- a/none/tests/ppc32/test_isa_2_06_part1.c
+++ b/none/tests/ppc32/test_isa_2_06_part1.c
@@ -20,13 +20,14 @@
The GNU General Public License is contained in the file COPYING.
*/
-#ifdef HAS_VSX
-
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
+
+#ifdef HAS_VSX
+
#include <altivec.h>
#ifndef __powerpc64__
diff --git a/none/tests/ppc32/test_isa_2_06_part2.c b/none/tests/ppc32/test_isa_2_06_part2.c
index c7bf4fe..2ee7b53 100644
--- a/none/tests/ppc32/test_isa_2_06_part2.c
+++ b/none/tests/ppc32/test_isa_2_06_part2.c
@@ -20,17 +20,18 @@
The GNU General Public License is contained in the file COPYING.
*/
-#ifdef HAS_VSX
-
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
-#include <altivec.h>
#include <math.h>
#include <unistd.h> // getopt
+#ifdef HAS_VSX
+
+#include <altivec.h>
+
#ifndef __powerpc64__
typedef uint32_t HWord_t;
#else
diff --git a/none/tests/ppc32/test_isa_2_06_part3.c b/none/tests/ppc32/test_isa_2_06_part3.c
index 8c74c09..5ebc1a5 100644
--- a/none/tests/ppc32/test_isa_2_06_part3.c
+++ b/none/tests/ppc32/test_isa_2_06_part3.c
@@ -20,17 +20,18 @@
The GNU General Public License is contained in the file COPYING.
*/
-#ifdef HAS_VSX
-
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
-#include <altivec.h>
#include <math.h>
#include <unistd.h> // getopt
+#ifdef HAS_VSX
+
+#include <altivec.h>
+
#ifndef __powerpc64__
typedef uint32_t HWord_t;
#else
diff --git a/none/tests/ppc64/test_isa_2_06_part1.c b/none/tests/ppc64/test_isa_2_06_part1.c
index 7cd4930..7a14c6d 100644
--- a/none/tests/ppc64/test_isa_2_06_part1.c
+++ b/none/tests/ppc64/test_isa_2_06_part1.c
@@ -20,13 +20,14 @@
The GNU General Public License is contained in the file COPYING.
*/
-#ifdef HAS_VSX
-
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
+
+#ifdef HAS_VSX
+
#include <altivec.h>
#ifndef __powerpc64__
diff --git a/none/tests/ppc64/test_isa_2_06_part2.c b/none/tests/ppc64/test_isa_2_06_part2.c
index c7bf4fe..2ee7b53 100644
--- a/none/tests/ppc64/test_isa_2_06_part2.c
+++ b/none/tests/ppc64/test_isa_2_06_part2.c
@@ -20,17 +20,18 @@
The GNU General Public License is contained in the file COPYING.
*/
-#ifdef HAS_VSX
-
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
-#include <altivec.h>
#include <math.h>
#include <unistd.h> // getopt
+#ifdef HAS_VSX
+
+#include <altivec.h>
+
#ifndef __powerpc64__
typedef uint32_t HWord_t;
#else
diff --git a/none/tests/ppc64/test_isa_2_06_part3.c b/none/tests/ppc64/test_isa_2_06_part3.c
index 8c74c09..5ebc1a5 100644
--- a/none/tests/ppc64/test_isa_2_06_part3.c
+++ b/none/tests/ppc64/test_isa_2_06_part3.c
@@ -20,17 +20,18 @@
The GNU General Public License is contained in the file COPYING.
*/
-#ifdef HAS_VSX
-
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
-#include <altivec.h>
#include <math.h>
#include <unistd.h> // getopt
+#ifdef HAS_VSX
+
+#include <altivec.h>
+
#ifndef __powerpc64__
typedef uint32_t HWord_t;
#else

View File

@ -1,109 +0,0 @@
diff --git a/VEX/priv/guest_ppc_toIR.c b/VEX/priv/guest_ppc_toIR.c
index e16e837..a8d4926 100644
--- a/VEX/priv/guest_ppc_toIR.c
+++ b/VEX/priv/guest_ppc_toIR.c
@@ -29356,62 +29356,70 @@ DisResult disInstr_PPC_WRK (
decode_noF:
vassert(!allow_F);
- vex_printf("disInstr(ppc): found the Floating Point instruction 0x%x that\n"
- "can't be handled by Valgrind on this host. This instruction\n"
- "requires a host that supports Floating Point instructions.\n",
- theInstr);
+ if (sigill_diag)
+ vex_printf("disInstr(ppc): found the Floating Point instruction 0x%x that\n"
+ "can't be handled by Valgrind on this host. This instruction\n"
+ "requires a host that supports Floating Point instructions.\n",
+ theInstr);
goto not_supported;
decode_noV:
vassert(!allow_V);
- vex_printf("disInstr(ppc): found an AltiVec or an e500 instruction 0x%x\n"
- "that can't be handled by Valgrind. If this instruction is an\n"
- "Altivec instruction, Valgrind must be run on a host that supports"
- "AltiVec instructions. If the application was compiled for e500, then\n"
- "unfortunately Valgrind does not yet support e500 instructions.\n",
- theInstr);
+ if (sigill_diag)
+ vex_printf("disInstr(ppc): found an AltiVec or an e500 instruction 0x%x\n"
+ "that can't be handled by Valgrind. If this instruction is an\n"
+ "Altivec instruction, Valgrind must be run on a host that supports"
+ "AltiVec instructions. If the application was compiled for e500, then\n"
+ "unfortunately Valgrind does not yet support e500 instructions.\n",
+ theInstr);
goto not_supported;
decode_noVX:
vassert(!allow_VX);
- vex_printf("disInstr(ppc): found the instruction 0x%x that is defined in the\n"
- "Power ISA 2.06 ABI but can't be handled by Valgrind on this host.\n"
- "This instruction \nrequires a host that supports the ISA 2.06 ABI.\n",
- theInstr);
+ if (sigill_diag)
+ vex_printf("disInstr(ppc): found the instruction 0x%x that is defined in the\n"
+ "Power ISA 2.06 ABI but can't be handled by Valgrind on this host.\n"
+ "This instruction \nrequires a host that supports the ISA 2.06 ABI.\n",
+ theInstr);
goto not_supported;
decode_noFX:
vassert(!allow_FX);
- vex_printf("disInstr(ppc): found the General Purpose-Optional instruction 0x%x\n"
- "that can't be handled by Valgrind on this host. This instruction\n"
- "requires a host that supports the General Purpose-Optional instructions.\n",
- theInstr);
+ if (sigill_diag)
+ vex_printf("disInstr(ppc): found the General Purpose-Optional instruction 0x%x\n"
+ "that can't be handled by Valgrind on this host. This instruction\n"
+ "requires a host that supports the General Purpose-Optional instructions.\n",
+ theInstr);
goto not_supported;
decode_noGX:
vassert(!allow_GX);
- vex_printf("disInstr(ppc): found the Graphics-Optional instruction 0x%x\n"
- "that can't be handled by Valgrind on this host. This instruction\n"
- "requires a host that supports the Graphic-Optional instructions.\n",
- theInstr);
+ if (sigill_diag)
+ vex_printf("disInstr(ppc): found the Graphics-Optional instruction 0x%x\n"
+ "that can't be handled by Valgrind on this host. This instruction\n"
+ "requires a host that supports the Graphic-Optional instructions.\n",
+ theInstr);
goto not_supported;
decode_noDFP:
vassert(!allow_DFP);
- vex_printf("disInstr(ppc): found the decimal floating point (DFP) instruction 0x%x\n"
- "that can't be handled by Valgrind on this host. This instruction\n"
- "requires a host that supports DFP instructions.\n",
- theInstr);
+ if (sigill_diag)
+ vex_printf("disInstr(ppc): found the decimal floating point (DFP) instruction 0x%x\n"
+ "that can't be handled by Valgrind on this host. This instruction\n"
+ "requires a host that supports DFP instructions.\n",
+ theInstr);
goto not_supported;
decode_noP8:
vassert(!allow_isa_2_07);
- vex_printf("disInstr(ppc): found the Power 8 instruction 0x%x that can't be handled\n"
- "by Valgrind on this host. This instruction requires a host that\n"
- "supports Power 8 instructions.\n",
- theInstr);
+ if (sigill_diag)
+ vex_printf("disInstr(ppc): found the Power 8 instruction 0x%x that can't be handled\n"
+ "by Valgrind on this host. This instruction requires a host that\n"
+ "supports Power 8 instructions.\n",
+ theInstr);
goto not_supported;
decode_noP9:
vassert(!allow_isa_3_0);
- vex_printf("disInstr(ppc): found the Power 9 instruction 0x%x that can't be handled\n"
- "by Valgrind on this host. This instruction requires a host that\n"
- "supports Power 9 instructions.\n",
- theInstr);
+ if (sigill_diag)
+ vex_printf("disInstr(ppc): found the Power 9 instruction 0x%x that can't be handled\n"
+ "by Valgrind on this host. This instruction requires a host that\n"
+ "supports Power 9 instructions.\n",
+ theInstr);
goto not_supported;
decode_failure:

View File

@ -1,13 +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 73a563c..201fa88 100644
--- a/none/tests/ppc64/test_isa_2_07_part1.c
+++ b/none/tests/ppc64/test_isa_2_07_part1.c
@@ -406,7 +406,7 @@ static void test_mtvsrwz (void)
static void test_mtfprwa (void)
{
- __asm__ __volatile__ ("mtfprwa %x0,%1" : "=ws" (vec_out) : "r" (r14));
+ __asm__ __volatile__ ("mtfprwa %x0,%1" : "=d" (vec_out) : "r" (r14));
};
static test_t tests_move_ops_spe[] = {

View File

@ -1,99 +0,0 @@
commit 6a55b1e82ccda3f0d663d2cc89eb543ae2d096bf
Author: Carl Love <carll@us.ibm.com>
Date: Tue Oct 31 13:45:28 2017 -0500
Fix access to time base register to return 64-bits.
diff --git a/VEX/priv/guest_ppc_toIR.c b/VEX/priv/guest_ppc_toIR.c
index f63146e7e..4ec37f5f9 100644
--- a/VEX/priv/guest_ppc_toIR.c
+++ b/VEX/priv/guest_ppc_toIR.c
@@ -9419,26 +9419,60 @@ static Bool dis_proc_ctl ( const VexAbiInfo* vbi, UInt theInstr )
putIReg( rD_addr, getGST( PPC_GST_SPRG3_RO ) );
break;
- /* Even a lowly PPC7400 can run the associated helper, so no
- obvious need for feature testing at this point. */
- case 268 /* 0x10C */:
- case 269 /* 0x10D */: {
- UInt arg = SPR==268 ? 0 : 1;
- IRTemp val = newTemp(Ity_I32);
- IRExpr** args = mkIRExprVec_1( mkU32(arg) );
+ case 268 /* 0x10C TB - 64 bit time base register */:
+ {
+ IRTemp val = newTemp(Ity_I64);
+ IRExpr** args = mkIRExprVec_0();
IRDirty* d = unsafeIRDirty_1_N(
- val,
- 0/*regparms*/,
- "ppc32g_dirtyhelper_MFSPR_268_269",
- fnptr_to_fnentry
- (vbi, &ppc32g_dirtyhelper_MFSPR_268_269),
- args
- );
+ val,
+ 0/*regparms*/,
+ "ppcg_dirtyhelper_MFTB",
+ fnptr_to_fnentry(vbi,
+ &ppcg_dirtyhelper_MFTB),
+ args );
+ /* execute the dirty call, dumping the result in val. */
+ stmt( IRStmt_Dirty(d) );
+ putIReg( rD_addr, (mode64) ? mkexpr(val) :
+ unop(Iop_64to32, mkexpr(val)) );
+
+ break;
+ }
+ case 269 /* 0x10D TBU - upper 32-bits of time base register */:
+ {
+ DIP("mfspr r%u,%u", rD_addr, SPR);
+ IRTemp val = newTemp(Ity_I64);
+ IRExpr** args = mkIRExprVec_0();
+ IRDirty* d = unsafeIRDirty_1_N(
+ val,
+ 0/*regparms*/,
+ "ppcg_dirtyhelper_MFTB",
+ fnptr_to_fnentry(vbi,
+ &ppcg_dirtyhelper_MFTB),
+ args );
/* execute the dirty call, dumping the result in val. */
stmt( IRStmt_Dirty(d) );
putIReg( rD_addr,
- mkWidenFrom32(ty, mkexpr(val), False/*unsigned*/) );
+ mkWidenFrom32(ty, unop(Iop_64HIto32, mkexpr(val)),
+ /* Signed */False) );
+ break;
+ }
+ case 284 /* 0x1 TBL - lower 32-bits of time base register */:
+ {
DIP("mfspr r%u,%u", rD_addr, SPR);
+ IRTemp val = newTemp(Ity_I64);
+ IRExpr** args = mkIRExprVec_0();
+ IRDirty* d = unsafeIRDirty_1_N(
+ val,
+ 0/*regparms*/,
+ "ppcg_dirtyhelper_MFTB",
+ fnptr_to_fnentry(vbi,
+ &ppcg_dirtyhelper_MFTB),
+ args );
+ /* execute the dirty call, dumping the result in val. */
+ stmt( IRStmt_Dirty(d) );
+ putIReg( rD_addr,
+ mkWidenFrom32(ty, unop(Iop_64to32, mkexpr(val)),
+ /* Signed */False) );
break;
}
@@ -9493,6 +9527,12 @@ static Bool dis_proc_ctl ( const VexAbiInfo* vbi, UInt theInstr )
putIReg( rD_addr, (mode64) ? mkexpr(val) :
unop(Iop_64to32, mkexpr(val)) );
break;
+ case 284:
+ DIP("mftbl r%u", rD_addr);
+ putIReg( rD_addr,
+ mkWidenFrom32(ty, unop(Iop_64to32, mkexpr(val)),
+ /* Signed */False) );
+ break;
default:
return False; /* illegal instruction */
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,57 +0,0 @@
commit d6a810760ec61ddedf15445457edbbe288536a2f
Author: Julian Seward <jseward@acm.org>
Date: Tue Dec 12 22:31:54 2017 +0100
Fix false positive with s390x cgijnl instruction testing against sign bit.
https://bugs.kde.org/show_bug.cgi?id=387712
When the cgij "compare immediate and branch relative" instruction
compares 0 <=signed dep1, that means dep1 >=signed 0, so it is a test
against the most significant bit of dep1. So only that bit needs
to be defined.
diff --git a/VEX/priv/guest_s390_helpers.c b/VEX/priv/guest_s390_helpers.c
index 4cccdec..aacd833 100644
--- a/VEX/priv/guest_s390_helpers.c
+++ b/VEX/priv/guest_s390_helpers.c
@@ -1818,6 +1818,13 @@ isC64(const IRExpr *expr)
return expr->tag == Iex_Const && expr->Iex.Const.con->tag == Ico_U64;
}
+static inline Bool
+isC64_exactly(const IRExpr *expr, ULong n)
+{
+ return expr->tag == Iex_Const && expr->Iex.Const.con->tag == Ico_U64
+ && expr->Iex.Const.con->Ico.U64 == n;
+}
+
/* The returned expression is NULL if no specialization was found. In that
case the helper function will be called. Otherwise, the expression has
@@ -1895,9 +1902,25 @@ guest_s390x_spechelper(const HChar *function_name, IRExpr **args,
}
/* cc_dep1 > cc_dep2 ----> cc_dep2 < cc_dep1 */
if (cond == 2 || cond == 2 + 1) {
+ /* If we ever need the counterpart of the bug387712 fix just
+ below, then here is the place. We'll need to give an
+ alternative expression for the case "cc_dep2 <s 0". From a
+ bit of simple testing, I've yet to see any such cases,
+ however. */
return unop(Iop_1Uto32, binop(Iop_CmpLT64S, cc_dep2, cc_dep1));
}
if (cond == 8 + 2 || cond == 8 + 2 + 1) {
+ if (isC64_exactly(cc_dep2, 0)) {
+ /* 0 <=signed dep1
+ --> dep1 >=signed 0
+ --> m.s.bit of dep1 == 0 */
+ /* See bug 387712. This is an old trick from gcc to extract
+ the most significant bit of a word. */
+ return unop(Iop_64to32,
+ binop(Iop_Xor64,
+ binop(Iop_Shr64, cc_dep1, mkU8(63)),
+ mkU64(1)));
+ }
return unop(Iop_1Uto32, binop(Iop_CmpLE64S, cc_dep2, cc_dep1));
}
if (cond == 8 + 4 + 2 || cond == 8 + 4 + 2 + 1) {

View File

@ -1,81 +0,0 @@
commit f1ff8597ef9c37ff1a853411b9e3be1696c36d92
Author: Philippe Waroquiers <philippe.waroquiers@skynet.be>
Date: Tue Sep 19 23:17:48 2017 +0200
Implement static TLS code for more platforms
gdbserver_tests/hgtls is failing on a number of platforms
as it looks like static tls handling is now needed.
So, omplement static tls for a few more platforms.
The formulas that are platform dependent are somewhat wild guesses
obtained with trial and errors.
Note that arm/arm64/ppc32 are not (yet) done
diff --git a/coregrind/m_gdbserver/target.c b/coregrind/m_gdbserver/target.c
index 10e52fc..1f03c12 100644
--- a/coregrind/m_gdbserver/target.c
+++ b/coregrind/m_gdbserver/target.c
@@ -712,6 +712,7 @@ Bool valgrind_get_tls_addr (ThreadState *tst,
// Check we can read the modid
CHECK_DEREF(lm+lm_modid_offset, sizeof(unsigned long int), "link_map modid");
modid = *(unsigned long int *)(lm+lm_modid_offset);
+ dlog (2, "tid %u modid %lu\n", tst->tid, modid);
// Check we can access the dtv entry for modid
CHECK_DEREF(dtv + 2 * modid, sizeof(CORE_ADDR), "dtv[2*modid]");
@@ -719,7 +720,6 @@ Bool valgrind_get_tls_addr (ThreadState *tst,
// Compute the base address of the tls block.
*tls_addr = *(dtv + 2 * modid);
-#if defined(VGA_mips32) || defined(VGA_mips64)
if (*tls_addr & 1) {
/* This means that computed address is not valid, most probably
because given module uses Static TLS.
@@ -731,17 +731,24 @@ Bool valgrind_get_tls_addr (ThreadState *tst,
CORE_ADDR tls_offset_addr;
PtrdiffT tls_offset;
- dlog(1, "computing tls_addr using static TLS\n");
+ dlog(2, "tls_addr (%p & 1) => computing tls_addr using static TLS\n",
+ (void*) *tls_addr);
/* Assumes that tls_offset is placed right before tls_modid.
To check the assumption, start a gdb on none/tests/tls and do:
- p &((struct link_map*)0x0)->l_tls_modid
- p &((struct link_map*)0x0)->l_tls_offset */
+ p &((struct link_map*)0x0)->l_tls_modid
+ p &((struct link_map*)0x0)->l_tls_offset
+ Instead of assuming this, we could calculate this similarly to
+ lm_modid_offset, by extending getplatformoffset to support querying
+ more than one offset.
+ */
tls_offset_addr = lm + lm_modid_offset - sizeof(PtrdiffT);
// Check we can read the tls_offset.
CHECK_DEREF(tls_offset_addr, sizeof(PtrdiffT), "link_map tls_offset");
tls_offset = *(PtrdiffT *)(tls_offset_addr);
+ dlog(2, "tls_offset_addr %p tls_offset %ld\n",
+ (void*)tls_offset_addr, (long)tls_offset);
/* Following two values represent platform dependent constants
NO_TLS_OFFSET and FORCED_DYNAMIC_TLS_OFFSET, respectively. */
@@ -751,9 +758,18 @@ Bool valgrind_get_tls_addr (ThreadState *tst,
}
// This calculation is also platform dependent.
+#if defined(VGA_mips32) || defined(VGA_mips64)
*tls_addr = ((CORE_ADDR)dtv_loc + 2 * sizeof(CORE_ADDR) + tls_offset);
- }
+#elif defined(VGA_ppc64be) || defined(VGA_ppc64le)
+ *tls_addr = ((CORE_ADDR)dtv_loc + sizeof(CORE_ADDR) + tls_offset);
+#elif defined(VGA_x86) || defined(VGA_amd64) || defined(VGA_s390x)
+ *tls_addr = (CORE_ADDR)dtv_loc - tls_offset - sizeof(CORE_ADDR);
+#else
+ // ppc32, arm, arm64
+ dlog(0, "target.c is missing platform code for static TLS\n");
+ return False;
#endif
+ }
// Finally, add tls variable offset to tls block base address.
*tls_addr += offset;

View File

@ -1,36 +0,0 @@
commit 3c3aa1c62767c48ac8f2015df66f04f354dd897b
Author: Mark Wielaard <mark@klomp.org>
Date: Tue Oct 17 17:49:26 2017 +0200
Suppress _dl_runtime_resolve_avx_slow for memcheck conditional.
glibc ld.so has an optimization when resolving a symbol that checks
whether or not the upper 128 bits of the ymm registers are zero. If
so it uses "cheaper" instructions to save/restore them using the xmm
registers. If those upper 128 bits contain undefined values memcheck
will issue an Conditional jump or move depends on uninitialised value(s)
warning whenever trying to resolve a symbol.
This triggers in our sh-mem-vecxxx test cases. Suppress the warning
by default.
diff --git a/glibc-2.X.supp.in b/glibc-2.X.supp.in
index 8edeb4a..126e8b3 100644
--- a/glibc-2.X.supp.in
+++ b/glibc-2.X.supp.in
@@ -236,3 +236,15 @@
Memcheck:Cond
fun:_dl_relocate_object
}
+
+# glibc ld.so has an optimization when resolving a symbol that checks
+# whether or not the upper 128 bits of the ymm registers are zero. If
+# so it uses "cheaper" instructions to save/restore them using the xmm
+# registers. If those upper 128 bits contain undefined values memcheck
+# will issue an Conditional jump or move depends on uninitialised value(s)
+# warning whenever trying to resolve a symbol.
+{
+ dl-trampoline-sse-avx
+ Memcheck:Cond
+ fun:_dl_runtime_resolve_avx_slow
+}

View File

@ -1,25 +0,0 @@
commit 9b37074f7609cd496c067e88ef8c436981aa7267
Author: mjw <mjw@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Thu Jun 29 15:26:30 2017 +0000
memcheck/tests: Use ucontext_t instead of struct ucontext
glibc 2.26 does not expose struct ucontext anymore.
Signed-off-by: Khem Raj <raj.khem@gmail.com>
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16457 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/memcheck/tests/linux/stack_changes.c b/memcheck/tests/linux/stack_changes.c
index a978fc2..7f97b90 100644
--- a/memcheck/tests/linux/stack_changes.c
+++ b/memcheck/tests/linux/stack_changes.c
@@ -10,7 +10,7 @@
// This test is checking the libc context calls (setcontext, etc.) and
// checks that Valgrind notices their stack changes properly.
-typedef struct ucontext mycontext;
+typedef ucontext_t mycontext;
mycontext ctx1, ctx2, oldc;
int count;

View File

@ -1,47 +0,0 @@
diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c
index 2336c29..0f8e07a 100644
--- a/coregrind/m_syswrap/syswrap-linux.c
+++ b/coregrind/m_syswrap/syswrap-linux.c
@@ -5277,8 +5277,25 @@ PRE(sys_utimensat)
int, dfd, char *, filename, struct timespec *, utimes, int, flags);
if (ARG2 != 0)
PRE_MEM_RASCIIZ( "utimensat(filename)", ARG2 );
- if (ARG3 != 0)
- PRE_MEM_READ( "utimensat(tvp)", ARG3, 2 * sizeof(struct vki_timespec) );
+ if (ARG3 != 0) {
+ /* If timespec.tv_nsec has the special value UTIME_NOW or UTIME_OMIT
+ then the tv_sec field is ignored. */
+ struct vki_timespec *times = (struct vki_timespec *)(Addr)ARG3;
+ PRE_MEM_READ( "utimensat(times[0].tv_nsec)",
+ (Addr)&times[0].tv_nsec, sizeof(times[0].tv_nsec));
+ PRE_MEM_READ( "utimensat(times[1].tv_nsec)",
+ (Addr)&times[1].tv_nsec, sizeof(times[1].tv_nsec));
+ if (ML_(safe_to_deref)(times, 2 * sizeof(struct vki_timespec))) {
+ if (times[0].tv_nsec != VKI_UTIME_NOW
+ && times[0].tv_nsec != VKI_UTIME_OMIT)
+ PRE_MEM_READ( "utimensat(times[0].tv_sec)",
+ (Addr)&times[0].tv_sec, sizeof(times[0].tv_sec));
+ if (times[1].tv_nsec != VKI_UTIME_NOW
+ && times[1].tv_nsec != VKI_UTIME_OMIT)
+ PRE_MEM_READ( "utimensat(times[1].tv_sec)",
+ (Addr)&times[1].tv_sec, sizeof(times[1].tv_sec));
+ }
+ }
}
PRE(sys_newfstatat)
diff --git a/include/vki/vki-linux.h b/include/vki/vki-linux.h
index 7072080..bf0c1aa 100644
--- a/include/vki/vki-linux.h
+++ b/include/vki/vki-linux.h
@@ -283,6 +283,10 @@ struct vki_timespec {
long tv_nsec; /* nanoseconds */
};
+/* Special values for vki_timespec.tv_nsec when used with utimensat. */
+#define VKI_UTIME_NOW ((1l << 30) - 1l)
+#define VKI_UTIME_OMIT ((1l << 30) - 2l)
+
struct vki_timeval {
vki_time_t tv_sec; /* seconds */
vki_suseconds_t tv_usec; /* microseconds */

View File

@ -1,50 +0,0 @@
diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c
index bec145a..11bb13d 100644
--- a/coregrind/m_syswrap/syswrap-x86-linux.c
+++ b/coregrind/m_syswrap/syswrap-x86-linux.c
@@ -1604,7 +1604,10 @@ static SyscallTableEntry syscall_table[] = {
LINX_(__NR_sendmsg, sys_sendmsg), // 370
LINXY(__NR_recvfrom, sys_recvfrom), // 371
LINXY(__NR_recvmsg, sys_recvmsg), // 372
- LINX_(__NR_shutdown, sys_shutdown) // 373
+ LINX_(__NR_shutdown, sys_shutdown), // 373
+
+ /* Explicitly not supported on i386 yet. */
+ GENX_(__NR_arch_prctl, sys_ni_syscall) // 384
};
SyscallTableEntry* ML_(get_linux_syscall_entry) ( UInt sysno )
commit 12d162aabc8180d9ad0c095e72a1354e93b091d7
Author: Tom Hughes <tom@compton.nu>
Date: Wed Mar 21 12:28:31 2018 +0000
Update linux system call numbers.
diff --git a/include/vki/vki-scnums-x86-linux.h b/include/vki/vki-scnums-x86-linux.h
index 8a6376b..041d247 100644
--- a/include/vki/vki-scnums-x86-linux.h
+++ b/include/vki/vki-scnums-x86-linux.h
@@ -32,7 +32,7 @@
#ifndef __VKI_SCNUMS_X86_LINUX_H
#define __VKI_SCNUMS_X86_LINUX_H
-// Derived from linux-2.6/arch/x86/syscalls/syscall_32.tbl
+// Derived from linux-2.6/arch/x86/entry/syscalls/syscall_32.tbl
#define __NR_restart_syscall 0
#define __NR_exit 1
@@ -411,6 +411,14 @@
#define __NR_userfaultfd 374
#define __NR_membarrier 375
#define __NR_mlock2 376
+#define __NR_copy_file_range 377
+#define __NR_preadv2 378
+#define __NR_pwritev2 379
+#define __NR_pkey_mprotect 380
+#define __NR_pkey_alloc 381
+#define __NR_pkey_free 382
+#define __NR_statx 383
+#define __NR_arch_prctl 384
#endif /* __VKI_SCNUMS_X86_LINUX_H */

View File

@ -1,25 +0,0 @@
commit 34dd8493de39314033509bb7ad62673f33dcf3db
Author: Ivo Raisr <ivosh@ivosh.net>
Date: Thu Aug 3 05:22:01 2017 +0000
Fix handling command line option --xml-socket.
Fixes BZ#382998
Patch by: Orgad Shaneh <orgads@gmail.com>
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16467
diff --git a/coregrind/m_libcprint.c b/coregrind/m_libcprint.c
index d66c67d..f6ba202 100644
--- a/coregrind/m_libcprint.c
+++ b/coregrind/m_libcprint.c
@@ -526,7 +526,7 @@ void VG_(init_log_xml_sinks)(VgLogTo log_to, VgLogTo xml_to,
break;
case VgLogTo_Socket:
- log_fd = prepare_sink_socket(VG_(clo_xml_fname_unexpanded),
+ xml_fd = prepare_sink_socket(VG_(clo_xml_fname_unexpanded),
&VG_(xml_output_sink), True);
break;
}

View File

@ -2,8 +2,8 @@
Summary: Tool for finding memory management bugs in programs
Name: %{?scl_prefix}valgrind
Version: 3.13.0
Release: 28%{?dist}
Version: 3.14.0
Release: 0.1.GIT%{?dist}
Epoch: 1
License: GPLv2+
URL: http://www.valgrind.org/
@ -100,7 +100,9 @@ Group: Development/Debuggers
# 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}.tar.bz2
# commit 5d41dadeb3cb805546497b350750ca3bee365210
Source0: valgrind-3.14.0.GIT.tar.bz2
# Needs investigation and pushing upstream
Patch1: valgrind-3.9.0-cachegrind-improvements.patch
@ -111,93 +113,6 @@ Patch2: valgrind-3.9.0-helgrind-race-supp.patch
# Make ld.so supressions slightly less specific.
Patch3: valgrind-3.9.0-ldso-supp.patch
# KDE#381272 ppc64 doesn't compile test_isa_2_06_partx.c without VSX support
Patch4: valgrind-3.13.0-ppc64-check-no-vsx.patch
# KDE#381289 epoll_pwait can have a NULL sigmask.
Patch5: valgrind-3.13.0-epoll_pwait.patch
# KDE#381274 powerpc too chatty even with --sigill-diagnostics=no
Patch6: valgrind-3.13.0-ppc64-diag.patch
# KDE#381556 arm64: Handle feature registers access on 4.11 Linux kernel
# Workaround that masks CPUID support in HWCAP on aarch64 (#1464211)
Patch7: valgrind-3.13.0-arm64-hwcap.patch
# RHBZ#1466017 ARM ld.so index warnings.
# KDE#381805 arm32 needs ld.so index hardwire for new glibc security fixes
Patch8: valgrind-3.13.0-arm-index-hardwire.patch
# KDE#381769 Use ucontext_t instead of struct ucontext
Patch9: valgrind-3.13.0-ucontext_t.patch
# valgrind svn r16453 Fix some tests failure with GDB 8.0
Patch10: valgrind-3.13.0-gdb-8-testfix.patch
# valgrind svn r16454. disable vgdb poll in the child after fork
Patch11: valgrind-3.13.0-disable-vgdb-child.patch
# KDE#382998 xml-socket doesn't work
Patch12: valgrind-3.13.0-xml-socket.patch
# KDE#385334
# PPC64, vpermr, xxperm, xxpermr fix Iop_Perm8x16 selector field
# PPC64, revert the change to vperm instruction.
# KDE#385183
# PPC64, Add support for xscmpeqdp, xscmpgtdp, xscmpgedp, xsmincdp instructions
# PPC64, Fix bug in vperm instruction.
# KDE#385210
# PPC64, Re-implement the vpermr instruction using the Iop_Perm8x16.
# KDE#385208
# PPC64, Use the vperm code to implement the xxperm inst.
# PPC64, Replace body of generate_store_FPRF with C helper function.
# PPC64, Add support for the Data Stream Control Register (DSCR)
Patch13: valgrind-3.13.0-ppc64-vex-fixes.patch
# Fix eflags handling in amd64 instruction tests
Patch14: valgrind-3.13.0-amd64-eflags-tests.patch
# KDE#385868 ld.so _dl_runtime_resolve_avx_slow conditional jump warning
Patch15: valgrind-3.13.0-suppress-dl-trampoline-sse-avx.patch
# Implement static TLS code for more platforms
Patch16: valgrind-3.13.0-static-tls.patch
# KDE#386397 PPC64 valgrind truncates powerpc timebase to 32-bits.
Patch17: valgrind-3.13.0-ppc64-timebase.patch
# KDE#387773 - Files in .gnu_debugaltlink should be resolved relative to .debug
Patch18: valgrind-3.13.0-debug-alt-file.patch
# KDE#387712 s390x cgijnl reports Conditional jump depends on uninit value
Patch19: valgrind-3.13.0-s390-cgijnl.patch
# KDE#391164 constraint bug in tests/ppc64/test_isa_2_07_part1.c for mtfprwa
Patch20: valgrind-3.13.0-ppc64-mtfprwa-constraint.patch
# KDE#393062 Reading build-id ELF note "debuginfo reader: ensure_valid failed"
Patch21: valgrind-3.13.0-build-id-phdrs.patch
# KDE#368913 WARNING: unhandled arm64-linux syscall: 117 (ptrace)
Patch22: valgrind-3.13.0-arm64-ptrace.patch
# RHBZ#1600034 KDE#395682
# Accept read-only PT_LOAD segments and .rodata created by ld -z separate-code.
Patch23: valgrind-3.13.0-ld-separate-code.patch
# KDE#396887 arch_prctl should return EINVAL on unknown option
Patch24: valgrind-3.13.0-arch_prctl.patch
# KDE#397012 glibc ld.so uses arch_prctl on i386
Patch25: valgrind-3.13.0-x86-arch_prctl.patch
# KDE#393017 - Add missing support for xsmaxcdp instruction,
# bug fixes for xsmincdp, lxssp, stxssp and stxvl instructions.
Patch26: valgrind-3.13.0-ppc64-xsmaxcdp.patch
# KDE#397354 utimensat should ignore tv_sec for UTIME_NOW or UTIME_OMIT.
Patch27: valgrind-3.13.0-utime.patch
%if %{build_multilib}
# Ensure glibc{,-devel} is installed for both multilib arches
BuildRequires: /lib/libc.so.6 /usr/lib/libc.so /lib64/libc.so.6 /usr/lib64/libc.so
@ -328,35 +243,11 @@ 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
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%build
CC=gcc
@ -591,6 +482,9 @@ fi
%endif
%changelog
* Fri Sep 14 2018 Mark Wielaard <mjw@fedoraproject.org> - 3.14.0-0.1.GIT
- New upstream (pre-)release.
* Fri Aug 10 2018 Mark Wielaard <mjw@fedoraproject.org> - 3.13.0-28
- Add valgrind-3.13.0-utime.patch