3.12.0-0.1-BETA1

- Update to valgrind 3.12.0 pre-release.
  - Drop upstreamed patches.
  - Disable exp-tests in %%check. GDB crashes on gdb_server tests.
This commit is contained in:
Mark Wielaard 2016-09-20 16:35:50 +02:00
parent 177b83dcaa
commit b19c73440d
43 changed files with 21 additions and 18275 deletions

1
.gitignore vendored
View File

@ -23,3 +23,4 @@
/valgrind-3.10.1-svn20150825r15589.tar.bz2
/valgrind-3.11.0.TEST1.tar.bz2
/valgrind-3.11.0.tar.bz2
/valgrind-3.12.0.BETA1.tar.bz2

View File

@ -1 +1 @@
4ea62074da73ae82e0162d6550d3f129 valgrind-3.11.0.tar.bz2
cb91572285f0072861a23ed8531b1829 valgrind-3.12.0.BETA1.tar.bz2

View File

@ -1,49 +0,0 @@
commit 6f472ff11be7fa4a1114b2e3d321609717325311
Author: tom <tom@8f6e269a-dfd6-0310-a8e1-e2731360e62c>
Date: Wed Feb 3 10:14:18 2016 +0000
Handle missing FCOM case on amd64.
Patch from Mark Harris on BZ#212352.
git-svn-id: svn://svn.valgrind.org/vex/trunk@3207 8f6e269a-dfd6-0310-a8e1-e2731360e62c
diff --git a/VEX/priv/guest_amd64_toIR.c b/VEX/priv/guest_amd64_toIR.c
index af4817f..936d16f 100644
--- a/VEX/priv/guest_amd64_toIR.c
+++ b/VEX/priv/guest_amd64_toIR.c
@@ -6401,19 +6401,20 @@ ULong dis_FPU ( /*OUT*/Bool* decode_ok,
fp_do_op_mem_ST_0 ( addr, "mul", dis_buf, Iop_MulF64, True );
break;
-//.. case 2: /* FCOM double-real */
-//.. DIP("fcoml %s\n", dis_buf);
-//.. /* This forces C1 to zero, which isn't right. */
-//.. put_C3210(
-//.. binop( Iop_And32,
-//.. binop(Iop_Shl32,
-//.. binop(Iop_CmpF64,
-//.. get_ST(0),
-//.. loadLE(Ity_F64,mkexpr(addr))),
-//.. mkU8(8)),
-//.. mkU32(0x4500)
-//.. ));
-//.. break;
+ case 2: /* FCOM double-real */
+ DIP("fcoml %s\n", dis_buf);
+ /* This forces C1 to zero, which isn't right. */
+ put_C3210(
+ unop(Iop_32Uto64,
+ binop( Iop_And32,
+ binop(Iop_Shl32,
+ binop(Iop_CmpF64,
+ get_ST(0),
+ loadLE(Ity_F64,mkexpr(addr))),
+ mkU8(8)),
+ mkU32(0x4500)
+ )));
+ break;
case 3: /* FCOMP double-real */
DIP("fcompl %s\n", dis_buf);

View File

@ -1,92 +0,0 @@
commit b39a5966a9e64d343b65d7678e4759aed6860bec
Author: mjw <mjw@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Wed Feb 24 11:12:01 2016 +0000
Bug 359733 amd64 implement ld.so strchr/index override like x86
The suppression and redirection for ld.so strchr/index isn't needed for
x86. When testing a newer glibc or calling the ld.so through an alternative
path neither the suppression (doesn't match path/name) nor the redirection
(triggers too late) works. Since there is already an hardwire override for
strlen in amd64 ld.so anyway it makes sense to also hardware index (it is
always called when ld.so loads the preload images).
This was also explained in the easy hacks Fosdem session.
See https://bugs.kde.org/show_bug.cgi?id=359733 for a pointer.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15812 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_redir.c b/coregrind/m_redir.c
index dcf1fb4..dae47f1 100644
--- a/coregrind/m_redir.c
+++ b/coregrind/m_redir.c
@@ -1353,6 +1353,9 @@ void VG_(redir_initialise) ( void )
if (0==VG_(strcmp)("Memcheck", VG_(details).name)) {
add_hardwired_spec(
+ "ld-linux-x86-64.so.2", "index",
+ (Addr)&VG_(amd64_linux_REDIR_FOR_index), NULL);
+ add_hardwired_spec(
"ld-linux-x86-64.so.2", "strlen",
(Addr)&VG_(amd64_linux_REDIR_FOR_strlen),
# ifndef GLIBC_MANDATORY_STRLEN_REDIRECT
diff --git a/coregrind/m_trampoline.S b/coregrind/m_trampoline.S
index cac2288..176ea66 100644
--- a/coregrind/m_trampoline.S
+++ b/coregrind/m_trampoline.S
@@ -220,6 +220,30 @@ VG_(amd64_linux_REDIR_FOR_strlen):
.LfnE5:
.size VG_(amd64_linux_REDIR_FOR_strlen), .-VG_(amd64_linux_REDIR_FOR_strlen)
+.global VG_(amd64_linux_REDIR_FOR_index)
+.type VG_(amd64_linux_REDIR_FOR_index), @function
+VG_(amd64_linux_REDIR_FOR_index):
+ movzbl (%rdi), %eax
+ movl %esi, %edx
+ cmpb %sil, %al
+ jne .L4
+ jmp .L5
+.L10:
+ addq $1, %rdi
+ movzbl (%rdi), %eax
+ cmpb %dl, %al
+ je .L5
+.L4:
+ testb %al, %al
+ jne .L10
+ xorl %eax, %eax
+ ret
+.L5:
+ movq %rdi, %rax
+ ret
+.size VG_(amd64_linux_REDIR_FOR_index), .-VG_(amd64_linux_REDIR_FOR_index)
+
+
/* A CIE for the above four functions, followed by their FDEs */
.section .eh_frame,"a",@progbits
diff --git a/coregrind/pub_core_trampoline.h b/coregrind/pub_core_trampoline.h
index eda5ec6..1396519 100644
--- a/coregrind/pub_core_trampoline.h
+++ b/coregrind/pub_core_trampoline.h
@@ -71,6 +71,7 @@ extern Addr VG_(amd64_linux_REDIR_FOR_vgettimeofday);
extern Addr VG_(amd64_linux_REDIR_FOR_vtime);
extern Addr VG_(amd64_linux_REDIR_FOR_vgetcpu);
extern UInt VG_(amd64_linux_REDIR_FOR_strlen)( void* );
+extern Char* VG_(amd64_linux_REDIR_FOR_index) ( const Char*, Int );
#endif
#if defined(VGP_ppc32_linux)
diff --git a/shared/vg_replace_strmem.c b/shared/vg_replace_strmem.c
index 005b679..8de085a 100644
--- a/shared/vg_replace_strmem.c
+++ b/shared/vg_replace_strmem.c
@@ -247,7 +247,7 @@ static inline void my_exit ( int x )
STRCHR(VG_Z_LIBC_SONAME, __strchr_sse2)
STRCHR(VG_Z_LIBC_SONAME, __strchr_sse2_no_bsf)
STRCHR(VG_Z_LIBC_SONAME, index)
-# if !defined(VGP_x86_linux)
+# if !defined(VGP_x86_linux) && !defined(VGP_amd64_linux)
STRCHR(VG_Z_LD_LINUX_SO_2, strchr)
STRCHR(VG_Z_LD_LINUX_SO_2, index)
STRCHR(VG_Z_LD_LINUX_X86_64_SO_2, strchr)

View File

@ -1,31 +0,0 @@
commit 4eec8a00bed541842afbed7e1f95551b0c786570
Author: mjw <mjw@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Mon May 30 14:17:25 2016 +0000
Bug #363705 arm64 missing syscall name_to_handle_at and open_by_handle_at
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15887 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c
index 0b78f20..8842765 100644
--- a/coregrind/m_syswrap/syswrap-arm64-linux.c
+++ b/coregrind/m_syswrap/syswrap-arm64-linux.c
@@ -1096,6 +1096,9 @@ static SyscallTableEntry syscall_main_table[] = {
GENXY(__NR_wait4, sys_wait4), // 260
+ LINXY(__NR_name_to_handle_at, sys_name_to_handle_at), // 264
+ LINXY(__NR_open_by_handle_at, sys_open_by_handle_at), // 265
+
LINX_(__NR_syncfs, sys_syncfs), // 267
LINXY(__NR_sendmmsg, sys_sendmmsg), // 269
@@ -1374,8 +1377,6 @@ static SyscallTableEntry syscall_main_table[] = {
//ZZ LINXY(__NR_epoll_create1, sys_epoll_create1), // 357
//ZZ LINXY(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo),// 363
//ZZ
-//ZZ LINXY(__NR_name_to_handle_at, sys_name_to_handle_at),// 370
-//ZZ LINXY(__NR_open_by_handle_at, sys_open_by_handle_at),// 371
//ZZ LINXY(__NR_clock_adjtime, sys_clock_adjtime) // 372
};

View File

@ -1,268 +0,0 @@
commit 8f36c464966045b51a75144ca4c65f354082194f
Author: mjw <mjw@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Tue Mar 15 15:08:01 2016 +0000
Bug #360425 - arm64 unsupported instruction ldpsw tests.
Add tests for ldpsw implementation VEX svn r3212.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15830 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/none/tests/arm64/memory.c b/none/tests/arm64/memory.c
index cbf31fd..91949ac 100644
--- a/none/tests/arm64/memory.c
+++ b/none/tests/arm64/memory.c
@@ -280,6 +280,18 @@ TESTINST2_hide2("ldarb w21, [x22]", AREA_MID, x21,x22,0);
////////////////////////////////////////////////////////////////
printf("STL{R,RH,RB} (entirely MISSING)\n");
+
+////////////////////////////////////////////////////////////////
+// TESTINST2_hide2 allows use of x28 as scratch
+printf("LDPSW (immediate, simm7)\n");
+
+TESTINST2_hide2("ldpsw x21, x28, [x22], #-24 ; add x21,x21,x28", AREA_MID, x21,x22,0);
+TESTINST2_hide2("ldpsw x21, x28, [x22], #-24 ; eor x21,x21,x28", AREA_MID, x21,x22,0);
+TESTINST2_hide2("ldpsw x21, x28, [x22, #-40]! ; add x21,x21,x28", AREA_MID, x21,x22,0);
+TESTINST2_hide2("ldpsw x21, x28, [x22, #-40]! ; eor x21,x21,x28", AREA_MID, x21,x22,0);
+TESTINST2_hide2("ldpsw x21, x28, [x22, #-40] ; add x21,x21,x28", AREA_MID, x21,x22,0);
+TESTINST2_hide2("ldpsw x21, x28, [x22, #-40] ; eor x21,x21,x28", AREA_MID, x21,x22,0);
+
} /* end of test_memory_old() */
@@ -1608,6 +1620,12 @@ MEM_TEST("prfm pstl2strm, [x5,w6,uxtw #3]", 12, 4);
MEM_TEST("prfm pstl3keep, [x5,w6,sxtw #0]", 12, 4);
MEM_TEST("prfm pstl3strm, [x5,w6,sxtw #3]", 12, -4);
+////////////////////////////////////////////////////////////////
+printf("LDPSW (immediate, simm7)\n");
+MEM_TEST("ldpsw x13, x23, [x5], #-24", 0, 0);
+MEM_TEST("ldpsw x13, x23, [x5, #-40]!", 0, 0);
+MEM_TEST("ldpsw x13, x23, [x5, #-40]", 0, 0);
+
} /* end of test_memory2() */
////////////////////////////////////////////////////////////////
diff --git a/none/tests/arm64/memory.stdout.exp b/none/tests/arm64/memory.stdout.exp
index eb6ec3f..be57108 100644
--- a/none/tests/arm64/memory.stdout.exp
+++ b/none/tests/arm64/memory.stdout.exp
@@ -98,6 +98,13 @@ ldar w21, [x22] :: rd 00000000f3f2f1f0 rn (hidden), cin 0, nzcv 00000000
ldarh w21, [x22] :: rd 000000000000f1f0 rn (hidden), cin 0, nzcv 00000000
ldarb w21, [x22] :: rd 00000000000000f0 rn (hidden), cin 0, nzcv 00000000
STL{R,RH,RB} (entirely MISSING)
+LDPSW (immediate, simm7)
+ldpsw x21, x28, [x22], #-24 ; add x21,x21,x28 :: rd ffffffffebe9e7e4 rn (hidden), cin 0, nzcv 00000000
+ldpsw x21, x28, [x22], #-24 ; eor x21,x21,x28 :: rd 0000000004040404 rn (hidden), cin 0, nzcv 00000000
+ldpsw x21, x28, [x22, #-40]! ; add x21,x21,x28 :: rd ffffffff9b999794 rn (hidden), cin 0, nzcv 00000000
+ldpsw x21, x28, [x22, #-40]! ; eor x21,x21,x28 :: rd 0000000004040404 rn (hidden), cin 0, nzcv 00000000
+ldpsw x21, x28, [x22, #-40] ; add x21,x21,x28 :: rd ffffffff9b999794 rn (hidden), cin 0, nzcv 00000000
+ldpsw x21, x28, [x22, #-40] ; eor x21,x21,x28 :: rd 0000000004040404 rn (hidden), cin 0, nzcv 00000000
LDR,STR (immediate, uimm12)ldr x13, [x5, #24] with x5 = middle_of_block+-1, x6=0
[ 0] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
[ 16] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
@@ -26258,3 +26265,94 @@ prfm pstl3strm, [x5,w6,sxtw #3] with x5 = middle_of_block+12, x6=-4
0 x5 (sub, base reg)
0 x6 (sub, index reg)
+LDPSW (immediate, simm7)
+ldpsw x13, x23, [x5], #-24 with x5 = middle_of_block+0, x6=0
+ [ 0] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [ 16] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [ 32] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [ 48] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [ 64] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [ 80] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [ 96] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [112] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [128] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [144] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [160] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [176] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [192] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [208] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [224] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [240] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ 5430cb99daf026bb x13 (xor, xfer intreg #1)
+ 58eb9b702726900d x23 (xor, xfer intreg #2)
+ 0000000000000000 v17.d[0] (xor, xfer vecreg #1)
+ 0000000000000000 v17.d[1] (xor, xfer vecreg #1)
+ 0000000000000000 v18.d[0] (xor, xfer vecreg #2)
+ 0000000000000000 v18.d[1] (xor, xfer vecreg #2)
+ 0000000000000000 v19.d[0] (xor, xfer vecreg #3)
+ 0000000000000000 v19.d[1] (xor, xfer vecreg #3)
+ 0000000000000000 v20.d[0] (xor, xfer vecreg #3)
+ 0000000000000000 v20.d[1] (xor, xfer vecreg #3)
+ -24 x5 (sub, base reg)
+ 0 x6 (sub, index reg)
+
+ldpsw x13, x23, [x5, #-40]! with x5 = middle_of_block+0, x6=0
+ [ 0] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [ 16] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [ 32] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [ 48] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [ 64] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [ 80] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [ 96] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [112] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [128] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [144] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [160] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [176] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [192] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [208] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [224] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [240] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ 7f799c624bfa7f08 x13 (xor, xfer intreg #1)
+ 3e7857cc51fd19f0 x23 (xor, xfer intreg #2)
+ 0000000000000000 v17.d[0] (xor, xfer vecreg #1)
+ 0000000000000000 v17.d[1] (xor, xfer vecreg #1)
+ 0000000000000000 v18.d[0] (xor, xfer vecreg #2)
+ 0000000000000000 v18.d[1] (xor, xfer vecreg #2)
+ 0000000000000000 v19.d[0] (xor, xfer vecreg #3)
+ 0000000000000000 v19.d[1] (xor, xfer vecreg #3)
+ 0000000000000000 v20.d[0] (xor, xfer vecreg #3)
+ 0000000000000000 v20.d[1] (xor, xfer vecreg #3)
+ -40 x5 (sub, base reg)
+ 0 x6 (sub, index reg)
+
+ldpsw x13, x23, [x5, #-40] with x5 = middle_of_block+0, x6=0
+ [ 0] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [ 16] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [ 32] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [ 48] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [ 64] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [ 80] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [ 96] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [112] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [128] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [144] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [160] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [176] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [192] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [208] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [224] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ [240] .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
+ 01ba3febe99768c0 x13 (xor, xfer intreg #1)
+ 1cef424f7c21ff9b x23 (xor, xfer intreg #2)
+ 0000000000000000 v17.d[0] (xor, xfer vecreg #1)
+ 0000000000000000 v17.d[1] (xor, xfer vecreg #1)
+ 0000000000000000 v18.d[0] (xor, xfer vecreg #2)
+ 0000000000000000 v18.d[1] (xor, xfer vecreg #2)
+ 0000000000000000 v19.d[0] (xor, xfer vecreg #3)
+ 0000000000000000 v19.d[1] (xor, xfer vecreg #3)
+ 0000000000000000 v20.d[0] (xor, xfer vecreg #3)
+ 0000000000000000 v20.d[1] (xor, xfer vecreg #3)
+ 0 x5 (sub, base reg)
+ 0 x6 (sub, index reg)
+
commit c10b13cb0ec8b797124d8379b7f932f92341bd4b
Author: sewardj <sewardj@8f6e269a-dfd6-0310-a8e1-e2731360e62c>
Date: Tue Mar 15 14:24:56 2016 +0000
arm64: implement LDPSW. Fixes #360425. Initial patch+investigation by Mark Wielaard.
git-svn-id: svn://svn.valgrind.org/vex/trunk@3212 8f6e269a-dfd6-0310-a8e1-e2731360e62c
diff --git a/VEX/priv/guest_arm64_toIR.c b/VEX/priv/guest_arm64_toIR.c
index 8da9780..d4fe1b8 100644
--- a/VEX/priv/guest_arm64_toIR.c
+++ b/VEX/priv/guest_arm64_toIR.c
@@ -4804,7 +4804,6 @@ Bool dis_ARM64_load_store(/*MB_OUT*/DisResult* dres, UInt insn)
(at-EA)
x0 101 0010 L imm7 Rt2 Rn Rt1 mmP Rt1,Rt2, [Xn|SP, #imm]
*/
-
UInt insn_30_23 = INSN(30,23);
if (insn_30_23 == BITS8(0,1,0,1,0,0,0,1)
|| insn_30_23 == BITS8(0,1,0,1,0,0,1,1)
@@ -4912,6 +4911,87 @@ Bool dis_ARM64_load_store(/*MB_OUT*/DisResult* dres, UInt insn)
}
}
+ /* -------- LDPSW (immediate, simm7) (INT REGS) -------- */
+ /* Does 32 bit transfers which are sign extended to 64 bits.
+ simm7 is scaled by the (single-register) transfer size
+
+ (at-Rn-then-Rn=EA)
+ 01 101 0001 1 imm7 Rt2 Rn Rt1 LDPSW Rt1,Rt2, [Xn|SP], #imm
+
+ (at-EA-then-Rn=EA)
+ 01 101 0011 1 imm7 Rt2 Rn Rt1 LDPSW Rt1,Rt2, [Xn|SP, #imm]!
+
+ (at-EA)
+ 01 101 0010 1 imm7 Rt2 Rn Rt1 LDPSW Rt1,Rt2, [Xn|SP, #imm]
+ */
+ UInt insn_31_22 = INSN(31,22);
+ if (insn_31_22 == BITS10(0,1,1,0,1,0,0,0,1,1)
+ || insn_31_22 == BITS10(0,1,1,0,1,0,0,1,1,1)
+ || insn_31_22 == BITS10(0,1,1,0,1,0,0,1,0,1)) {
+ UInt bWBack = INSN(23,23);
+ UInt rT1 = INSN(4,0);
+ UInt rN = INSN(9,5);
+ UInt rT2 = INSN(14,10);
+ Long simm7 = (Long)sx_to_64(INSN(21,15), 7);
+ if ((bWBack && (rT1 == rN || rT2 == rN) && rN != 31)
+ || (rT1 == rT2)) {
+ /* undecodable; fall through */
+ } else {
+ if (rN == 31) { /* FIXME generate stack alignment check */ }
+
+ // Compute the transfer address TA and the writeback address WA.
+ IRTemp tRN = newTemp(Ity_I64);
+ assign(tRN, getIReg64orSP(rN));
+ IRTemp tEA = newTemp(Ity_I64);
+ simm7 = 4 * simm7;
+ assign(tEA, binop(Iop_Add64, mkexpr(tRN), mkU64(simm7)));
+
+ IRTemp tTA = newTemp(Ity_I64);
+ IRTemp tWA = newTemp(Ity_I64);
+ switch (INSN(24,23)) {
+ case BITS2(0,1):
+ assign(tTA, mkexpr(tRN)); assign(tWA, mkexpr(tEA)); break;
+ case BITS2(1,1):
+ assign(tTA, mkexpr(tEA)); assign(tWA, mkexpr(tEA)); break;
+ case BITS2(1,0):
+ assign(tTA, mkexpr(tEA)); /* tWA is unused */ break;
+ default:
+ vassert(0); /* NOTREACHED */
+ }
+
+ // 32 bit load, sign extended to 64 bits
+ putIReg64orZR(rT1, unop(Iop_32Sto64,
+ loadLE(Ity_I32, binop(Iop_Add64,
+ mkexpr(tTA),
+ mkU64(0)))));
+ putIReg64orZR(rT2, unop(Iop_32Sto64,
+ loadLE(Ity_I32, binop(Iop_Add64,
+ mkexpr(tTA),
+ mkU64(4)))));
+ if (bWBack)
+ putIReg64orSP(rN, mkexpr(tEA));
+
+ const HChar* fmt_str = NULL;
+ switch (INSN(24,23)) {
+ case BITS2(0,1):
+ fmt_str = "ldpsw %s, %s, [%s], #%lld (at-Rn-then-Rn=EA)\n";
+ break;
+ case BITS2(1,1):
+ fmt_str = "ldpsw %s, %s, [%s, #%lld]! (at-EA-then-Rn=EA)\n";
+ break;
+ case BITS2(1,0):
+ fmt_str = "ldpsw %s, %s, [%s, #%lld] (at-Rn)\n";
+ break;
+ default:
+ vassert(0);
+ }
+ DIP(fmt_str, nameIReg64orZR(rT1),
+ nameIReg64orZR(rT2),
+ nameIReg64orSP(rN), simm7);
+ return True;
+ }
+ }
+
/* ---------------- LDR (literal, int reg) ---------------- */
/* 31 29 23 4
00 011 000 imm19 Rt LDR Wt, [PC + sxTo64(imm19 << 2)]

View File

@ -1,55 +0,0 @@
Index: valgrind/none/tests/arm64/memory.c
===================================================================
--- valgrind/none/tests/arm64/memory.c (revision 15827)
+++ valgrind/none/tests/arm64/memory.c (working copy)
@@ -157,18 +157,18 @@
////////////////////////////////////////////////////////////////
// This is a bit tricky. We load the value from just before and
-// just after the actual instruction. Because TESTINSN2_hide2
-// generates two fixed insns either side of the test insn, these
-// should be constant and hence "safe" to check.
+// just after the actual instruction. So we place a couple of
+// nop insns either side of the test insn, these should "safe"
+// to check.
printf("LDR (literal, int reg)\n");
-TESTINST2_hide2("xyzzy00: ldr x21, xyzzy00 - 8", AREA_MID, x21,x22,0);
-TESTINST2_hide2("xyzzy01: ldr x21, xyzzy01 + 0", AREA_MID, x21,x22,0);
-TESTINST2_hide2("xyzzy02: ldr x21, xyzzy02 + 8", AREA_MID, x21,x22,0);
+TESTINST2_hide2("nop; nop; nop; xyzzy00: ldr x21, xyzzy00 - 8; nop; nop; nop", AREA_MID, x21,x22,0);
+TESTINST2_hide2("nop; nop; nop; xyzzy01: ldr x21, xyzzy01 + 0; nop; nop; nop", AREA_MID, x21,x22,0);
+TESTINST2_hide2("nop; nop; nop; xyzzy02: ldr x21, xyzzy02 + 8; nop; nop; nop", AREA_MID, x21,x22,0);
-TESTINST2_hide2("xyzzy03: ldr x21, xyzzy03 - 4", AREA_MID, x21,x22,0);
-TESTINST2_hide2("xyzzy04: ldr x21, xyzzy04 + 0", AREA_MID, x21,x22,0);
-TESTINST2_hide2("xyzzy05: ldr x21, xyzzy05 + 4", AREA_MID, x21,x22,0);
+TESTINST2_hide2("nop; nop; nop; xyzzy03: ldr x21, xyzzy03 - 4; nop; nop; nop", AREA_MID, x21,x22,0);
+TESTINST2_hide2("nop; nop; nop; xyzzy04: ldr x21, xyzzy04 + 0; nop; nop; nop", AREA_MID, x21,x22,0);
+TESTINST2_hide2("nop; nop; nop; xyzzy05: ldr x21, xyzzy05 + 4; nop; nop; nop", AREA_MID, x21,x22,0);
////////////////////////////////////////////////////////////////
printf("{LD,ST}R (integer register) (entirely MISSING)\n");
Index: valgrind/none/tests/arm64/memory.stdout.exp
===================================================================
--- valgrind/none/tests/arm64/memory.stdout.exp (revision 15827)
+++ valgrind/none/tests/arm64/memory.stdout.exp (working copy)
@@ -21,12 +21,12 @@
ldp w21, w28, [x22, #-40] ; add x21,x21,x28 :: rd 000000019b999794 rn (hidden), cin 0, nzcv 00000000
ldp w21, w28, [x22, #-40] ; eor x21,x21,x28 :: rd 0000000004040404 rn (hidden), cin 0, nzcv 00000000
LDR (literal, int reg)
-xyzzy00: ldr x21, xyzzy00 - 8 :: rd aa0003f6d51b4203 rn (hidden), cin 0, nzcv 00000000
-xyzzy01: ldr x21, xyzzy01 + 0 :: rd aa1503e258000015 rn (hidden), cin 0, nzcv 00000000
-xyzzy02: ldr x21, xyzzy02 + 8 :: rd 911e43a0d53b4201 rn (hidden), cin 0, nzcv 00000000
-xyzzy03: ldr x21, xyzzy03 - 4 :: rd 58fffff5aa0003f6 rn (hidden), cin 0, nzcv 00000000
-xyzzy04: ldr x21, xyzzy04 + 0 :: rd aa1503e258000015 rn (hidden), cin 0, nzcv 00000000
-xyzzy05: ldr x21, xyzzy05 + 4 :: rd d53b4201aa1503e2 rn (hidden), cin 0, nzcv 00000000
+nop; nop; nop; xyzzy00: ldr x21, xyzzy00 - 8; nop; nop; nop :: rd d503201fd503201f rn (hidden), cin 0, nzcv 00000000
+nop; nop; nop; xyzzy01: ldr x21, xyzzy01 + 0; nop; nop; nop :: rd d503201f58000015 rn (hidden), cin 0, nzcv 00000000
+nop; nop; nop; xyzzy02: ldr x21, xyzzy02 + 8; nop; nop; nop :: rd d503201fd503201f rn (hidden), cin 0, nzcv 00000000
+nop; nop; nop; xyzzy03: ldr x21, xyzzy03 - 4; nop; nop; nop :: rd 58fffff5d503201f rn (hidden), cin 0, nzcv 00000000
+nop; nop; nop; xyzzy04: ldr x21, xyzzy04 + 0; nop; nop; nop :: rd d503201f58000015 rn (hidden), cin 0, nzcv 00000000
+nop; nop; nop; xyzzy05: ldr x21, xyzzy05 + 4; nop; nop; nop :: rd d503201fd503201f rn (hidden), cin 0, nzcv 00000000
{LD,ST}R (integer register) (entirely MISSING)
LDRS{B,H,W} (uimm12)
ldrsw x21, [x22, #24] :: rd ffffffff8b8a8988 rn (hidden), cin 0, nzcv 00000000

File diff suppressed because it is too large Load Diff

View File

@ -1,28 +0,0 @@
commit b78a32e41a8b5918c706b0ac1b8fbe02fcec854b
Author: mjw <mjw@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Wed Sep 23 12:15:36 2015 +0000
Bug 353084 arm64 doesn't support sigpending system call.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15676 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c
index 6cf3ba5..8d3027d 100644
--- a/coregrind/m_syswrap/syswrap-arm64-linux.c
+++ b/coregrind/m_syswrap/syswrap-arm64-linux.c
@@ -959,6 +959,7 @@ static SyscallTableEntry syscall_main_table[] = {
LINX_(__NR_rt_sigsuspend, sys_rt_sigsuspend), // 133
LINXY(__NR_rt_sigaction, sys_rt_sigaction), // 134
LINXY(__NR_rt_sigprocmask, sys_rt_sigprocmask), // 135
+ LINXY(__NR_rt_sigpending, sys_rt_sigpending), // 136
LINXY(__NR_rt_sigtimedwait, sys_rt_sigtimedwait), // 137
LINXY(__NR_rt_sigqueueinfo, sys_rt_sigqueueinfo), // 138
PLAX_(__NR_rt_sigreturn, sys_rt_sigreturn), // 139
@@ -1231,7 +1232,6 @@ static SyscallTableEntry syscall_main_table[] = {
//ZZ LINXY(__NR_prctl, sys_prctl), // 172
//ZZ LINXY(__NR_rt_sigaction, sys_rt_sigaction), // 174
//ZZ
-//ZZ LINXY(__NR_rt_sigpending, sys_rt_sigpending), // 176
//ZZ LINXY(__NR_rt_sigtimedwait, sys_rt_sigtimedwait),// 177
//ZZ
//ZZ LINX_(__NR_chown, sys_chown16), // 182

View File

@ -1,54 +0,0 @@
commit 9f20263f224cf85a81b16fe1570439cecf5ef48b
Author: mjw <mjw@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Wed Sep 23 11:51:47 2015 +0000
Bug 353083 arm64 doesn't implement various xattr system calls.
This enables setxattr, lsetxattr, fsetxattr, fgetxattr, removexattr,
lremovexattr, fremovexattr, listxattr, llistxattr and flistxattr on
arm64-linux.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15675 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c
index 6661d1d..6cf3ba5 100644
--- a/coregrind/m_syswrap/syswrap-arm64-linux.c
+++ b/coregrind/m_syswrap/syswrap-arm64-linux.c
@@ -855,8 +855,18 @@ PRE(sys_rt_sigreturn)
// (unknown).
static SyscallTableEntry syscall_main_table[] = {
+ LINX_(__NR_setxattr, sys_setxattr), // 5
+ LINX_(__NR_lsetxattr, sys_lsetxattr), // 6
+ LINX_(__NR_fsetxattr, sys_fsetxattr), // 7
LINXY(__NR_getxattr, sys_getxattr), // 8
LINXY(__NR_lgetxattr, sys_lgetxattr), // 9
+ LINXY(__NR_fgetxattr, sys_fgetxattr), // 10
+ LINXY(__NR_listxattr, sys_listxattr), // 11
+ LINXY(__NR_llistxattr, sys_llistxattr), // 12
+ LINXY(__NR_flistxattr, sys_flistxattr), // 13
+ LINX_(__NR_removexattr, sys_removexattr), // 14
+ LINX_(__NR_lremovexattr, sys_lremovexattr), // 15
+ LINX_(__NR_fremovexattr, sys_fremovexattr), // 16
GENXY(__NR_getcwd, sys_getcwd), // 17
LINXY(__NR_eventfd2, sys_eventfd2), // 19
LINXY(__NR_epoll_create1, sys_epoll_create1), // 20
@@ -1267,18 +1277,6 @@ static SyscallTableEntry syscall_main_table[] = {
//ZZ // GENX_(222, sys_ni_syscall), // 222
//ZZ // PLAXY(223, sys_syscall223), // 223 // sys_bproc?
//ZZ
-//ZZ LINX_(__NR_setxattr, sys_setxattr), // 226
-//ZZ LINX_(__NR_lsetxattr, sys_lsetxattr), // 227
-//ZZ LINX_(__NR_fsetxattr, sys_fsetxattr), // 228
-//ZZ
-//ZZ LINXY(__NR_fgetxattr, sys_fgetxattr), // 231
-//ZZ LINXY(__NR_listxattr, sys_listxattr), // 232
-//ZZ LINXY(__NR_llistxattr, sys_llistxattr), // 233
-//ZZ LINXY(__NR_flistxattr, sys_flistxattr), // 234
-//ZZ
-//ZZ LINX_(__NR_removexattr, sys_removexattr), // 235
-//ZZ LINX_(__NR_lremovexattr, sys_lremovexattr), // 236
-//ZZ LINX_(__NR_fremovexattr, sys_fremovexattr), // 237
//ZZ LINXY(__NR_tkill, sys_tkill), // 238 */Linux
//ZZ LINXY(__NR_sendfile64, sys_sendfile64), // 239
//ZZ

View File

@ -1,80 +0,0 @@
commit b28a423827a1c7917c6f3f3eba23b9432077dfbd
Author: florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Sat Jan 16 21:44:31 2016 +0000
In ML_(am_allocate_segname) do not set the reference count of the
slot to 1. Rather do that in add_segment which is where the segment
refering to that name actually comes into existence.
Properly handle the case in add_segment where the to-be-added segment
and one (or more) of the segments it replaces have the same name
This may occur when doing a mremap.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15761 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_aspacemgr/aspacemgr-linux.c b/coregrind/m_aspacemgr/aspacemgr-linux.c
index 0a8f675..f6c1a41 100644
--- a/coregrind/m_aspacemgr/aspacemgr-linux.c
+++ b/coregrind/m_aspacemgr/aspacemgr-linux.c
@@ -1445,6 +1445,15 @@ static void add_segment ( const NSegment* seg )
split_nsegments_lo_and_hi( sStart, sEnd, &iLo, &iHi );
+ /* Increase the reference count of SEG's name. We need to do this
+ *before* decreasing the reference count of the names of the replaced
+ segments. Consider the case where the segment name of SEG and one of
+ the replaced segments are the same. If the refcount of that name is 1,
+ then decrementing first would put the slot for that name on the free
+ list. Attempting to increment the refcount later would then fail
+ because the slot is no longer allocated. */
+ ML_(am_inc_refcount)(seg->fnIdx);
+
/* Now iLo .. iHi inclusive is the range of segment indices which
seg will replace. If we're replacing more than one segment,
slide those above the range down to fill the hole. Before doing
diff --git a/coregrind/m_aspacemgr/aspacemgr-segnames.c b/coregrind/m_aspacemgr/aspacemgr-segnames.c
index ef3d3ef..8e74356 100644
--- a/coregrind/m_aspacemgr/aspacemgr-segnames.c
+++ b/coregrind/m_aspacemgr/aspacemgr-segnames.c
@@ -309,7 +309,7 @@ ML_(am_allocate_segname)(const HChar *name)
freeslot_chain = next_freeslot;
else
put_slotindex(prev, next_freeslot);
- put_refcount(ix, 1);
+ put_refcount(ix, 0);
put_slotsize(ix, size);
VG_(strcpy)(segnames + ix, name);
++num_segnames;
@@ -336,7 +336,7 @@ ML_(am_allocate_segname)(const HChar *name)
/* copy it in */
ix = segnames_used;
- put_refcount(ix, 1);
+ put_refcount(ix, 0);
put_slotsize(ix, len + 1);
VG_(strcpy)(segnames + ix, name);
segnames_used += need;
commit e345eb50c0c5e96ac60b2bc21fbe9f281c20b9e6
Author: florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Sat Jan 16 21:12:57 2016 +0000
Remove code that has no effect. Looks like a leftover from early
debugging days.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15760 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_aspacemgr/aspacemgr-segnames.c b/coregrind/m_aspacemgr/aspacemgr-segnames.c
index 761608d..ef3d3ef 100644
--- a/coregrind/m_aspacemgr/aspacemgr-segnames.c
+++ b/coregrind/m_aspacemgr/aspacemgr-segnames.c
@@ -250,9 +250,7 @@ dec_refcount(UInt ix)
UInt size = get_slotsize(ix);
/* Chain this slot in the freelist */
put_slotindex(ix, freeslot_chain);
- get_slotindex(ix);
put_slotsize(ix + slotsize_size, size);
- get_slotindex(ix);
freeslot_chain = ix;
--num_segnames;
if (0) VG_(am_show_nsegments)(0, "AFTER DECREASE rc -> 0");

View File

@ -1,639 +0,0 @@
commit b5dde4a2ff59cc87390a33d85c7bf0ad6443cb6c
Author: iraisr <iraisr@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Wed Mar 30 17:53:03 2016 +0000
Run __gnu_cxx::__freeres() cleanup function available
from libstdc++ when available, similar to existing __libc_freeres().
New option --run-cxx-freeres=<yes|no> can be used to change whether
this cleanup function is called or not.
Note that __gnu_cxx::__freeres() is currently available
only in gcc 6. It is not yet decided what to do about
libstdc++ from gcc 5.
Tracked under https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69945
for libstdc++.
Fixes BZ#345307 (partially).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15840 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_clientstate.c b/coregrind/m_clientstate.c
index 7cbc7c7..296d658 100644
--- a/coregrind/m_clientstate.c
+++ b/coregrind/m_clientstate.c
@@ -106,9 +106,9 @@ HChar* VG_(name_of_launcher) = NULL;
Int VG_(fd_soft_limit) = -1;
Int VG_(fd_hard_limit) = -1;
-/* Useful addresses extracted from the client */
-/* Where is the __libc_freeres_wrapper routine we made? */
-Addr VG_(client___libc_freeres_wrapper) = 0;
+/* Useful addresses extracted from the client. */
+/* Where is the freeres_wrapper routine we made? */
+Addr VG_(client_freeres_wrapper) = 0;
/* x86-linux only: where is glibc's _dl_sysinfo_int80 function?
Finding it isn't essential, but knowing where it is does sometimes
diff --git a/coregrind/m_main.c b/coregrind/m_main.c
index 54997bd..8cfaf82 100644
--- a/coregrind/m_main.c
+++ b/coregrind/m_main.c
@@ -36,6 +36,7 @@
#include "pub_core_clientstate.h"
#include "pub_core_aspacemgr.h"
#include "pub_core_aspacehl.h"
+#include "pub_core_clreq.h"
#include "pub_core_commandline.h"
#include "pub_core_debuglog.h"
#include "pub_core_errormgr.h"
@@ -176,6 +177,8 @@ static void usage_NORETURN ( Bool debug_help )
" --vgdb-shadow-registers=no|yes let gdb see the shadow registers [no]\n"
" --vgdb-prefix=<prefix> prefix for vgdb FIFOs [%s]\n"
" --run-libc-freeres=no|yes free up glibc memory at exit on Linux? [yes]\n"
+" --run-cxx-freeres=no|yes free up libstdc++ memory at exit on Linux\n"
+" and Solaris? [yes]\n"
" --sim-hints=hint1,hint2,... activate unusual sim behaviours [none] \n"
" where hint is one of:\n"
" lax-ioctls lax-doors fuse-compatible enable-outer\n"
@@ -644,6 +647,7 @@ void main_process_cmd_line_options ( /*OUT*/Bool* logging_to_fd,
else if VG_BOOL_CLO(arg, "--show-emwarns", VG_(clo_show_emwarns)) {}
else if VG_BOOL_CLO(arg, "--run-libc-freeres", VG_(clo_run_libc_freeres)) {}
+ else if VG_BOOL_CLO(arg, "--run-cxx-freeres", VG_(clo_run_cxx_freeres)) {}
else if VG_BOOL_CLO(arg, "--show-below-main", VG_(clo_show_below_main)) {}
else if VG_BOOL_CLO(arg, "--time-stamp", VG_(clo_time_stamp)) {}
else if VG_BOOL_CLO(arg, "--track-fds", VG_(clo_track_fds)) {}
@@ -2560,8 +2564,8 @@ Int valgrind_main ( Int argc, HChar **argv, HChar **envp )
So don't.
The final_tidyup call makes a bit of a nonsense of the ExitProcess
- case, since it will run the libc_freeres function, thus allowing
- other lurking threads to run again. Hmm. */
+ case, since it will run __gnu_cxx::__freeres and libc_freeres functions,
+ thus allowing other lurking threads to run again. Hmm. */
static
void shutdown_actions_NORETURN( ThreadId tid,
@@ -2584,8 +2588,8 @@ void shutdown_actions_NORETURN( ThreadId tid,
// jrs: Huh? but they surely are already gone
VG_(reap_threads)(tid);
- // Clean the client up before the final report
- // this causes the libc_freeres function to run
+ // Clean the client up before the final report.
+ // This causes __gnu_cxx::__freeres and libc_freeres functions to run.
final_tidyup(tid);
/* be paranoid */
@@ -2600,9 +2604,9 @@ void shutdown_actions_NORETURN( ThreadId tid,
// that none of the other threads ever run again.
vg_assert( VG_(count_living_threads)() >= 1 );
- // Clean the client up before the final report
- // this causes the libc_freeres function to run
- // perhaps this is unsafe, as per comment above
+ // Clean the client up before the final report.
+ // This causes __gnu_cxx::__freeres and libc_freeres functions to run.
+ // Perhaps this is unsafe, as per comment above.
final_tidyup(tid);
/* be paranoid */
@@ -2742,63 +2746,141 @@ void shutdown_actions_NORETURN( ThreadId tid,
/* -------------------- */
/* Final clean-up before terminating the process.
- Clean up the client by calling __libc_freeres() (if requested)
- This is Linux-specific?
- GrP fixme glibc-specific, anyway
+ Clean up the client by calling __gnu_cxx::__freeres() (if requested)
+ and __libc_freeres() (if requested).
*/
static void final_tidyup(ThreadId tid)
{
-#if !defined(VGO_darwin)
- Addr __libc_freeres_wrapper = VG_(client___libc_freeres_wrapper);
+#if defined(VGO_linux) || defined(VGO_solaris)
+ Addr freeres_wrapper = VG_(client_freeres_wrapper);
vg_assert(VG_(is_running_thread)(tid));
-
- if ( !VG_(needs).libc_freeres ||
- !VG_(clo_run_libc_freeres) ||
- 0 == __libc_freeres_wrapper )
- return; /* can't/won't do it */
+
+ if (freeres_wrapper == 0) {
+ return; /* can't do it */
+ }
+
+ Vg_FreeresToRun to_run = 0;
+ if (VG_(needs).cxx_freeres && VG_(clo_run_cxx_freeres)) {
+ to_run |= VG_RUN__GNU_CXX__FREERES;
+ }
+
+ if (VG_(needs).libc_freeres && VG_(clo_run_libc_freeres)) {
+ to_run |= VG_RUN__LIBC_FREERES;
+ }
+
+ if (to_run == 0) {
+ return; /* won't do it */
+ }
# if defined(VGP_ppc64be_linux)
- Addr r2 = VG_(get_tocptr)( __libc_freeres_wrapper );
+ Addr r2 = VG_(get_tocptr)(freeres_wrapper);
if (r2 == 0) {
VG_(message)(Vg_UserMsg,
- "Caught __NR_exit, but can't run __libc_freeres()\n");
+ "Caught __NR_exit, but can't run __gnu_cxx::__freeres()\n");
VG_(message)(Vg_UserMsg,
- " since cannot establish TOC pointer for it.\n");
+ " or __libc_freeres() since cannot establish TOC pointer "
+ "for it.\n");
return;
}
# endif
if (VG_(clo_verbosity) > 2 ||
VG_(clo_trace_syscalls) ||
- VG_(clo_trace_sched))
- VG_(message)(Vg_DebugMsg,
- "Caught __NR_exit; running __libc_freeres()\n");
+ VG_(clo_trace_sched)) {
+
+ vg_assert(to_run > 0);
+ vg_assert(to_run <= (VG_RUN__GNU_CXX__FREERES | VG_RUN__LIBC_FREERES));
+
+ const HChar *msgs[] = {"__gnu_cxx::__freeres()", "__libc_freeres()",
+ "__gnu_cxx::__freeres and __libc_freeres()"};
+ VG_(message)(Vg_DebugMsg,
+ "Caught __NR_exit; running %s wrapper\n", msgs[to_run - 1]);
+ }
- /* set thread context to point to libc_freeres_wrapper */
- /* ppc64be-linux note: __libc_freeres_wrapper gives us the real
+ /* set thread context to point to freeres_wrapper */
+ /* ppc64be-linux note: freeres_wrapper gives us the real
function entry point, not a fn descriptor, so can use it
directly. However, we need to set R2 (the toc pointer)
appropriately. */
- VG_(set_IP)(tid, __libc_freeres_wrapper);
+ VG_(set_IP)(tid, freeres_wrapper);
# if defined(VGP_ppc64be_linux)
VG_(threads)[tid].arch.vex.guest_GPR2 = r2;
# elif defined(VGP_ppc64le_linux)
/* setting GPR2 but not really needed, GPR12 is needed */
- VG_(threads)[tid].arch.vex.guest_GPR2 = __libc_freeres_wrapper;
- VG_(threads)[tid].arch.vex.guest_GPR12 = __libc_freeres_wrapper;
+ VG_(threads)[tid].arch.vex.guest_GPR2 = freeres_wrapper;
+ VG_(threads)[tid].arch.vex.guest_GPR12 = freeres_wrapper;
# endif
/* mips-linux note: we need to set t9 */
# if defined(VGP_mips32_linux) || defined(VGP_mips64_linux)
- VG_(threads)[tid].arch.vex.guest_r25 = __libc_freeres_wrapper;
+ VG_(threads)[tid].arch.vex.guest_r25 = freeres_wrapper;
# endif
+ /* Pass a parameter to freeres_wrapper(). */
+# if defined(VGA_x86)
+ Addr sp = VG_(threads)[tid].arch.vex.guest_ESP;
+ sp = sp - sizeof(UWord);
+ *((UWord *) sp) = to_run;
+ VG_TRACK(post_mem_write, Vg_CoreClientReq, tid, sp, sizeof(UWord));
+ VG_(threads)[tid].arch.vex.guest_ESP = sp;
+ VG_TRACK(post_reg_write, Vg_CoreClientReq, tid,
+ offsetof(VexGuestX86State, guest_ESP),
+ sizeof(VG_(threads)[tid].arch.vex.guest_ESP));
+# elif defined(VGA_amd64)
+ VG_(threads)[tid].arch.vex.guest_RDI = to_run;
+ VG_TRACK(post_reg_write, Vg_CoreClientReq, tid,
+ offsetof(VexGuestAMD64State, guest_RDI),
+ sizeof(VG_(threads)[tid].arch.vex.guest_RDI));
+# elif defined(VGA_arm)
+ VG_(threads)[tid].arch.vex.guest_R0 = to_run;
+ VG_TRACK(post_reg_write, Vg_CoreClientReq, tid,
+ offsetof(VexGuestARMState, guest_R0),
+ sizeof(VG_(threads)[tid].arch.vex.guest_R0));
+# elif defined(VGA_arm64)
+ VG_(threads)[tid].arch.vex.guest_X0 = to_run;
+ VG_TRACK(post_reg_write, Vg_CoreClientReq, tid,
+ offsetof(VexGuestARM64State, guest_X0),
+ sizeof(VG_(threads)[tid].arch.vex.guest_X0));
+# elif defined(VGA_mips32)
+ VG_(threads)[tid].arch.vex.guest_r4 = to_run;
+ VG_TRACK(post_reg_write, Vg_CoreClientReq, tid,
+ offsetof(VexGuestMIPS32State, guest_r4),
+ sizeof(VG_(threads)[tid].arch.vex.guest_r4));
+# elif defined(VGA_mips64)
+ VG_(threads)[tid].arch.vex.guest_r4 = to_run;
+ VG_TRACK(post_reg_write, Vg_CoreClientReq, tid,
+ offsetof(VexGuestMIPS64State, guest_r4),
+ sizeof(VG_(threads)[tid].arch.vex.guest_r4));
+# elif defined(VGA_ppc32)
+ VG_(threads)[tid].arch.vex.guest_GPR3 = to_run;
+ VG_TRACK(post_reg_write, Vg_CoreClientReq, tid,
+ offsetof(VexGuestPPC32State, guest_GPR3),
+ sizeof(VG_(threads)[tid].arch.vex.guest_GPR3));
+# elif defined(VGA_ppc64be) || defined(VGA_ppc64le)
+ VG_(threads)[tid].arch.vex.guest_GPR3 = to_run;
+ VG_TRACK(post_reg_write, Vg_CoreClientReq, tid,
+ offsetof(VexGuestPPC64State, guest_GPR3),
+ sizeof(VG_(threads)[tid].arch.vex.guest_GPR3));
+# elif defined(VGA_s390x)
+ VG_(threads)[tid].arch.vex.guest_r2 = to_run;
+ VG_TRACK(post_reg_write, Vg_CoreClientReq, tid,
+ offsetof(VexGuestS390XState, guest_r2),
+ sizeof(VG_(threads)[tid].arch.vex.guest_r2));
+# elif defined(VGA_tilegx)
+ VG_(threads)[tid].arch.vex.guest_r0 = to_run;
+ VG_TRACK(post_reg_write, Vg_CoreClientReq, tid,
+ offsetof(VexGuestTILEGXState, guest_r0),
+ sizeof(VG_(threads)[tid].arch.vex.guest_r0));
+#else
+ I_die_here : architecture missing in m_main.c
+#endif
+
/* Block all blockable signals by copying the real block state into
- the thread's block state*/
+ the thread's block state */
VG_(sigprocmask)(VKI_SIG_BLOCK, NULL, &VG_(threads)[tid].sig_mask);
VG_(threads)[tid].tmp_sig_mask = VG_(threads)[tid].sig_mask;
- /* and restore handlers to default */
+ /* and restore handlers to default. */
VG_(set_default_handler)(VKI_SIGSEGV);
VG_(set_default_handler)(VKI_SIGBUS);
VG_(set_default_handler)(VKI_SIGILL);
@@ -2806,11 +2888,11 @@ static void final_tidyup(ThreadId tid)
// We were exiting, so assert that...
vg_assert(VG_(is_exiting)(tid));
- // ...but now we're not again
+ // ...but now we're not again.
VG_(threads)[tid].exitreason = VgSrc_None;
- // run until client thread exits - ideally with LIBC_FREERES_DONE,
- // but exit/exitgroup/signal will do
+ // Run until client thread exits - ideally with FREERES_DONE,
+ // but exit/exitgroup/signal will do.
VG_(scheduler)(tid);
vg_assert(VG_(is_exiting)(tid));
diff --git a/coregrind/m_options.c b/coregrind/m_options.c
index 7e920e0..83d6018 100644
--- a/coregrind/m_options.c
+++ b/coregrind/m_options.c
@@ -121,6 +121,7 @@ Bool VG_(clo_read_inline_info) = False; // Or should be put it to True by defa
Bool VG_(clo_read_var_info) = False;
XArray *VG_(clo_req_tsyms); // array of strings
Bool VG_(clo_run_libc_freeres) = True;
+Bool VG_(clo_run_cxx_freeres) = True;
Bool VG_(clo_track_fds) = False;
Bool VG_(clo_show_below_main)= False;
Bool VG_(clo_show_emwarns) = False;
diff --git a/coregrind/m_redir.c b/coregrind/m_redir.c
index dae47f1..62cb45a 100644
--- a/coregrind/m_redir.c
+++ b/coregrind/m_redir.c
@@ -49,7 +49,7 @@
#include "pub_core_machine.h" // VG_(fnptr_to_fnentry)
#include "pub_core_aspacemgr.h" // VG_(am_find_nsegment)
#include "pub_core_xarray.h"
-#include "pub_core_clientstate.h" // VG_(client___libc_freeres_wrapper)
+#include "pub_core_clientstate.h" // VG_(client_freeres_wrapper)
#include "pub_core_demangle.h" // VG_(maybe_Z_demangle)
#include "pub_core_libcproc.h" // VG_(libdir)
@@ -1688,7 +1688,7 @@ void handle_maybe_load_notifier( const HChar* soname,
return;
if (VG_(strcmp)(symbol, VG_STRINGIFY(VG_NOTIFY_ON_LOAD(freeres))) == 0)
- VG_(client___libc_freeres_wrapper) = addr;
+ VG_(client_freeres_wrapper) = addr;
else
if (VG_(strcmp)(symbol, VG_STRINGIFY(VG_NOTIFY_ON_LOAD(ifunc_wrapper))) == 0)
iFuncWrapper = addr;
diff --git a/coregrind/m_scheduler/scheduler.c b/coregrind/m_scheduler/scheduler.c
index 1234d56..9aa854d 100644
--- a/coregrind/m_scheduler/scheduler.c
+++ b/coregrind/m_scheduler/scheduler.c
@@ -1744,12 +1744,13 @@ static Bool os_client_request(ThreadId tid, UWord *args)
vg_assert(VG_(is_running_thread)(tid));
switch(args[0]) {
- case VG_USERREQ__LIBC_FREERES_DONE:
+ case VG_USERREQ__FREERES_DONE:
/* This is equivalent to an exit() syscall, but we don't set the
exitcode (since it might already be set) */
if (0 || VG_(clo_trace_syscalls) || VG_(clo_trace_sched))
VG_(message)(Vg_DebugMsg,
- "__libc_freeres() done; really quitting!\n");
+ "__gnu_cxx::__freeres() and __libc_freeres() wrapper "
+ "done; really quitting!\n");
VG_(threads)[tid].exitreason = VgSrc_ExitThread;
break;
diff --git a/coregrind/m_tooliface.c b/coregrind/m_tooliface.c
index 6971a47..38bc7c2 100644
--- a/coregrind/m_tooliface.c
+++ b/coregrind/m_tooliface.c
@@ -88,6 +88,7 @@ VgNeeds VG_(needs) = {
.core_errors = False,
.tool_errors = False,
.libc_freeres = False,
+ .cxx_freeres = False,
.superblock_discards = False,
.command_line_options = False,
.client_requests = False,
@@ -216,6 +217,7 @@ Bool VG_(sanity_check_needs)(const HChar** failmsg)
// These ones don't require any tool-supplied functions
NEEDS(libc_freeres)
+NEEDS(cxx_freeres)
NEEDS(core_errors)
NEEDS(var_info)
diff --git a/coregrind/pub_core_clientstate.h b/coregrind/pub_core_clientstate.h
index 215dfb2..ddd1c09 100644
--- a/coregrind/pub_core_clientstate.h
+++ b/coregrind/pub_core_clientstate.h
@@ -90,9 +90,9 @@ extern HChar* VG_(name_of_launcher);
extern Int VG_(fd_soft_limit);
extern Int VG_(fd_hard_limit);
-/* Useful addresses extracted from the client */
-/* Where is the __libc_freeres_wrapper routine we made? */
-extern Addr VG_(client___libc_freeres_wrapper);
+/* Useful addresses extracted from the client. */
+/* Where is the freeres_wrapper routine we made? */
+extern Addr VG_(client_freeres_wrapper);
/* x86-linux only: where is ld.so's _dl_sysinfo_int80 function?
Finding it isn't essential, but knowing where it is does sometimes
diff --git a/coregrind/pub_core_clreq.h b/coregrind/pub_core_clreq.h
index 45c48c3..ce1493c 100644
--- a/coregrind/pub_core_clreq.h
+++ b/coregrind/pub_core_clreq.h
@@ -41,8 +41,8 @@
// used to be many more internal client requests.
typedef
enum {
- /* Denote the finish of __libc_freeres_wrapper(). Also causes exit. */
- VG_USERREQ__LIBC_FREERES_DONE = 0x3029,
+ /* Denote the finish of freeres_wrapper(). Also causes exit. */
+ VG_USERREQ__FREERES_DONE = 0x3029,
/* Get the tool's malloc-wrapping functions */
VG_USERREQ__GET_MALLOCFUNCS = 0x3030,
@@ -55,6 +55,18 @@ typedef
} Vg_InternalClientRequest;
+
+/* Which freeres functions to run in the freeres_wrapper().
+ It is possible to run both. */
+typedef enum {
+ /* Run __gnu_cxx::__freeres(). */
+ VG_RUN__GNU_CXX__FREERES = 1,
+
+ /* Run __libc_freeres(). */
+ VG_RUN__LIBC_FREERES = 2
+
+} Vg_FreeresToRun;
+
// Function for printing from code within Valgrind, but which runs on the
// sim'd CPU. Must be a function rather than macros so that va_list can
// be used.
diff --git a/coregrind/pub_core_options.h b/coregrind/pub_core_options.h
index 2a45c6b..7a887fc 100644
--- a/coregrind/pub_core_options.h
+++ b/coregrind/pub_core_options.h
@@ -281,6 +281,13 @@ extern Bool VG_(clo_track_fds);
cannot be overridden from the command line. */
extern Bool VG_(clo_run_libc_freeres);
+/* Should we run __gnu_cxx::__freeres at exit for C++ programs?
+ Default: YES. Note this is subservient to VG_(needs).cxx_freeres;
+ if the latter says False, then the setting of VG_(clo_run_cxx_freeres)
+ is ignored. Ie if a tool says no, I don't want this to run, that
+ cannot be overridden from the command line. */
+extern Bool VG_(clo_run_cxx_freeres);
+
/* Should we show VEX emulation warnings? Default: NO */
extern Bool VG_(clo_show_emwarns);
diff --git a/coregrind/pub_core_tooliface.h b/coregrind/pub_core_tooliface.h
index 41da986..83758a8 100644
--- a/coregrind/pub_core_tooliface.h
+++ b/coregrind/pub_core_tooliface.h
@@ -81,6 +81,7 @@ extern VgDetails VG_(details);
typedef
struct {
Bool libc_freeres;
+ Bool cxx_freeres;
Bool core_errors;
Bool tool_errors;
Bool superblock_discards;
diff --git a/coregrind/vg_preloaded.c b/coregrind/vg_preloaded.c
index 2ea7a7a..2f53a7d 100644
--- a/coregrind/vg_preloaded.c
+++ b/coregrind/vg_preloaded.c
@@ -47,29 +47,47 @@
#include "pub_core_debuginfo.h" // Needed for pub_core_redir.h
#include "pub_core_redir.h" // For VG_NOTIFY_ON_LOAD
-#if defined(VGO_linux)
+#if defined(VGO_linux) || defined(VGO_solaris)
/* ---------------------------------------------------------------------
- Hook for running __libc_freeres once the program exits.
+ Hook for running __gnu_cxx::__freeres() and __libc_freeres() once
+ the program exits.
------------------------------------------------------------------ */
-void VG_NOTIFY_ON_LOAD(freeres)( void );
-void VG_NOTIFY_ON_LOAD(freeres)( void )
+void VG_NOTIFY_ON_LOAD(freeres)(Vg_FreeresToRun to_run);
+void VG_NOTIFY_ON_LOAD(freeres)(Vg_FreeresToRun to_run)
{
# if !defined(__UCLIBC__) \
&& !defined(VGPV_arm_linux_android) \
&& !defined(VGPV_x86_linux_android) \
&& !defined(VGPV_mips32_linux_android) \
&& !defined(VGPV_arm64_linux_android)
+
+ /* g++ mangled __gnu_cxx::__freeres yields -> _ZN9__gnu_cxx9__freeresEv */
+ extern void _ZN9__gnu_cxx9__freeresEv(void) __attribute__((weak));
+ if (((to_run & VG_RUN__GNU_CXX__FREERES) != 0) &&
+ (_ZN9__gnu_cxx9__freeresEv != NULL)) {
+ _ZN9__gnu_cxx9__freeresEv();
+ }
+
+# if defined(VGO_linux)
+ /* __libc_freeres() not yet available on Solaris. */
extern void __libc_freeres(void);
- __libc_freeres();
+ if ((to_run & VG_RUN__LIBC_FREERES) != 0) {
+ __libc_freeres();
+ }
# endif
- VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__LIBC_FREERES_DONE,
- 0, 0, 0, 0, 0);
+# endif
+
+ VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__FREERES_DONE, 0, 0, 0, 0, 0);
/*NOTREACHED*/
*(volatile int *)0 = 'x';
}
+#endif // VGO_linux || VGO_solaris
+
+#if defined(VGO_linux)
+
/* ---------------------------------------------------------------------
Wrapper for indirect functions which need to be redirected.
------------------------------------------------------------------ */
diff --git a/docs/xml/manual-core.xml b/docs/xml/manual-core.xml
index 758e2f4..7628836 100644
--- a/docs/xml/manual-core.xml
+++ b/docs/xml/manual-core.xml
@@ -1930,6 +1930,37 @@ need to use them.</para>
</listitem>
</varlistentry>
+ <varlistentry id="opt.run-cxx-freeres" xreflabel="--run-cxx-freeres">
+ <term>
+ <option><![CDATA[--run-cxx-freeres=<yes|no> [default: yes] ]]></option>
+ </term>
+ <listitem>
+ <para>This option is only relevant when running Valgrind on Linux
+ or Solaris C++ programs.</para>
+
+ <para>The GNU Standard C++ library (<function>libstdc++.so</function>),
+ which is used by all C++ programs compiled with g++, may allocate memory
+ for its own uses. Usually it doesn't bother to free that memory when
+ the program ends&mdash;there would be no point, since the kernel reclaims
+ all process resources when a process exits anyway, so it would
+ just slow things down.</para>
+
+ <para>The gcc authors realised that this behaviour causes leak
+ checkers, such as Valgrind, to falsely report leaks in libstdc++, when
+ a leak check is done at exit. In order to avoid this, they
+ provided a routine called <function>__gnu_cxx::__freeres</function>
+ specifically to make libstdc++ release all memory it has allocated.
+ Memcheck therefore tries to run
+ <function>__gnu_cxx::__freeres</function> at exit.</para>
+
+ <para>For the sake of flexibility and unforeseen problems with
+ <function>__gnu_cxx::__freeres</function>, option
+ <option>--run-cxx-freeres=no</option> exists,
+ although at the cost of possibly falsely reporting space leaks in
+ <filename>libstdc++.so</filename>.</para>
+ </listitem>
+ </varlistentry>
+
<varlistentry id="opt.sim-hints" xreflabel="--sim-hints">
<term>
<option><![CDATA[--sim-hints=hint1,hint2,... ]]></option>
diff --git a/exp-dhat/dh_main.c b/exp-dhat/dh_main.c
index e636ccb..3476cd9 100644
--- a/exp-dhat/dh_main.c
+++ b/exp-dhat/dh_main.c
@@ -1358,6 +1358,7 @@ static void dh_pre_clo_init(void)
//zz
// Needs.
VG_(needs_libc_freeres)();
+ VG_(needs_cxx_freeres)();
VG_(needs_command_line_options)(dh_process_cmd_line_option,
dh_print_usage,
dh_print_debug_usage);
diff --git a/include/pub_tool_tooliface.h b/include/pub_tool_tooliface.h
index 8df00b5..f7805e9 100644
--- a/include/pub_tool_tooliface.h
+++ b/include/pub_tool_tooliface.h
@@ -263,6 +263,9 @@ extern void VG_(details_bug_reports_to) ( const HChar* bug_reports_to );
/* Should __libc_freeres() be run? Bugs in it can crash the tool. */
extern void VG_(needs_libc_freeres) ( void );
+/* Should __gnu_cxx::__freeres() be run? Bugs in it can crash the tool. */
+extern void VG_(needs_cxx_freeres) ( void );
+
/* Want to have errors detected by Valgrind's core reported? Includes:
- pthread API errors (many; eg. unlocking a non-locked mutex)
[currently disabled]
diff --git a/massif/ms_main.c b/massif/ms_main.c
index 66f9be9..628a37b 100644
--- a/massif/ms_main.c
+++ b/massif/ms_main.c
@@ -2569,6 +2569,7 @@ static void ms_pre_clo_init(void)
// Needs.
VG_(needs_libc_freeres)();
+ VG_(needs_cxx_freeres)();
VG_(needs_command_line_options)(ms_process_cmd_line_option,
ms_print_usage,
ms_print_debug_usage);
diff --git a/memcheck/mc_main.c b/memcheck/mc_main.c
index 99421f5..5464a06 100644
--- a/memcheck/mc_main.c
+++ b/memcheck/mc_main.c
@@ -7745,6 +7745,7 @@ static void mc_pre_clo_init(void)
MC_(print_extra_suppression_use),
MC_(update_extra_suppression_use));
VG_(needs_libc_freeres) ();
+ VG_(needs_cxx_freeres) ();
VG_(needs_command_line_options)(mc_process_cmd_line_options,
mc_print_usage,
mc_print_debug_usage);
diff --git a/none/tests/cmdline1.stdout.exp b/none/tests/cmdline1.stdout.exp
index cc25a16..0faec69 100644
--- a/none/tests/cmdline1.stdout.exp
+++ b/none/tests/cmdline1.stdout.exp
@@ -90,6 +90,8 @@ usage: valgrind [options] prog-and-args
--vgdb-shadow-registers=no|yes let gdb see the shadow registers [no]
--vgdb-prefix=<prefix> prefix for vgdb FIFOs [.../vgdb-pipe]
--run-libc-freeres=no|yes free up glibc memory at exit on Linux? [yes]
+ --run-cxx-freeres=no|yes free up libstdc++ memory at exit on Linux
+ and Solaris? [yes]
--sim-hints=hint1,hint2,... activate unusual sim behaviours [none]
where hint is one of:
lax-ioctls lax-doors fuse-compatible enable-outer
diff --git a/none/tests/cmdline2.stdout.exp b/none/tests/cmdline2.stdout.exp
index 580fa19..b124f20 100644
--- a/none/tests/cmdline2.stdout.exp
+++ b/none/tests/cmdline2.stdout.exp
@@ -90,6 +90,8 @@ usage: valgrind [options] prog-and-args
--vgdb-shadow-registers=no|yes let gdb see the shadow registers [no]
--vgdb-prefix=<prefix> prefix for vgdb FIFOs [.../vgdb-pipe]
--run-libc-freeres=no|yes free up glibc memory at exit on Linux? [yes]
+ --run-cxx-freeres=no|yes free up libstdc++ memory at exit on Linux
+ and Solaris? [yes]
--sim-hints=hint1,hint2,... activate unusual sim behaviours [none]
where hint is one of:
lax-ioctls lax-doors fuse-compatible enable-outer
commit 315cb2823de2e3006ec454b278a9f9e474520f57
Author: iraisr <iraisr@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Fri Apr 8 21:29:15 2016 +0000
Follow up to bug 345307.
Passing parameter on x86 architecture was wrong in final_tidyup().
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15854 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_main.c b/coregrind/m_main.c
index 8cfaf82..80f347e 100644
--- a/coregrind/m_main.c
+++ b/coregrind/m_main.c
@@ -2819,9 +2819,9 @@ static void final_tidyup(ThreadId tid)
/* Pass a parameter to freeres_wrapper(). */
# if defined(VGA_x86)
Addr sp = VG_(threads)[tid].arch.vex.guest_ESP;
- sp = sp - sizeof(UWord);
*((UWord *) sp) = to_run;
VG_TRACK(post_mem_write, Vg_CoreClientReq, tid, sp, sizeof(UWord));
+ sp = sp - sizeof(UWord);
VG_(threads)[tid].arch.vex.guest_ESP = sp;
VG_TRACK(post_reg_write, Vg_CoreClientReq, tid,
offsetof(VexGuestX86State, guest_ESP),

View File

@ -1,56 +0,0 @@
commit 46809ccf0281e7556e55f50f25ad5c811fad6ba3
Author: philippe <philippe@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Sun Feb 14 22:14:19 2016 +0000
Fix Bug 359133 - m_deduppoolalloc.c:258 (vgPlain_allocEltDedupPA): Assertion 'eltSzB <= ddpa->poolSzB' failed.
When the elt to allocate is bigger than the pool size, allocate
a specific pool only for this element.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15787 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_deduppoolalloc.c b/coregrind/m_deduppoolalloc.c
index 92016d8..f7ebd27 100644
--- a/coregrind/m_deduppoolalloc.c
+++ b/coregrind/m_deduppoolalloc.c
@@ -255,7 +255,6 @@ const void* VG_(allocEltDedupPA) (DedupPoolAlloc *ddpa, SizeT eltSzB,
ht_node *ht_ins;
vg_assert(ddpa);
vg_assert(ddpa->ht_elements);
- vg_assert (eltSzB <= ddpa->poolSzB);
ddpa->nr_alloc_calls++;
@@ -272,15 +271,24 @@ const void* VG_(allocEltDedupPA) (DedupPoolAlloc *ddpa, SizeT eltSzB,
and insert it in the hash table of inserted elements. */
// Add a new pool or grow pool if not enough space in the current pool
- if (UNLIKELY(ddpa->curpool_free == NULL
- || ddpa->curpool_free + eltSzB - 1 > ddpa->curpool_limit)) {
- ddpa_add_new_pool_or_grow (ddpa);
+ if (eltSzB + ddpa->eltAlign > ddpa->poolSzB) {
+ // Element (+eltAlign for worst case) bigger than the pool size
+ // => allocate a specific pool just for this element
+ UChar *newpool = ddpa->alloc_fn (ddpa->cc, eltSzB + ddpa->eltAlign);
+ /* add to our collection of pools */
+ VG_(addToXA)( ddpa->pools, &newpool );
+ elt_ins = ddpa_align (ddpa, newpool);
+ } else {
+ if (UNLIKELY(ddpa->curpool_free == NULL
+ || ddpa->curpool_free + eltSzB - 1 > ddpa->curpool_limit)) {
+ ddpa_add_new_pool_or_grow (ddpa);
+ }
+ elt_ins = ddpa->curpool_free;
+ ddpa->curpool_free = ddpa_align(ddpa, ddpa->curpool_free + eltSzB);
}
- elt_ins = ddpa->curpool_free;
- VG_(memcpy)(elt_ins, elt, eltSzB);
- ddpa->curpool_free = ddpa_align(ddpa, ddpa->curpool_free + eltSzB);
+ VG_(memcpy)(elt_ins, elt, eltSzB);
ht_ins = VG_(allocEltPA) (ddpa->ht_node_pa);
ht_ins->key = ht_elt.key;
ht_ins->eltSzB = eltSzB;

View File

@ -1,72 +0,0 @@
commit ef3ac601dfcd45b2e27bd09b84e85607ebd5183f
Author: bart <bart@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Mon Jan 25 04:27:25 2016 +0000
configure.ac: Port to gcc 5
Apparently gcc 5 behaves as follows:
$ gcc -dumpversion
5
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15773 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/configure.ac b/configure.ac
index e93c882..d621dca 100644
--- a/configure.ac
+++ b/configure.ac
@@ -160,7 +160,7 @@ case "${is_clang}-${gcc_version}" in
icc-1[[3-9]].*)
AC_MSG_RESULT([ok (ICC version ${gcc_version})])
;;
- notclang-[[3-9]].*|notclang-[[1-9][0-9]]*)
+ notclang-[[3-9]]|notclang-[[3-9]].*|notclang-[[1-9][0-9]]*)
AC_MSG_RESULT([ok (${gcc_version})])
;;
clang-2.9|clang-[[3-9]].*|clang-[[1-9][0-9]]*)
diff --git a/drd/tests/std_thread.cpp b/drd/tests/std_thread.cpp
index 9275c3a..6af7455 100644
--- a/drd/tests/std_thread.cpp
+++ b/drd/tests/std_thread.cpp
@@ -21,6 +21,7 @@ int main(int argc, char** argv)
return 0;
}
+#if defined(__GNUC__) && __GNUC__ -0 < 6
//
// From libstdc++-v3/src/c++11/thread.cc
//
@@ -65,3 +66,4 @@ namespace std
}
}
}
+#endif
diff --git a/drd/tests/std_thread2.cpp b/drd/tests/std_thread2.cpp
index 9861c61..7de4f9d 100644
--- a/drd/tests/std_thread2.cpp
+++ b/drd/tests/std_thread2.cpp
@@ -26,6 +26,7 @@ int main(int argc, char** argv)
return 0;
}
+#if defined(__GNUC__) && __GNUC__ -0 < 6
//
// From libstdc++-v3/src/c++11/thread.cc
//
@@ -70,3 +71,4 @@ namespace std
}
}
}
+#endif
--- valgrind-3.11.0.orig/configure 2016-01-25 21:16:13.019563625 +0100
+++ valgrind-3.11.0/configure 2016-01-25 21:17:31.120337140 +0100
@@ -5453,7 +5453,7 @@
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ok (ICC version ${gcc_version})" >&5
$as_echo "ok (ICC version ${gcc_version})" >&6; }
;;
- notclang-[3-9].*|notclang-[1-9][0-9]*)
+ notclang-[3-9]|notclang-[3-9].*|notclang-[1-9][0-9]*)
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ok (${gcc_version})" >&5
$as_echo "ok (${gcc_version})" >&6; }
;;

View File

@ -1,21 +0,0 @@
commit 8c8306308e05e92de228de57e832c85fb976124b
Author: florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Tue Jan 12 14:32:05 2016 +0000
VG_(fclose) ought to close the file, you silly. Fixes BZ #357887.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15755 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_libcprint.c b/coregrind/m_libcprint.c
index 1283de5..ce2c038 100644
--- a/coregrind/m_libcprint.c
+++ b/coregrind/m_libcprint.c
@@ -359,6 +359,7 @@ void VG_(fclose)( VgFile *fp )
if (fp->num_chars)
VG_(write)(fp->fd, fp->buf, fp->num_chars);
+ VG_(close)(fp->fd);
VG_(free)(fp);
}

View File

@ -1,50 +0,0 @@
commit 9a447c6472947bce97e8b90b7f3f97bd7cd9f3ed
Author: mjw <mjw@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Wed Feb 17 20:53:34 2016 +0000
Bug 359201 futex syscall skips argument 5 if op is FUTEX_WAIT_BITSET
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15793 a5019735-40e9-0310-863c-91ae7b9d1cf9
commit f71fd226f26ab49a615d7886ff2aeadc9915c7c1
Author: mjw <mjw@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Thu Feb 18 11:14:47 2016 +0000
Bug 359201 followup. futex skips argument 5 if op is FUTEX_WAIT_BITSET.
The original fix in svn r15793 read argument 6 separately by using PRA6
unconditionally. This is wrong. We need to first check whether a
track_pre_reg_read callback is registered (only memcheck does).
The PRE_REG_READX macro already had this check. Just add the same
before calling PRA6. Thanks to Tom Hughes for noticing. Without this
helgrind/tests/cond_timedwait_test and drd/tests/pth_inconsistent_cond_wait
regtests would fail.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15795 a5019735-40e9-0310-8
diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c
index f796969..f2d1076 100644
--- a/coregrind/m_syswrap/syswrap-linux.c
+++ b/coregrind/m_syswrap/syswrap-linux.c
@@ -1154,13 +1154,17 @@ PRE(sys_futex)
return;
}
if (*(vki_u32 *)ARG1 != ARG3) {
- PRE_REG_READ5(long, "futex",
+ PRE_REG_READ4(long, "futex",
vki_u32 *, futex, int, op, int, val,
- struct timespec *, utime, int, dummy);
+ struct timespec *, utime);
} else {
- PRE_REG_READ6(long, "futex",
+ /* Note argument 5 is unused, but argument 6 is used.
+ So we cannot just PRE_REG_READ6. Read argument 6 separately. */
+ PRE_REG_READ4(long, "futex",
vki_u32 *, futex, int, op, int, val,
- struct timespec *, utime, int, dummy, int, val3);
+ struct timespec *, utime);
+ if (VG_(tdict).track_pre_reg_read)
+ PRA6("futex",int,val3);
}
break;
case VKI_FUTEX_WAKE_BITSET:

View File

@ -1,59 +0,0 @@
commit c4ada110b0de0a56ec41ca0babc4effce4a4fc04
Author: mjw <mjw@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Sun Apr 3 15:24:20 2016 +0000
Update gdbserver_tests filter for newer GDB version.
- Newer gdb say Thread .... hit Breakpoint, we expect just Breakpoint.
- We expect "Program received" instead of "Thread .... received"
- Ordering of ' Thread .... (tid .' might differ between gdb version,
so remove all such lines except the "current" one (starts with '*').
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15844 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/gdbserver_tests/filter_gdb b/gdbserver_tests/filter_gdb
index df9479f..7177720 100755
--- a/gdbserver_tests/filter_gdb
+++ b/gdbserver_tests/filter_gdb
@@ -62,6 +62,10 @@ sed -e '/^\ \ \ \ \.\.\.$/d' |
# gdb might also try to show the "entry value" p=p@entry=0x...
# Some gdb versions don't show the source line:number after switching
# threads in #0 0x........ in do_burn ().
+# Newer gdb say Thread .... hit Breakpoint, we expect just Breakpoint.
+# We expect "Program received" instead of "Thread .... received"
+# Ordering of ' Thread .... (tid .' might differ between gdb version,
+# so remove all such lines except the "current" one (starts with '*').
sed -e '/Remote debugging using/,/vgdb launched process attached/d' \
-e '/filter_gdb BEGIN drop/,/filter_gdb END drop/d' \
-e 's/^\[?1034hReading symbols/Reading symbols/' \
@@ -74,6 +78,8 @@ sed -e '/Remote debugging using/,/vgdb launched process attached/d'
-e '/\[Switching to Thread ....\]/d' \
-e 's/\(\[Switching to thread [1234] (Thread ....)\]\)#0/\1\n#0/' \
-e 's/^\([ \* ] [0-9] Thread .... (tid [0-9] VgTs_WaitSys) 0x........ in\).*$/\1 syscall .../' \
+ -e 's/^Thread .... hit Breakpoint /Breakpoint /' \
+ -e 's/^Thread .... received /Program received /' \
-e 's/#[0-9]\( 0x........ in sleeper_or_burner\)/#.\1/' \
-e 's/\(#0 0x........ in do_burn ()\) at sleepers.c:41/\1/' \
-e '/^Reading symbols from .*\.\.\.done\./d' \
@@ -115,6 +121,7 @@ sed -e '/Remote debugging using/,/vgdb launched process attached/d'
-e 's/\(^Breakpoint 1, tls_ptr (p=0x........\) <tests[0-9+]*>\() at tls.c:55\)/\1\2/' \
-e '/Id Target Id Frame/d' \
-e 's/^\([ \*] [1234] \) *Thread /\1Thread /' \
+ -e 's/^ [0-9] Thread .... (tid [0-9] .*$//' \
-e 's/VgTs_WaitSys) 0x/VgTs_WaitSys) 0x/' \
-e '/Cannot access memory at address 0x......../d' \
-e '/\[New Thread/d' \
diff --git a/gdbserver_tests/nlcontrolc.stdoutB.exp b/gdbserver_tests/nlcontrolc.stdoutB.exp
index a1013ce..e334fd0 100644
--- a/gdbserver_tests/nlcontrolc.stdoutB.exp
+++ b/gdbserver_tests/nlcontrolc.stdoutB.exp
@@ -1,9 +1,6 @@
Continuing.
Program received signal SIGTRAP, Trace/breakpoint trap.
0x........ in syscall ...
- 4 Thread .... (tid 4 VgTs_WaitSys) 0x........ in syscall ...
- 3 Thread .... (tid 3 VgTs_WaitSys) 0x........ in syscall ...
- 2 Thread .... (tid 2 VgTs_WaitSys) 0x........ in syscall ...
* 1 Thread .... (tid 1 VgTs_WaitSys) 0x........ in syscall ...
$1 = 0
$2 = 0

View File

@ -1,21 +0,0 @@
commit 770707cd209a94b9fe19273b68ddb1cb84191399
Author: sewardj <sewardj@8f6e269a-dfd6-0310-a8e1-e2731360e62c>
Date: Mon Mar 21 19:29:20 2016 +0000
Make isZeroU handle the V256 case. Fixes #356393.
git-svn-id: svn://svn.valgrind.org/vex/trunk@3213 8f6e269a-dfd6-0310-a8e1-e2731360e62c
diff --git a/VEX/priv/ir_opt.c b/VEX/priv/ir_opt.c
index 7a7246a..4266823 100644
--- a/VEX/priv/ir_opt.c
+++ b/VEX/priv/ir_opt.c
@@ -1223,6 +1223,7 @@ static Bool isZeroU ( IRExpr* e )
case Ico_U16: return toBool( e->Iex.Const.con->Ico.U16 == 0);
case Ico_U32: return toBool( e->Iex.Const.con->Ico.U32 == 0);
case Ico_U64: return toBool( e->Iex.Const.con->Ico.U64 == 0);
+ case Ico_V256: return toBool( e->Iex.Const.con->Ico.V256 == 0x00000000);
default: vpanic("isZeroU");
}
}

View File

@ -1,254 +0,0 @@
commit 434c7524413a8a47ae40e4b141f5821eabc506b7
Author: iraisr <iraisr@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Fri Dec 4 13:14:10 2015 +0000
Dwarf line info reader now correctly interprets 'is_stmt' register
Line numbers should correctly reflect all instructions belonging to a source line,
regardless of is_stmt value. Previously only instructions covered by
'is_stmt = 1' were attributed to a source line.
Fixes BZ#356044
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15741 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_debuginfo/readdwarf.c b/coregrind/m_debuginfo/readdwarf.c
index 88d49e9..a95bb3d 100644
--- a/coregrind/m_debuginfo/readdwarf.c
+++ b/coregrind/m_debuginfo/readdwarf.c
@@ -91,7 +91,6 @@ typedef struct
ULong li_header_length;
UChar li_min_insn_length;
UChar li_max_ops_per_insn;
- UChar li_default_is_stmt;
Int li_line_base;
UChar li_line_range;
UChar li_opcode_base;
@@ -150,7 +149,6 @@ typedef struct
UInt file;
UInt line;
UInt column;
- Int is_stmt;
Int basic_block;
UChar end_sequence;
} LineSMR;
@@ -230,7 +228,7 @@ ULong read_initial_length_field ( DiCursor p_img, /*OUT*/Bool* is64 )
static LineSMR state_machine_regs;
static
-void reset_state_machine ( Int is_stmt )
+void reset_state_machine ( void )
{
if (0) VG_(printf)("smr.a := %p (reset)\n", NULL );
state_machine_regs.last_address = 0;
@@ -240,7 +238,6 @@ void reset_state_machine ( Int is_stmt )
state_machine_regs.file = 1;
state_machine_regs.line = 1;
state_machine_regs.column = 0;
- state_machine_regs.is_stmt = is_stmt;
state_machine_regs.basic_block = 0;
state_machine_regs.end_sequence = 0;
}
@@ -253,7 +250,7 @@ void reset_state_machine ( Int is_stmt )
static
void process_extended_line_op( struct _DebugInfo* di,
XArray* fndn_ix_xa,
- DiCursor* data, Int is_stmt)
+ DiCursor* data )
{
UInt len = step_leb128U(data);
if (len == 0) {
@@ -275,19 +272,17 @@ void process_extended_line_op( struct _DebugInfo* di,
reset_state_machine below */
state_machine_regs.end_sequence = 1;
- if (state_machine_regs.is_stmt) {
- if (state_machine_regs.last_address) {
- ML_(addLineInfo) (
- di,
- safe_fndn_ix (fndn_ix_xa,
- state_machine_regs.last_file),
- di->text_debug_bias + state_machine_regs.last_address,
- di->text_debug_bias + state_machine_regs.address,
- state_machine_regs.last_line, 0
- );
- }
+ if (state_machine_regs.last_address) {
+ ML_(addLineInfo)(
+ di,
+ safe_fndn_ix(fndn_ix_xa,
+ state_machine_regs.last_file),
+ di->text_debug_bias + state_machine_regs.last_address,
+ di->text_debug_bias + state_machine_regs.address,
+ state_machine_regs.last_line, 0
+ );
}
- reset_state_machine (is_stmt);
+ reset_state_machine();
if (di->ddump_line)
VG_(printf)(" Extended opcode %d: End of Sequence\n\n",
(Int)op_code);
@@ -446,29 +441,9 @@ void read_dwarf2_lineblock ( struct _DebugInfo* di,
info.li_max_ops_per_insn = 1;
}
- info.li_default_is_stmt = ML_(cur_step_UChar)(&external);
- if (di->ddump_line)
- VG_(printf)(" Initial value of 'is_stmt': %d\n",
- (Int)info.li_default_is_stmt);
-
- /* Josef Weidendorfer (20021021) writes:
-
- It seems to me that the Intel Fortran compiler generates bad
- DWARF2 line info code: It sets "is_stmt" of the state machine in
- the line info reader to be always false. Thus, there is never
- a statement boundary generated and therefore never an instruction
- range/line number mapping generated for valgrind.
-
- Please have a look at the DWARF2 specification, Ch. 6.2
- (x86.ddj.com/ftp/manuals/tools/dwarf.pdf). Perhaps I understand
- this wrong, but I don't think so.
-
- I just had a look at the GDB DWARF2 reader... They completely
- ignore "is_stmt" when recording line info ;-) That's the reason
- "objdump -S" works on files from the intel fortran compiler.
-
- Therefore: */
- info.li_default_is_stmt = True;
+ /* Register is_stmt is not tracked as we are interested only
+ in pc -> line info mapping and not other debugger features. */
+ /* default_is_stmt = */ ML_(cur_step_UChar)(&external);
/* JRS: changed (UInt*) to (UChar*) */
info.li_line_base = ML_(cur_step_UChar)(&external);
@@ -495,7 +470,7 @@ void read_dwarf2_lineblock ( struct _DebugInfo* di,
DiCursor end_of_sequence
= ML_(cur_plus)(data, info.li_length + (is64 ? 12 : 4));
- reset_state_machine (info.li_default_is_stmt);
+ reset_state_machine();
/* Read the contents of the Opcodes table. */
DiCursor standard_opcodes = external;
@@ -632,55 +607,49 @@ void read_dwarf2_lineblock ( struct _DebugInfo* di,
(Int)op_code, advAddr, state_machine_regs.address,
(Int)adv, (Int)state_machine_regs.line );
- if (state_machine_regs.is_stmt) {
- /* only add a statement if there was a previous boundary */
- if (state_machine_regs.last_address) {
- ML_(addLineInfo)(
- di,
- safe_fndn_ix (fndn_ix_xa,
- state_machine_regs.last_file),
- di->text_debug_bias + state_machine_regs.last_address,
- di->text_debug_bias + state_machine_regs.address,
- state_machine_regs.last_line,
- 0
- );
- }
- state_machine_regs.last_address = state_machine_regs.address;
- state_machine_regs.last_file = state_machine_regs.file;
- state_machine_regs.last_line = state_machine_regs.line;
+ /* only add a statement if there was a previous boundary */
+ if (state_machine_regs.last_address) {
+ ML_(addLineInfo)(
+ di,
+ safe_fndn_ix(fndn_ix_xa,
+ state_machine_regs.last_file),
+ di->text_debug_bias + state_machine_regs.last_address,
+ di->text_debug_bias + state_machine_regs.address,
+ state_machine_regs.last_line,
+ 0
+ );
}
+ state_machine_regs.last_address = state_machine_regs.address;
+ state_machine_regs.last_file = state_machine_regs.file;
+ state_machine_regs.last_line = state_machine_regs.line;
}
else { /* ! (op_code >= info.li_opcode_base) */
switch (op_code) {
case DW_LNS_extended_op:
- process_extended_line_op (
- di, fndn_ix_xa,
- &data, info.li_default_is_stmt);
+ process_extended_line_op(di, fndn_ix_xa, &data);
break;
case DW_LNS_copy:
if (0) VG_(printf)("1002: di->o %#lx, smr.a %#lx\n",
(UWord)di->text_debug_bias,
state_machine_regs.address );
- if (state_machine_regs.is_stmt) {
- /* only add a statement if there was a previous boundary */
- if (state_machine_regs.last_address) {
- ML_(addLineInfo)(
- di,
- safe_fndn_ix (fndn_ix_xa,
- state_machine_regs.last_file),
- di->text_debug_bias + state_machine_regs.last_address,
- di->text_debug_bias + state_machine_regs.address,
- state_machine_regs.last_line,
- 0
- );
- }
- state_machine_regs.last_address = state_machine_regs.address;
- state_machine_regs.last_file = state_machine_regs.file;
- state_machine_regs.last_line = state_machine_regs.line;
+ /* only add a statement if there was a previous boundary */
+ if (state_machine_regs.last_address) {
+ ML_(addLineInfo)(
+ di,
+ safe_fndn_ix(fndn_ix_xa,
+ state_machine_regs.last_file),
+ di->text_debug_bias + state_machine_regs.last_address,
+ di->text_debug_bias + state_machine_regs.address,
+ state_machine_regs.last_line,
+ 0
+ );
}
+ state_machine_regs.last_address = state_machine_regs.address;
+ state_machine_regs.last_file = state_machine_regs.file;
+ state_machine_regs.last_line = state_machine_regs.line;
state_machine_regs.basic_block = 0; /* JRS added */
if (di->ddump_line)
VG_(printf)(" Copy\n");
@@ -719,9 +688,6 @@ void read_dwarf2_lineblock ( struct _DebugInfo* di,
break;
}
case DW_LNS_negate_stmt: {
- Int adv = state_machine_regs.is_stmt;
- adv = ! adv;
- state_machine_regs.is_stmt = adv;
if (di->ddump_line)
VG_(printf)(" DWARF2-line: negate_stmt\n");
break;
diff --git a/coregrind/m_debuginfo/storage.c b/coregrind/m_debuginfo/storage.c
index 7b2e26a..e6a9856 100644
--- a/coregrind/m_debuginfo/storage.c
+++ b/coregrind/m_debuginfo/storage.c
@@ -419,6 +419,21 @@ static void addLoc ( struct _DebugInfo* di, DiLoc* loc, UInt fndn_ix )
/* Zero-sized locs should have been ignored earlier */
vg_assert(loc->size > 0);
+ /* Check if the last entry has adjacent range for the same line. */
+ if (di->loctab_used > 0) {
+ DiLoc *previous = &di->loctab[di->loctab_used - 1];
+ if ((previous->lineno == loc->lineno)
+ && (previous->addr + previous->size == loc->addr)) {
+ if (0)
+ VG_(printf)("Merging previous: addr %#lx, size %d, line %d, "
+ "with current: addr %#lx, size %d, line %d.\n",
+ previous->addr, previous->size, previous->lineno,
+ loc->addr, loc->size, loc->lineno);
+ previous->size += loc->size;
+ return;
+ }
+ }
+
if (di->loctab_used == di->loctab_size) {
UInt new_sz;
DiLoc* new_loctab;

View File

@ -1,109 +0,0 @@
commit 578a0ec2872203dd4a741f7a445056c80320e2c8
Author: Mark Wielaard <mjw@redhat.com>
Date: Thu Mar 10 21:36:00 2016 +0100
Add libstdc++.supp for still reachable leaks from global memory cache.
Contributed by Björn "besser82" Esser <fedora@besser82.io>.
diff --git a/configure.ac b/configure.ac
index 888a308..01012e1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1060,6 +1060,9 @@ if test "$VGCONF_OS" != "solaris"; then
DEFAULT_SUPP="exp-sgcheck.supp ${DEFAULT_SUPP}"
fi
+# Suppression file for libstdc++ until we solve KDE#345307
+DEFAULT_SUPP="libstdc++.supp ${DEFAULT_SUPP}"
+
#----------------------------------------------------------------------------
# Platform variants?
diff --git a/libstdc++.supp b/libstdc++.supp
new file mode 100644
index 0000000..f04f90d
--- /dev/null
+++ b/libstdc++.supp
@@ -0,0 +1,68 @@
+
+# Some programs are using the C++ STL and string classes.
+# Valgrind reports 'still reachable' memory leaks involving these classes
+# at the exit of the program, but there should be none.
+#
+# Many implementations of the C++ standard libraries use their own memory
+# pool allocators. Memory for quite a number of destructed objects is not
+# immediately freed and given back to the OS, but kept in the pool(s) for
+# later re-use. The fact that the pools are not freed at the exit of the
+# program cause Valgrind to report this memory as still reachable.
+#
+# The behavior not to free pools at the exit could be called a bug of the
+# library though.
+#
+# Using GCC, you can force the STL to use malloc and to free memory as soon
+# as possible by globally disabling memory caching. Beware! Doing so will
+# probably slow down your program, sometimes drastically.
+#
+# There are other ways to disable memory pooling: using the malloc_alloc
+# template with your objects (not portable, but should work for GCC) or
+# even writing your own memory allocators. But beware: allocators belong
+# to the more messy parts of the STL and people went to great lengths to
+# make the STL portable across platforms. Chances are good that your
+# solution will work on your platform, but not on others.
+#
+# 72,704 bytes in 1 blocks are still reachable in loss record 1 of 1
+# at 0x4C28D06: malloc (vg_replace_malloc.c:299)
+# by 0x50C317F: ??? (in /usr/lib64/libstdc++.so.6.0.21)
+# by 0x400F759: call_init.part.0 (dl-init.c:72)
+# by 0x400F86A: call_init (dl-init.c:30)
+# by 0x400F86A: _dl_init (dl-init.c:120)
+# by 0x4000CB9: ??? (in /usr/lib64/ld-2.22.so)
+#
+# HEAP SUMMARY:
+# in use at exit: 72,704 bytes in 1 blocks
+# total heap usage: 4 allocs, 3 frees, 72,864 bytes allocated
+#
+# LEAK SUMMARY:
+# definitely lost: 0 bytes in 0 blocks
+# indirectly lost: 0 bytes in 0 blocks
+# possibly lost: 0 bytes in 0 blocks
+# still reachable: 72,704 bytes in 1 blocks
+# suppressed: 0 bytes in 0 blocks
+
+{
+ malloc-leaks-cxx-stl-string-classes
+ Memcheck:Leak
+ match-leak-kinds: reachable
+ fun:malloc
+ obj:*/*lib*/libstdc++.so*
+ fun:call_init.part.0
+ fun:call_init
+ fun:_dl_init
+ obj:/usr/*lib*/ld-2.*.so
+}
+{
+ malloc-leaks-cxx-stl-string-classes-debug
+ Memcheck:Leak
+ match-leak-kinds: reachable
+ fun:malloc
+ fun:pool
+ fun:__static_initialization_and_destruction_0
+ fun:_GLOBAL__sub_I_eh_alloc.cc
+ fun:call_init.part.0
+ fun:call_init
+ fun:_dl_init
+ obj:/usr/*lib*/ld-2.*.so
+}
diff -ru valgrind-3.11.0.orig/configure valgrind-3.11.0/configure
--- valgrind-3.11.0.orig/configure 2016-03-10 22:08:46.236519482 +0100
+++ valgrind-3.11.0/configure 2016-03-10 22:09:01.550443864 +0100
@@ -7073,6 +7073,9 @@
DEFAULT_SUPP="exp-sgcheck.supp ${DEFAULT_SUPP}"
fi
+# Suppression file for libstdc++ until we solve KDE#345307
+DEFAULT_SUPP="libstdc++.supp ${DEFAULT_SUPP}"
+
#----------------------------------------------------------------------------
# Platform variants?

View File

@ -1,26 +0,0 @@
commit 1ab61656f71e94ce12b68de87f1e28cf3dc0c18c
Author: mjw <mjw@8f6e269a-dfd6-0310-a8e1-e2731360e62c>
Date: Thu Oct 1 12:31:19 2015 +0000
Don't advertise RDRAND in cpuid for Core-i7-4910-like avx2 machine.
Bug#353370. In amd64g_dirtyhelper_CPUID_avx2 we set the RDRAND bit
but we don't implement support for RDRAND. Turn the bit off so programs
don't try to use RDRAND when running under valgrind.
git-svn-id: svn://svn.valgrind.org/vex/trunk@3197 8f6e269a-dfd6-0310-a8e1-e2731360e62c
diff --git a/VEX/priv/guest_amd64_helpers.c b/VEX/priv/guest_amd64_helpers.c
index e77d753..ab53e15 100644
--- a/VEX/priv/guest_amd64_helpers.c
+++ b/VEX/priv/guest_amd64_helpers.c
@@ -3101,7 +3101,8 @@ void amd64g_dirtyhelper_CPUID_avx2 ( VexGuestAMD64State* st )
SET_ABCD(0x0000000d, 0x756e6547, 0x6c65746e, 0x49656e69);
break;
case 0x00000001:
- SET_ABCD(0x000306c3, 0x02100800, 0x7ffafbff, 0xbfebfbff);
+ /* Don't advertise RDRAND support, bit 30 in ECX. */
+ SET_ABCD(0x000306c3, 0x02100800, 0x3ffafbff, 0xbfebfbff);
break;
case 0x00000002:
SET_ABCD(0x76036301, 0x00f0b6ff, 0x00000000, 0x00c10000);

View File

@ -1,350 +0,0 @@
commit b4ead6dd41c3234b491c803fe513580363f38998
Author: sewardj <sewardj@8f6e269a-dfd6-0310-a8e1-e2731360e62c>
Date: Wed Jul 20 16:35:55 2016 +0000
Enable PCMPxSTRx cases 0x70 and 0x19. Fixes #359952.
git-svn-id: svn://svn.valgrind.org/vex/trunk@3228 8f6e269a-dfd6-0310-a8e1-e2731360e62c
diff --git a/VEX/priv/guest_amd64_toIR.c b/VEX/priv/guest_amd64_toIR.c
index 936d16f..4c9a122 100644
--- a/VEX/priv/guest_amd64_toIR.c
+++ b/VEX/priv/guest_amd64_toIR.c
@@ -18671,10 +18671,11 @@ static Long dis_PCMPxSTRx ( const VexAbiInfo* vbi, Prefix pfx,
case 0x12: case 0x14: case 0x18: case 0x1A:
case 0x30: case 0x34: case 0x38: case 0x3A:
case 0x40: case 0x42: case 0x44: case 0x46: case 0x4A:
+ case 0x70:
break;
// the 16-bit character versions of the above
case 0x01: case 0x03: case 0x09: case 0x0B: case 0x0D:
- case 0x13: case 0x1B:
+ case 0x13: case 0x19: case 0x1B:
case 0x39: case 0x3B:
case 0x45: case 0x4B:
break;
diff --git a/VEX/priv/guest_generic_x87.c b/VEX/priv/guest_generic_x87.c
index 2c9b25b..9a3c603 100644
--- a/VEX/priv/guest_generic_x87.c
+++ b/VEX/priv/guest_generic_x87.c
@@ -799,6 +799,7 @@ Bool compute_PCMPxSTRx ( /*OUT*/V128* resV,
case 0x12: case 0x14: case 0x18: case 0x1A:
case 0x30: case 0x34: case 0x38: case 0x3A:
case 0x40: case 0x42: case 0x44: case 0x46: case 0x4A:
+ case 0x70:
break;
default:
return False;
@@ -1047,7 +1048,7 @@ Bool compute_PCMPxSTRx_wide ( /*OUT*/V128* resV,
unvalidated cases in the code base. */
switch (imm8) {
case 0x01: case 0x03: case 0x09: case 0x0B: case 0x0D:
- case 0x13: case 0x1B:
+ case 0x13: case 0x19: case 0x1B:
case 0x39: case 0x3B:
case 0x45: case 0x4B:
break;
commit b5ca153e38556e9e4bef0a79c99e3ab6a7e47056
Author: sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Wed Jul 20 16:37:09 2016 +0000
Add test cases for PCMPxSTRx cases 0x70 and 0x19. Pertains to #359952.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15910 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/none/tests/amd64/pcmpstr64.c b/none/tests/amd64/pcmpstr64.c
index 0694012..2b48c72 100644
--- a/none/tests/amd64/pcmpstr64.c
+++ b/none/tests/amd64/pcmpstr64.c
@@ -207,6 +207,7 @@ Bool pcmpXstrX_WRK ( /*OUT*/V128* resV,
case 0x12: case 0x14: case 0x18: case 0x1A:
case 0x30: case 0x34: case 0x38: case 0x3A:
case 0x40: case 0x42: case 0x44: case 0x46: case 0x4A:
+ case 0x70:
break;
default:
return False;
@@ -1971,6 +1972,86 @@ void istri_14 ( void )
//////////////////////////////////////////////////////////
// //
+// ISTRI_70 //
+// //
+//////////////////////////////////////////////////////////
+
+UInt h_pcmpistri_70 ( V128* argL, V128* argR )
+{
+ V128 block[2];
+ memcpy(&block[0], argL, sizeof(V128));
+ memcpy(&block[1], argR, sizeof(V128));
+ ULong res, flags;
+ __asm__ __volatile__(
+ "subq $1024, %%rsp" "\n\t"
+ "movdqu 0(%2), %%xmm2" "\n\t"
+ "movdqu 16(%2), %%xmm11" "\n\t"
+ "pcmpistri $0x70, %%xmm2, %%xmm11" "\n\t"
+ "pushfq" "\n\t"
+ "popq %%rdx" "\n\t"
+ "movq %%rcx, %0" "\n\t"
+ "movq %%rdx, %1" "\n\t"
+ "addq $1024, %%rsp" "\n\t"
+ : /*out*/ "=r"(res), "=r"(flags) : "r"/*in*/(&block[0])
+ : "rcx","rdx","xmm0","xmm2","xmm11","cc","memory"
+ );
+ return ((flags & 0x8D5) << 16) | (res & 0xFFFF);
+}
+
+UInt s_pcmpistri_70 ( V128* argLU, V128* argRU )
+{
+ V128 resV;
+ UInt resOSZACP, resECX;
+ Bool ok
+ = pcmpXstrX_WRK( &resV, &resOSZACP, argLU, argRU,
+ zmask_from_V128(argLU),
+ zmask_from_V128(argRU),
+ 0x70, False/*!isSTRM*/
+ );
+ assert(ok);
+ resECX = resV.uInt[0];
+ return (resOSZACP << 16) | resECX;
+}
+
+void istri_70 ( void )
+{
+ char* wot = "70";
+ UInt(*h)(V128*,V128*) = h_pcmpistri_70;
+ UInt(*s)(V128*,V128*) = s_pcmpistri_70;
+
+ try_istri(wot,h,s, "abcdacbdabcdabcd", "000000000000000a");
+ try_istri(wot,h,s, "abcdabcdabcdabcd", "000000000000000b");
+ try_istri(wot,h,s, "abcdabcdabcdabcd", "00000000000000ab");
+ try_istri(wot,h,s, "abcdabc0abcdabcd", "000000000000abcd");
+
+ try_istri(wot,h,s, "abcdabcdabcdabcd", "000000000000abcd");
+ try_istri(wot,h,s, "0bcdabcdabcdabcd", "000000000000abcd");
+ try_istri(wot,h,s, "abcdabcdabcda0cd", "000000000000abcd");
+ try_istri(wot,h,s, "abcdabcdabcdab0d", "000000000000abcd");
+ try_istri(wot,h,s, "abcdabcdabcdabc0", "000000000000abcd");
+
+ try_istri(wot,h,s, "abcdabcdabcdabcd", "000000000000abcd");
+ try_istri(wot,h,s, "abcdabcdabcdabcd", "000000000000a0cd");
+ try_istri(wot,h,s, "abcdabcdabcdabcd", "000000000000ab0d");
+ try_istri(wot,h,s, "abcdabcdabcdabcd", "000000000000abc0");
+
+ try_istri(wot,h,s, "0000000000000000", "0000000000000000");
+ try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
+
+ try_istri(wot,h,s, "0000abcdabcdabcd", "000000000000abcd");
+ try_istri(wot,h,s, "0000abcdabcdabcd", "000000000000dcba");
+ try_istri(wot,h,s, "0000abcdabcdabcd", "000000000000bbbb");
+ try_istri(wot,h,s, "0000abcdabcdabcd", "000000000000baba");
+
+ try_istri(wot,h,s, "0000abcdabcdabcd", "00000000000baba0");
+
+ try_istri(wot,h,s, "0ddc0ffeebadf00d", "00000000cafebabe");
+ try_istri(wot,h,s, "0ddc0ffeebadfeed", "00000000cafebabe");
+}
+
+
+//////////////////////////////////////////////////////////
+// //
// main //
// //
//////////////////////////////////////////////////////////
@@ -1995,5 +2076,6 @@ int main ( void )
istri_0E();
istri_14();
istri_34();
+ istri_70();
return 0;
}
diff --git a/none/tests/amd64/pcmpstr64.stdout.exp b/none/tests/amd64/pcmpstr64.stdout.exp
index 4921586..55d7fe0 100644
--- a/none/tests/amd64/pcmpstr64.stdout.exp
+++ b/none/tests/amd64/pcmpstr64.stdout.exp
@@ -458,3 +458,25 @@ istri 34 163887ec041a9b72 fcd75adb9b3e895a -> 08410000 08410000
istri 34 fc937cbfbf53f8e2 0d136bcb024d3fb7 -> 08810000 08810000
istri 34 2ca34182c29a82ab 302ebd646775ab54 -> 08810000 08810000
istri 34 3f2987608c11be6f a9ecb661f8e0a8cb -> 08c10000 08c10000
+istri 70 abcdacbdabcdabcd 000000000000000a -> 0881000e 0881000e
+istri 70 abcdabcdabcdabcd 000000000000000b -> 0881000f 0881000f
+istri 70 abcdabcdabcdabcd 00000000000000ab -> 0881000d 0881000d
+istri 70 abcdabc0abcdabcd 000000000000abcd -> 00c00010 00c00010
+istri 70 abcdabcdabcdabcd 000000000000abcd -> 00800010 00800010
+istri 70 0bcdabcdabcdabcd 000000000000abcd -> 00c00010 00c00010
+istri 70 abcdabcdabcda0cd 000000000000abcd -> 00c00010 00c00010
+istri 70 abcdabcdabcdab0d 000000000000abcd -> 00c00010 00c00010
+istri 70 abcdabcdabcdabc0 000000000000abcd -> 00c00010 00c00010
+istri 70 abcdabcdabcdabcd 000000000000abcd -> 00800010 00800010
+istri 70 abcdabcdabcdabcd 000000000000a0cd -> 0081000f 0081000f
+istri 70 abcdabcdabcdabcd 000000000000ab0d -> 0081000f 0081000f
+istri 70 abcdabcdabcdabcd 000000000000abc0 -> 0881000f 0881000f
+istri 70 0000000000000000 0000000000000000 -> 00c00010 00c00010
+istri 70 aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaa -> 00000010 00000010
+istri 70 0000abcdabcdabcd 000000000000abcd -> 00c00010 00c00010
+istri 70 0000abcdabcdabcd 000000000000dcba -> 00c00010 00c00010
+istri 70 0000abcdabcdabcd 000000000000bbbb -> 08c1000b 08c1000b
+istri 70 0000abcdabcdabcd 000000000000baba -> 08c10009 08c10009
+istri 70 0000abcdabcdabcd 00000000000baba0 -> 08c1000b 08c1000b
+istri 70 0ddc0ffeebadf00d 00000000cafebabe -> 08c10000 08c10000
+istri 70 0ddc0ffeebadfeed 00000000cafebabe -> 08c10004 08c10004
diff --git a/none/tests/amd64/pcmpstr64w.c b/none/tests/amd64/pcmpstr64w.c
index 858cfd8..6a1adad 100644
--- a/none/tests/amd64/pcmpstr64w.c
+++ b/none/tests/amd64/pcmpstr64w.c
@@ -209,7 +209,7 @@ Bool pcmpXstrX_WRK_wide ( /*OUT*/V128* resV,
unvalidated cases in the code base. */
switch (imm8) {
case 0x01: case 0x03: case 0x09: case 0x0B: case 0x0D:
- case 0x13: case 0x1B:
+ case 0x13: case 0x19: case 0x1B:
case 0x39: case 0x3B:
case 0x45: case 0x4B:
break;
@@ -1255,6 +1255,99 @@ void istri_39 ( void )
//////////////////////////////////////////////////////////
// //
+// ISTRI_19 //
+// //
+//////////////////////////////////////////////////////////
+
+UInt h_pcmpistri_19 ( V128* argL, V128* argR )
+{
+ V128 block[2];
+ memcpy(&block[0], argL, sizeof(V128));
+ memcpy(&block[1], argR, sizeof(V128));
+ ULong res, flags;
+ __asm__ __volatile__(
+ "subq $1024, %%rsp" "\n\t"
+ "movdqu 0(%2), %%xmm2" "\n\t"
+ "movdqu 16(%2), %%xmm11" "\n\t"
+ "pcmpistri $0x19, %%xmm2, %%xmm11" "\n\t"
+ "pushfq" "\n\t"
+ "popq %%rdx" "\n\t"
+ "movq %%rcx, %0" "\n\t"
+ "movq %%rdx, %1" "\n\t"
+ "addq $1024, %%rsp" "\n\t"
+ : /*out*/ "=r"(res), "=r"(flags) : "r"/*in*/(&block[0])
+ : "rcx","rdx","xmm0","xmm2","xmm11","cc","memory"
+ );
+ return ((flags & 0x8D5) << 16) | (res & 0xFFFF);
+}
+
+UInt s_pcmpistri_19 ( V128* argLU, V128* argRU )
+{
+ V128 resV;
+ UInt resOSZACP, resECX;
+ Bool ok
+ = pcmpXstrX_WRK_wide( &resV, &resOSZACP, argLU, argRU,
+ zmask_from_V128(argLU),
+ zmask_from_V128(argRU),
+ 0x19, False/*!isSTRM*/
+ );
+ assert(ok);
+ resECX = resV.uInt[0];
+ return (resOSZACP << 16) | resECX;
+}
+
+void istri_19 ( void )
+{
+ char* wot = "19";
+ UInt(*h)(V128*,V128*) = h_pcmpistri_19;
+ UInt(*s)(V128*,V128*) = s_pcmpistri_19;
+
+ try_istri(wot,h,s, "0000000000000000", "0000000000000000");
+
+ try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
+ try_istri(wot,h,s, "aaaa2aaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
+ try_istri(wot,h,s, "aaaaaaaaa2aaaaaa", "aaaaaaaaaaaaaaaa");
+ try_istri(wot,h,s, "aaaaaaaaaaaaa2aa", "aaaaaaaaaaaaaaaa");
+
+ try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaa2aaaaaaaaaaa");
+ try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaa2aaaaaa");
+ try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaa2a");
+
+ try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
+ try_istri(wot,h,s, "baaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
+ try_istri(wot,h,s, "b9aaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
+ try_istri(wot,h,s, "b9baaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
+
+ try_istri(wot,h,s, "b9baaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
+ try_istri(wot,h,s, "b9baaaaaaaaaaaaa", "aaaaaaaaaaaa7aaa");
+ try_istri(wot,h,s, "b9baaaaaaaaaaaaa", "aaaaaaaa2aaa4aaa");
+
+ try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
+
+ try_istri(wot,h,s, "aaaaaaaaaaaa00aa", "aaaaaaaaaaaaaaaa");
+ try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaa00aa");
+ try_istri(wot,h,s, "aaaaaaaaaaaa00aa", "aaaaaaaaaaaa00aa");
+
+ try_istri(wot,h,s, "aaaaaaaa00aaaaaa", "aaaaaaaaaaaaaaaa");
+ try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaa00aa");
+ try_istri(wot,h,s, "aaaaaaaa00aaaaaa", "aaaaaaaaaaaa00aa");
+
+ try_istri(wot,h,s, "aaaaaaaaaaaa00aa", "aaaaaaaaaaaaaaaa");
+ try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaa00aaaaaa");
+ try_istri(wot,h,s, "aaaaaaaaaaaa00aa", "aaaaaaaa00aaaaaa");
+
+ try_istri(wot,h,s, "0000000000000000", "aaaaaaaa00aaaaaa");
+ try_istri(wot,h,s, "8000000000000000", "aaaaaaaa00aaaaaa");
+ try_istri(wot,h,s, "0000000000000001", "aaaaaaaa00aaaaaa");
+
+ try_istri(wot,h,s, "0000000000000000", "aaaaaaaaaaaaaaaa");
+ try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "0000000000000000");
+}
+
+
+
+//////////////////////////////////////////////////////////
+// //
// main //
// //
//////////////////////////////////////////////////////////
@@ -1271,5 +1364,6 @@ int main ( void )
istri_45();
istri_01();
istri_39();
+ istri_19();
return 0;
}
diff --git a/none/tests/amd64/pcmpstr64w.stdout.exp b/none/tests/amd64/pcmpstr64w.stdout.exp
index 77d555d..c18184c 100644
--- a/none/tests/amd64/pcmpstr64w.stdout.exp
+++ b/none/tests/amd64/pcmpstr64w.stdout.exp
@@ -258,3 +258,33 @@ istri 39 8000000000000000 aaaaaaaa00aaaaaa -> 00c10003 00c10003
istri 39 0000000000000001 aaaaaaaa00aaaaaa -> 08c10000 08c10000
istri 39 0000000000000000 aaaaaaaaaaaaaaaa -> 00400008 00400008
istri 39 aaaaaaaaaaaaaaaa 0000000000000000 -> 08810000 08810000
+istri 19 0000000000000000 0000000000000000 -> 00c00008 00c00008
+istri 19 aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaa -> 00000008 00000008
+istri 19 aaaa2aaaaaaaaaaa aaaaaaaaaaaaaaaa -> 00010005 00010005
+istri 19 aaaaaaaaa2aaaaaa aaaaaaaaaaaaaaaa -> 00010003 00010003
+istri 19 aaaaaaaaaaaaa2aa aaaaaaaaaaaaaaaa -> 00010001 00010001
+istri 19 aaaaaaaaaaaaaaaa aaaa2aaaaaaaaaaa -> 00010005 00010005
+istri 19 aaaaaaaaaaaaaaaa aaaaaaaaa2aaaaaa -> 00010003 00010003
+istri 19 aaaaaaaaaaaaaaaa aaaaaaaaaaaaaa2a -> 08010000 08010000
+istri 19 aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaa -> 00000008 00000008
+istri 19 baaaaaaaaaaaaaaa aaaaaaaaaaaaaaaa -> 00010007 00010007
+istri 19 b9aaaaaaaaaaaaaa aaaaaaaaaaaaaaaa -> 00010007 00010007
+istri 19 b9baaaaaaaaaaaaa aaaaaaaaaaaaaaaa -> 00010006 00010006
+istri 19 b9baaaaaaaaaaaaa aaaaaaaaaaaaaaaa -> 00010006 00010006
+istri 19 b9baaaaaaaaaaaaa aaaaaaaaaaaa7aaa -> 00010001 00010001
+istri 19 b9baaaaaaaaaaaaa aaaaaaaa2aaa4aaa -> 00010001 00010001
+istri 19 aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaa -> 00000008 00000008
+istri 19 aaaaaaaaaaaa00aa aaaaaaaaaaaaaaaa -> 00410001 00410001
+istri 19 aaaaaaaaaaaaaaaa aaaaaaaaaaaa00aa -> 00810001 00810001
+istri 19 aaaaaaaaaaaa00aa aaaaaaaaaaaa00aa -> 00c00008 00c00008
+istri 19 aaaaaaaa00aaaaaa aaaaaaaaaaaaaaaa -> 00410003 00410003
+istri 19 aaaaaaaaaaaaaaaa aaaaaaaaaaaa00aa -> 00810001 00810001
+istri 19 aaaaaaaa00aaaaaa aaaaaaaaaaaa00aa -> 00c10001 00c10001
+istri 19 aaaaaaaaaaaa00aa aaaaaaaaaaaaaaaa -> 00410001 00410001
+istri 19 aaaaaaaaaaaaaaaa aaaaaaaa00aaaaaa -> 00810003 00810003
+istri 19 aaaaaaaaaaaa00aa aaaaaaaa00aaaaaa -> 00c10001 00c10001
+istri 19 0000000000000000 aaaaaaaa00aaaaaa -> 08c10000 08c10000
+istri 19 8000000000000000 aaaaaaaa00aaaaaa -> 08c10000 08c10000
+istri 19 0000000000000001 aaaaaaaa00aaaaaa -> 08c10000 08c10000
+istri 19 0000000000000000 aaaaaaaaaaaaaaaa -> 08410000 08410000
+istri 19 aaaaaaaaaaaaaaaa 0000000000000000 -> 08810000 08810000

View File

@ -1,383 +0,0 @@
Fix without v-bit test program changes which changed too much since 3.11.0.
commit 568f3ab3f7a4c074fe9ce6f4f395fb25b6fa375b
Author: carll <carll@8f6e269a-dfd6-0310-a8e1-e2731360e62c>
Date: Tue Apr 26 19:52:56 2016 +0000
Power PC Fix V bit error in 128-bit BCD add and subtract instructions
The original code was using the bcdadd / bcdsub instruction on the operand
shadow bits to calculate the shadow bits for the result. This introduced
non-zero bits shadow bits in the result. The shadow bits for these
instructions should be set to all valid or all invalid. If one of the
argument shadow bits was one, then all of the shadow bits of the result should
be one. Otherwise the result shadow bits should be zero.
This patch fixes the above bug in memcheck/mc_translate.c
Fixing the above bug broke the v-bit test. The issue is the v-bit tester
assumes the shadow bits for the operands of a given Iop can be set to one
for testing purposes. The implementation of the bcdadd and bcdsub was passing
a constant value for the variable ps. The ps value is an argument to the
instruction that specifies how to set the sign code of the result. The
implementation of the instructions was changed to issue the instruction with
ps=0. Then the result of the instruction is updated in the VEX code if ps=1.
This changed also results in cleaning up the vbit test code.
This patch also fixes the issues with the v-bit test program.
Bugzilla 360035
git-svn-id: svn://svn.valgrind.org/vex/trunk@3218 8f6e269a-dfd6-0310-a8e1-e2731360e62c
diff --git a/VEX/priv/guest_ppc_toIR.c b/VEX/priv/guest_ppc_toIR.c
index 034a766..44304df 100644
--- a/VEX/priv/guest_ppc_toIR.c
+++ b/VEX/priv/guest_ppc_toIR.c
@@ -21297,6 +21297,43 @@ static Bool dis_av_quad ( UInt theInstr )
return True;
}
+static IRExpr * bcd_sign_code_adjust( UInt ps, IRExpr * tmp)
+{
+ /* The Iop_BCDAdd and Iop_BCDSub will result in the corresponding Power PC
+ * instruction being issued with ps = 0. If ps = 1, the sign code, which
+ * is in the least significant four bits of the result, needs to be updated
+ * per the ISA:
+ *
+ * If PS=0, the sign code of the result is set to 0b1100.
+ * If PS=1, the sign code of the result is set to 0b1111.
+ *
+ * Note, the ps value is NOT being passed down to the instruction issue
+ * because passing a constant via triop() breaks the vbit-test test. The
+ * vbit-tester assumes it can set non-zero shadow bits for the triop()
+ * arguments. Thus they have to be expressions not a constant.
+ */
+ IRTemp mask = newTemp(Ity_I64);
+ IRExpr *rtn;
+
+ if ( ps == 0 ) {
+ /* sign code is correct, just return it. */
+ rtn = tmp;
+
+ } else {
+ /* check if lower four bits are 0b1100, if so, change to 0b1111 */
+ assign( mask, unop( Iop_1Sto64,
+ binop( Iop_CmpEQ64, mkU64( 0xC ),
+ binop( Iop_And64, mkU64( 0xF ),
+ unop( Iop_V128to64, tmp ) ) ) ) );
+ rtn = binop( Iop_64HLtoV128,
+ unop( Iop_V128HIto64, tmp ),
+ binop( Iop_Or64,
+ binop( Iop_And64, mkU64( 0xF ), mkexpr( mask ) ),
+ unop( Iop_V128to64, tmp ) ) );
+ }
+
+ return rtn;
+}
/*
AltiVec BCD Arithmetic instructions.
@@ -21329,15 +21366,19 @@ static Bool dis_av_bcd ( UInt theInstr )
switch (opc2) {
case 0x1: // bcdadd
DIP("bcdadd. v%d,v%d,v%d,%u\n", vRT_addr, vRA_addr, vRB_addr, ps);
- assign( dst, triop( Iop_BCDAdd, mkexpr( vA ),
- mkexpr( vB ), mkU8( ps ) ) );
+ assign( dst, bcd_sign_code_adjust( ps,
+ binop( Iop_BCDAdd,
+ mkexpr( vA ),
+ mkexpr( vB ) ) ) );
putVReg( vRT_addr, mkexpr(dst));
return True;
case 0x41: // bcdsub
DIP("bcdsub. v%d,v%d,v%d,%u\n", vRT_addr, vRA_addr, vRB_addr, ps);
- assign( dst, triop( Iop_BCDSub, mkexpr( vA ),
- mkexpr( vB ), mkU8( ps ) ) );
+ assign( dst, bcd_sign_code_adjust( ps,
+ binop( Iop_BCDSub,
+ mkexpr( vA ),
+ mkexpr( vB ) ) ) );
putVReg( vRT_addr, mkexpr(dst));
return True;
diff --git a/VEX/priv/host_ppc_defs.c b/VEX/priv/host_ppc_defs.c
index 13b193c..06487b5 100644
--- a/VEX/priv/host_ppc_defs.c
+++ b/VEX/priv/host_ppc_defs.c
@@ -1415,15 +1415,14 @@ PPCInstr* PPCInstr_AvHashV128Binary ( PPCAvOp op, HReg dst,
i->Pin.AvHashV128Binary.s_field = s_field;
return i;
}
-PPCInstr* PPCInstr_AvBCDV128Trinary ( PPCAvOp op, HReg dst,
- HReg src1, HReg src2, PPCRI* ps ) {
+PPCInstr* PPCInstr_AvBCDV128Binary ( PPCAvOp op, HReg dst,
+ HReg src1, HReg src2 ) {
PPCInstr* i = LibVEX_Alloc_inline(sizeof(PPCInstr));
- i->tag = Pin_AvBCDV128Trinary;
- i->Pin.AvBCDV128Trinary.op = op;
- i->Pin.AvBCDV128Trinary.dst = dst;
- i->Pin.AvBCDV128Trinary.src1 = src1;
- i->Pin.AvBCDV128Trinary.src2 = src2;
- i->Pin.AvBCDV128Trinary.ps = ps;
+ i->tag = Pin_AvBCDV128Binary;
+ i->Pin.AvBCDV128Binary.op = op;
+ i->Pin.AvBCDV128Binary.dst = dst;
+ i->Pin.AvBCDV128Binary.src1 = src1;
+ i->Pin.AvBCDV128Binary.src2 = src2;
return i;
}
@@ -2038,15 +2037,13 @@ void ppPPCInstr ( const PPCInstr* i, Bool mode64 )
ppPPCRI(i->Pin.AvHashV128Binary.s_field);
return;
- case Pin_AvBCDV128Trinary:
- vex_printf("%s(w) ", showPPCAvOp(i->Pin.AvBCDV128Trinary.op));
- ppHRegPPC(i->Pin.AvBCDV128Trinary.dst);
+ case Pin_AvBCDV128Binary:
+ vex_printf("%s(w) ", showPPCAvOp(i->Pin.AvBCDV128Binary.op));
+ ppHRegPPC(i->Pin.AvBCDV128Binary.dst);
vex_printf(",");
- ppHRegPPC(i->Pin.AvBCDV128Trinary.src1);
+ ppHRegPPC(i->Pin.AvBCDV128Binary.src1);
vex_printf(",");
- ppHRegPPC(i->Pin.AvBCDV128Trinary.src2);
- vex_printf(",");
- ppPPCRI(i->Pin.AvBCDV128Trinary.ps);
+ ppHRegPPC(i->Pin.AvBCDV128Binary.src2);
return;
case Pin_Dfp64Unary:
@@ -2511,11 +2508,10 @@ void getRegUsage_PPCInstr ( HRegUsage* u, const PPCInstr* i, Bool mode64 )
addHRegUse(u, HRmRead, i->Pin.AvHashV128Binary.src);
addRegUsage_PPCRI(u, i->Pin.AvHashV128Binary.s_field);
return;
- case Pin_AvBCDV128Trinary:
- addHRegUse(u, HRmWrite, i->Pin.AvBCDV128Trinary.dst);
- addHRegUse(u, HRmRead, i->Pin.AvBCDV128Trinary.src1);
- addHRegUse(u, HRmRead, i->Pin.AvBCDV128Trinary.src2);
- addRegUsage_PPCRI(u, i->Pin.AvBCDV128Trinary.ps);
+ case Pin_AvBCDV128Binary:
+ addHRegUse(u, HRmWrite, i->Pin.AvBCDV128Binary.dst);
+ addHRegUse(u, HRmRead, i->Pin.AvBCDV128Binary.src1);
+ addHRegUse(u, HRmRead, i->Pin.AvBCDV128Binary.src2);
return;
case Pin_Dfp64Unary:
addHRegUse(u, HRmWrite, i->Pin.Dfp64Unary.dst);
@@ -2844,11 +2840,10 @@ void mapRegs_PPCInstr ( HRegRemap* m, PPCInstr* i, Bool mode64 )
mapReg(m, &i->Pin.AvHashV128Binary.dst);
mapReg(m, &i->Pin.AvHashV128Binary.src);
return;
- case Pin_AvBCDV128Trinary:
- mapReg(m, &i->Pin.AvBCDV128Trinary.dst);
- mapReg(m, &i->Pin.AvBCDV128Trinary.src1);
- mapReg(m, &i->Pin.AvBCDV128Trinary.src2);
- mapRegs_PPCRI(m, i->Pin.AvBCDV128Trinary.ps);
+ case Pin_AvBCDV128Binary:
+ mapReg(m, &i->Pin.AvBCDV128Binary.dst);
+ mapReg(m, &i->Pin.AvBCDV128Binary.src1);
+ mapReg(m, &i->Pin.AvBCDV128Binary.src2);
return;
case Pin_Dfp64Unary:
mapReg(m, &i->Pin.Dfp64Unary.dst);
@@ -5104,20 +5099,22 @@ Int emit_PPCInstr ( /*MB_MOD*/Bool* is_profInc,
p = mkFormVX( p, 4, v_dst, v_src, s_field->Pri.Imm, opc2, endness_host );
goto done;
}
- case Pin_AvBCDV128Trinary: {
- UInt v_dst = vregEnc(i->Pin.AvBCDV128Trinary.dst);
- UInt v_src1 = vregEnc(i->Pin.AvBCDV128Trinary.src1);
- UInt v_src2 = vregEnc(i->Pin.AvBCDV128Trinary.src2);
- PPCRI* ps = i->Pin.AvBCDV128Trinary.ps;
+ case Pin_AvBCDV128Binary: {
+ UInt v_dst = vregEnc(i->Pin.AvBCDV128Binary.dst);
+ UInt v_src1 = vregEnc(i->Pin.AvBCDV128Binary.src1);
+ UInt v_src2 = vregEnc(i->Pin.AvBCDV128Binary.src2);
+ UInt ps = 0; /* Issue the instruction with ps=0. The IR code will
+ * fix up the result if ps=1.
+ */
UInt opc2;
- switch (i->Pin.AvBCDV128Trinary.op) {
+ switch (i->Pin.AvBCDV128Binary.op) {
case Pav_BCDAdd: opc2 = 1; break; // bcdadd
case Pav_BCDSub: opc2 = 65; break; // bcdsub
default:
goto bad;
}
p = mkFormVXR( p, 4, v_dst, v_src1, v_src2,
- 0x1, (ps->Pri.Imm << 9) | opc2, endness_host );
+ 0x1, ps | opc2, endness_host );
goto done;
}
case Pin_AvBin32Fx4: {
diff --git a/VEX/priv/host_ppc_defs.h b/VEX/priv/host_ppc_defs.h
index c04c994..0b1939d 100644
--- a/VEX/priv/host_ppc_defs.h
+++ b/VEX/priv/host_ppc_defs.h
@@ -499,7 +499,7 @@ typedef
Pin_AvCipherV128Unary, /* AV Vector unary Cipher */
Pin_AvCipherV128Binary, /* AV Vector binary Cipher */
Pin_AvHashV128Binary, /* AV Vector binary Hash */
- Pin_AvBCDV128Trinary, /* BCD Arithmetic */
+ Pin_AvBCDV128Binary, /* BCD Arithmetic */
Pin_Dfp64Unary, /* DFP64 unary op */
Pin_Dfp128Unary, /* DFP128 unary op */
Pin_DfpShift, /* Decimal floating point shift by immediate value */
@@ -867,8 +867,7 @@ typedef
HReg dst;
HReg src1;
HReg src2;
- PPCRI* ps;
- } AvBCDV128Trinary;
+ } AvBCDV128Binary;
struct {
PPCAvOp op;
HReg dst;
@@ -1063,9 +1062,8 @@ extern PPCInstr* PPCInstr_AvCipherV128Binary ( PPCAvOp op, HReg dst,
HReg srcL, HReg srcR );
extern PPCInstr* PPCInstr_AvHashV128Binary ( PPCAvOp op, HReg dst,
HReg src, PPCRI* s_field );
-extern PPCInstr* PPCInstr_AvBCDV128Trinary ( PPCAvOp op, HReg dst,
- HReg src1, HReg src2,
- PPCRI* ps );
+extern PPCInstr* PPCInstr_AvBCDV128Binary ( PPCAvOp op, HReg dst,
+ HReg src1, HReg src2 );
extern PPCInstr* PPCInstr_Dfp64Unary ( PPCFpOp op, HReg dst, HReg src );
extern PPCInstr* PPCInstr_Dfp64Binary ( PPCFpOp op, HReg dst, HReg srcL,
HReg srcR );
diff --git a/VEX/priv/host_ppc_isel.c b/VEX/priv/host_ppc_isel.c
index 11a9943..5a701ed 100644
--- a/VEX/priv/host_ppc_isel.c
+++ b/VEX/priv/host_ppc_isel.c
@@ -5392,25 +5392,25 @@ static HReg iselVecExpr_wrk ( ISelEnv* env, IRExpr* e, IREndness IEndianess )
addInstr(env, PPCInstr_AvHashV128Binary(op, dst, arg1, s_field));
return dst;
}
- default:
- break;
- } /* switch (e->Iex.Binop.op) */
- } /* if (e->tag == Iex_Binop) */
- if (e->tag == Iex_Triop) {
- IRTriop *triop = e->Iex.Triop.details;
- switch (triop->op) {
case Iop_BCDAdd:op = Pav_BCDAdd; goto do_AvBCDV128;
case Iop_BCDSub:op = Pav_BCDSub; goto do_AvBCDV128;
do_AvBCDV128: {
- HReg arg1 = iselVecExpr(env, triop->arg1, IEndianess);
- HReg arg2 = iselVecExpr(env, triop->arg2, IEndianess);
+ HReg arg1 = iselVecExpr(env, e->Iex.Binop.arg1, IEndianess);
+ HReg arg2 = iselVecExpr(env, e->Iex.Binop.arg2, IEndianess);
HReg dst = newVRegV(env);
- PPCRI* ps = iselWordExpr_RI(env, triop->arg3, IEndianess);
- addInstr(env, PPCInstr_AvBCDV128Trinary(op, dst, arg1, arg2, ps));
+ addInstr(env, PPCInstr_AvBCDV128Binary(op, dst, arg1, arg2));
return dst;
}
+ default:
+ break;
+ } /* switch (e->Iex.Binop.op) */
+ } /* if (e->tag == Iex_Binop) */
+
+ if (e->tag == Iex_Triop) {
+ IRTriop *triop = e->Iex.Triop.details;
+ switch (triop->op) {
case Iop_Add32Fx4: fpop = Pavfp_ADDF; goto do_32Fx4_with_rm;
case Iop_Sub32Fx4: fpop = Pavfp_SUBF; goto do_32Fx4_with_rm;
case Iop_Mul32Fx4: fpop = Pavfp_MULF; goto do_32Fx4_with_rm;
diff --git a/VEX/priv/ir_defs.c b/VEX/priv/ir_defs.c
index 4a7b770..8fdfcab 100644
--- a/VEX/priv/ir_defs.c
+++ b/VEX/priv/ir_defs.c
@@ -3122,7 +3122,8 @@ void typeOfPrimop ( IROp op,
case Iop_BCDAdd:
case Iop_BCDSub:
- TERNARY(Ity_V128,Ity_V128, Ity_I8, Ity_V128);
+ BINARY(Ity_V128, Ity_V128, Ity_V128);
+
case Iop_QDMull16Sx4: case Iop_QDMull32Sx2:
BINARY(Ity_I64, Ity_I64, Ity_V128);
commit c8da12c274b2d94c42c07676139378b57fa7b31b
Author: carll <carll@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Tue Apr 26 19:53:56 2016 +0000
Power PC Fix V bit error in 128-bit BCD add and subtract instructions
The original code was using the bcdadd / bcdsub instruction on the operand
shadow bits to calculate the shadow bits for the result. This introduced
non-zero bits shadow bits in the result. The shadow bits for these
instructions should be set to all valid or all invalid. If one of the
argument shadow bits was one, then all of the shadow bits of the result should
be one. Otherwise the result shadow bits should be zero.
This patch fixes the above bug in memcheck/mc_translate.c
Fixing the above bug broke the v-bit test. The issue is the v-bit tester
assumes the shadow bits for the operands of a given Iop can be set to one
for testing purposes. The implementation of the bcdadd and bcdsub was passing
a constant value for the variable ps. The ps value is an argument to the
instruction that specifies how to set the sign code of the result. The
implementation of the instructions was changed to issue the instruction with
ps=0. Then the result of the instruction is updated in the VEX code if ps=1.
This changed also results in cleaning up the vbit test code.
This patch also fixes the issues with the v-bit test program.
Valgrind commit 3218
Bugzilla 360035
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15871 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/memcheck/mc_translate.c b/memcheck/mc_translate.c
index c239e46..d50b53d 100644
--- a/memcheck/mc_translate.c
+++ b/memcheck/mc_translate.c
@@ -852,6 +852,17 @@ static IRAtom* mkPCastTo( MCEnv* mce, IRType dst_ty, IRAtom* vbits )
unop(Iop_CmpNEZ64, tmp4));
break;
}
+ case Ity_V128: {
+ /* Chop it in half, OR the halves together, and compare that
+ * with zero.
+ */
+ IRAtom* tmp2 = assignNew('V', mce, Ity_I64, unop(Iop_V128HIto64, vbits));
+ IRAtom* tmp3 = assignNew('V', mce, Ity_I64, unop(Iop_V128to64, vbits));
+ IRAtom* tmp4 = assignNew('V', mce, Ity_I64, binop(Iop_Or64, tmp2, tmp3));
+ tmp1 = assignNew('V', mce, Ity_I1,
+ unop(Iop_CmpNEZ64, tmp4));
+ break;
+ }
default:
ppIRType(src_ty);
VG_(tool_panic)("mkPCastTo(1)");
@@ -2888,11 +2899,6 @@ IRAtom* expr2vbits_Triop ( MCEnv* mce,
case Iop_SetElem32x2:
complainIfUndefined(mce, atom2, NULL);
return assignNew('V', mce, Ity_I64, triop(op, vatom1, atom2, vatom3));
- /* BCDIops */
- case Iop_BCDAdd:
- case Iop_BCDSub:
- complainIfUndefined(mce, atom3, NULL);
- return assignNew('V', mce, Ity_V128, triop(op, vatom1, vatom2, atom3));
/* Vector FP with rounding mode as the first arg */
case Iop_Add64Fx2:
@@ -3723,6 +3729,10 @@ IRAtom* expr2vbits_Binop ( MCEnv* mce,
complainIfUndefined(mce, atom2, NULL);
return assignNew('V', mce, Ity_V128, binop(op, vatom1, atom2));
+ case Iop_BCDAdd:
+ case Iop_BCDSub:
+ return mkLazy2(mce, Ity_V128, vatom1, vatom2);
+
/* SHA Iops */
case Iop_SHA256:
case Iop_SHA512:

File diff suppressed because it is too large Load Diff

View File

@ -1,28 +0,0 @@
diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c
index 77668c7..6d5713b 100644
--- a/coregrind/m_syswrap/syswrap-ppc64-linux.c
+++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c
@@ -1151,6 +1151,23 @@ static SyscallTableEntry syscall_table[] = {
LINX_(__NR_pwritev, sys_pwritev), // 321
LINXY(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo),// 322
+ LINXY(__NR_socket, sys_socket), // 326
+ LINX_(__NR_bind, sys_bind), // 327
+ LINX_(__NR_connect, sys_connect), // 328
+ LINX_(__NR_listen, sys_listen), // 329
+ LINXY(__NR_accept, sys_accept), // 330
+ LINXY(__NR_getsockname, sys_getsockname), // 331
+ LINXY(__NR_getpeername, sys_getpeername), // 332
+ LINXY(__NR_socketpair, sys_socketpair), // 333
+ LINX_(__NR_send, sys_send), // 334
+ LINX_(__NR_sendto, sys_sendto), // 335
+ LINXY(__NR_recv, sys_recv), // 336
+ LINXY(__NR_recvfrom, sys_recvfrom), // 337
+ LINX_(__NR_shutdown, sys_shutdown), // 338
+ LINX_(__NR_setsockopt, sys_setsockopt), // 339
+ LINXY(__NR_getsockopt, sys_getsockopt), // 340
+ LINX_(__NR_sendmsg, sys_sendmsg), // 341
+ LINXY(__NR_recvmsg, sys_recvmsg), // 342
LINXY(__NR_recvmmsg, sys_recvmmsg), // 343
LINXY(__NR_accept4, sys_accept4), // 344

View File

@ -1,40 +0,0 @@
commit 9a51385e9d032e9f66076ce2c0f1343e4caeec21
Author: mjw <mjw@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Mon May 30 20:16:04 2016 +0000
Bug 363714 ppc64 missing syscalls sync, waitid and name_to/open_by_handle_at
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15888 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c
index 6d5713b..2a027f0 100644
--- a/coregrind/m_syswrap/syswrap-ppc64-linux.c
+++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c
@@ -821,7 +821,7 @@ static SyscallTableEntry syscall_table[] = {
// _____(__NR_nice, sys_nice), // 34
// _____(__NR_ftime, sys_ftime), // 35
-// _____(__NR_sync, sys_sync), // 36
+ GENX_(__NR_sync, sys_sync), // 36
GENX_(__NR_kill, sys_kill), // 37
GENX_(__NR_rename, sys_rename), // 38
GENX_(__NR_mkdir, sys_mkdir), // 39
@@ -1102,7 +1102,7 @@ static SyscallTableEntry syscall_table[] = {
LINX_(__NR_request_key, sys_request_key), // 270
LINXY(__NR_keyctl, sys_keyctl), // 271
-// _____(__NR_waitid, sys_waitid), // 272
+ LINXY(__NR_waitid, sys_waitid), // 272
LINX_(__NR_ioprio_set, sys_ioprio_set), // 273
LINX_(__NR_ioprio_get, sys_ioprio_get), // 274
@@ -1170,7 +1170,8 @@ static SyscallTableEntry syscall_table[] = {
LINXY(__NR_recvmsg, sys_recvmsg), // 342
LINXY(__NR_recvmmsg, sys_recvmmsg), // 343
LINXY(__NR_accept4, sys_accept4), // 344
-
+ LINXY(__NR_name_to_handle_at, sys_name_to_handle_at),// 345
+ LINXY(__NR_open_by_handle_at, sys_open_by_handle_at),// 346
LINXY(__NR_clock_adjtime, sys_clock_adjtime), // 347
LINX_(__NR_syncfs, sys_syncfs), // 348
LINXY(__NR_sendmmsg, sys_sendmmsg), // 349

View File

@ -1,824 +0,0 @@
commit 42d961c3744b2afb236c4fd3d2b59eb61421b9a8
Author: carll <carll@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Thu Apr 21 18:21:26 2016 +0000
PPC64, Valgrind with GDB does not display 64-bit and 128-bit registers
correctly
1) Fix Endianess issue that was missed in the BE to LE port. GDB was
not displaying the contents of the 64-bit and 128-bit registers
correctly due to an Endianess issue.
2) Fix displaying the shadow registers for the 64-bit and 128-bit
registers.
Bugzilla 360008 was opened for this issue.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15864 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/Makefile.am b/coregrind/Makefile.am
index d29f954..00d9fc7 100644
--- a/coregrind/Makefile.am
+++ b/coregrind/Makefile.am
@@ -605,12 +605,17 @@ GDBSERVER_XML_FILES = \
m_gdbserver/power64-core-valgrind-s1.xml \
m_gdbserver/power64-core-valgrind-s2.xml \
m_gdbserver/power64-core.xml \
+ m_gdbserver/power64-core2-valgrind-s1.xml \
+ m_gdbserver/power64-core2-valgrind-s2.xml \
m_gdbserver/power64-linux-valgrind-s1.xml \
m_gdbserver/power64-linux-valgrind-s2.xml \
m_gdbserver/power64-linux.xml \
m_gdbserver/power-altivec-valgrind-s1.xml \
m_gdbserver/power-altivec-valgrind-s2.xml \
m_gdbserver/power-altivec.xml \
+ m_gdbserver/power-vsx-valgrind-s1.xml \
+ m_gdbserver/power-vsx-valgrind-s2.xml \
+ m_gdbserver/power-vsx.xml \
m_gdbserver/power-core-valgrind-s1.xml \
m_gdbserver/power-core-valgrind-s2.xml \
m_gdbserver/power-core.xml \
diff --git a/coregrind/m_gdbserver/power-altivec.xml b/coregrind/m_gdbserver/power-altivec.xml
index 45d31af..d416075 100644
--- a/coregrind/m_gdbserver/power-altivec.xml
+++ b/coregrind/m_gdbserver/power-altivec.xml
@@ -19,7 +19,7 @@
<field name="v16_int8" type="v16i8"/>
</union>
- <reg name="vr0" bitsize="128" type="vec128"/>
+ <reg name="vr0" bitsize="128" type="vec128" regnum="73"/>
<reg name="vr1" bitsize="128" type="vec128"/>
<reg name="vr2" bitsize="128" type="vec128"/>
<reg name="vr3" bitsize="128" type="vec128"/>
diff --git a/coregrind/m_gdbserver/power-fpu-valgrind-s1.xml b/coregrind/m_gdbserver/power-fpu-valgrind-s1.xml
index 00d9108..a23d550 100644
--- a/coregrind/m_gdbserver/power-fpu-valgrind-s1.xml
+++ b/coregrind/m_gdbserver/power-fpu-valgrind-s1.xml
@@ -7,7 +7,7 @@
<!DOCTYPE feature SYSTEM "gdb-target.dtd">
<feature name="org.gnu.gdb.power.fpu-valgrind-s1">
- <reg name="f0s1" bitsize="64" type="uint64" regnum="32"/>
+ <reg name="f0s1" bitsize="64" type="uint64"/>
<reg name="f1s1" bitsize="64" type="uint64"/>
<reg name="f2s1" bitsize="64" type="uint64"/>
<reg name="f3s1" bitsize="64" type="uint64"/>
@@ -40,5 +40,5 @@
<reg name="f30s1" bitsize="64" type="uint64"/>
<reg name="f31s1" bitsize="64" type="uint64"/>
- <reg name="fpscrs1" bitsize="32" group="float" regnum="70"/>
+ <reg name="fpscrs1" bitsize="32" group="float"/>
</feature>
diff --git a/coregrind/m_gdbserver/power-fpu-valgrind-s2.xml b/coregrind/m_gdbserver/power-fpu-valgrind-s2.xml
index a12fa6e..45e434c 100644
--- a/coregrind/m_gdbserver/power-fpu-valgrind-s2.xml
+++ b/coregrind/m_gdbserver/power-fpu-valgrind-s2.xml
@@ -7,7 +7,7 @@
<!DOCTYPE feature SYSTEM "gdb-target.dtd">
<feature name="org.gnu.gdb.power.fpu-valgrind-s2">
- <reg name="f0s2" bitsize="64" type="uint64" regnum="32"/>
+ <reg name="f0s2" bitsize="64" type="uint64"/>
<reg name="f1s2" bitsize="64" type="uint64"/>
<reg name="f2s2" bitsize="64" type="uint64"/>
<reg name="f3s2" bitsize="64" type="uint64"/>
@@ -40,5 +40,5 @@
<reg name="f30s2" bitsize="64" type="uint64"/>
<reg name="f31s2" bitsize="64" type="uint64"/>
- <reg name="fpscrs2" bitsize="32" group="float" regnum="70"/>
+ <reg name="fpscrs2" bitsize="32" group="float"/>
</feature>
diff --git a/coregrind/m_gdbserver/power64-core-valgrind-s1.xml b/coregrind/m_gdbserver/power64-core-valgrind-s1.xml
index f6296bf..857e9da 100644
--- a/coregrind/m_gdbserver/power64-core-valgrind-s1.xml
+++ b/coregrind/m_gdbserver/power64-core-valgrind-s1.xml
@@ -40,10 +40,29 @@
<reg name="r30s1" bitsize="64" type="uint64"/>
<reg name="r31s1" bitsize="64" type="uint64"/>
- <reg name="pcs1" bitsize="64" type="code_ptr" regnum="64"/>
+<!-- When printing the non-shadow register names/contents, GDB prints the
+ GPRs followed by the floating point registers then the pc, msr, ...
+ registers. If the shadow GPRs and shadow pc/msr/cr... register
+ definitions are all in this file, as is done with the non-shadow register
+ definitions, the shadow register name print order changes to GPRs,
+ followed by pc/msr/cr... then the floating point registers. Note, the
+ contents of the shadow registers still print in this same order as the
+ non-shadow registers values resulting in the shadow register names and
+ shadow register values not correctly aligning.
+
+ In order to get, the shadow register names to print in the same order
+ as the non-shadow register and correctly align with their contents,
+ the following register definitions were moved to the file
+ power64-core2-valgrind-s1.xml. The new file is included after the shadow
+ floating point XML definition file. By doing this, we get GDB to print
+ the shadow register names in the same order as the non-shadow register
+ names and thus correctly align with the order that the shadow register
+ contents are printed. -->
+
+<!-- <reg name="pcs1" bitsize="64" type="code_ptr"/>
<reg name="msrs1" bitsize="64" type="uint64"/>
<reg name="crs1" bitsize="32" type="uint32"/>
<reg name="lrs1" bitsize="64" type="code_ptr"/>
<reg name="ctrs1" bitsize="64" type="uint64"/>
- <reg name="xers1" bitsize="32" type="uint32"/>
+ <reg name="xers1" bitsize="32" type="uint32"/> -->
</feature>
diff --git a/coregrind/m_gdbserver/power64-core-valgrind-s2.xml b/coregrind/m_gdbserver/power64-core-valgrind-s2.xml
index 663232e..3825c67 100644
--- a/coregrind/m_gdbserver/power64-core-valgrind-s2.xml
+++ b/coregrind/m_gdbserver/power64-core-valgrind-s2.xml
@@ -40,10 +40,29 @@
<reg name="r30s2" bitsize="64" type="uint64"/>
<reg name="r31s2" bitsize="64" type="uint64"/>
- <reg name="pcs2" bitsize="64" type="code_ptr" regnum="64"/>
+<!-- When printing the non-shadow register names/contents, GDB prints the
+ GPRs followed by the floating point registers then the pc, msr, ...
+ registers. If the shadow GPRs and shadow pc/msr/cr... register
+ definitions are all in this file, as is done with the non-shadow register
+ definitions, the shadow register name print order changes to GPRs,
+ followed by pc/msr/cr... then the floating point registers. Note, the
+ contents of the shadow registers still print in this same order as the
+ non-shadow registers values resulting in the shadow register names and
+ shadow register values not correctly aligning.
+
+ In order to get, the shadow register names to print in the same order
+ as the non-shadow register and correctly align with their contents,
+ the following register definitions were moved to the file
+ power64-core2-valgrind-s2.xml. The new file is included after the shadow
+ floating point XML definition file. By doing this, we get GDB to print
+ the shadow register names in the same order as the non-shadow register
+ names and thus correctly align with the order that the shadow register
+ contents are printed. -->
+
+<!-- <reg name="pcs2" bitsize="64" type="code_ptr"/>
<reg name="msrs2" bitsize="64" type="uint64"/>
<reg name="crs2" bitsize="32" type="uint32"/>
<reg name="lrs2" bitsize="64" type="code_ptr"/>
<reg name="ctrs2" bitsize="64" type="uint64"/>
- <reg name="xers2" bitsize="32" type="uint32"/>
+ <reg name="xers2" bitsize="32" type="uint32"/> -->
</feature>
diff --git a/coregrind/m_gdbserver/power64-core.xml b/coregrind/m_gdbserver/power64-core.xml
index e0a6ee3..c5cfb3b 100644
--- a/coregrind/m_gdbserver/power64-core.xml
+++ b/coregrind/m_gdbserver/power64-core.xml
@@ -40,6 +40,13 @@
<reg name="r30" bitsize="64" type="uint64"/>
<reg name="r31" bitsize="64" type="uint64"/>
+<!-- Note, the following register definitions must be in this file by
+ the "standard target features" for this processor. GDB will reject
+ this file description if the following register definitions are
+ not in this file. Hence, they can't be moved to power64-core2.xml
+ for consistency with what was done for the shadow register definitions
+ to get the shadow register print order to match the print order of
+ the HW registers -->
<reg name="pc" bitsize="64" type="code_ptr" regnum="64"/>
<reg name="msr" bitsize="64" type="uint64"/>
<reg name="cr" bitsize="32" type="uint32"/>
diff --git a/coregrind/m_gdbserver/power64-linux-valgrind-s1.xml b/coregrind/m_gdbserver/power64-linux-valgrind-s1.xml
index 7f1d0ac..736c1e7 100644
--- a/coregrind/m_gdbserver/power64-linux-valgrind-s1.xml
+++ b/coregrind/m_gdbserver/power64-linux-valgrind-s1.xml
@@ -7,6 +7,6 @@
<!DOCTYPE feature SYSTEM "gdb-target.dtd">
<feature name="org.gnu.gdb.power.linux-valgrind-s1">
- <reg name="orig_r3s1" bitsize="64" regnum="71"/>
+ <reg name="orig_r3s1" bitsize="64"/>
<reg name="traps1" bitsize="64"/>
</feature>
diff --git a/coregrind/m_gdbserver/power64-linux-valgrind-s2.xml b/coregrind/m_gdbserver/power64-linux-valgrind-s2.xml
index 007bd04..626a59c 100644
--- a/coregrind/m_gdbserver/power64-linux-valgrind-s2.xml
+++ b/coregrind/m_gdbserver/power64-linux-valgrind-s2.xml
@@ -7,6 +7,6 @@
<!DOCTYPE feature SYSTEM "gdb-target.dtd">
<feature name="org.gnu.gdb.power.linux-valgrind-s2">
- <reg name="orig_r3s2" bitsize="64" regnum="71"/>
+ <reg name="orig_r3s2" bitsize="64"/>
<reg name="traps2" bitsize="64"/>
</feature>
diff --git a/coregrind/m_gdbserver/powerpc-altivec64l-valgrind.xml b/coregrind/m_gdbserver/powerpc-altivec64l-valgrind.xml
index a2cd615..7760e3d 100644
--- a/coregrind/m_gdbserver/powerpc-altivec64l-valgrind.xml
+++ b/coregrind/m_gdbserver/powerpc-altivec64l-valgrind.xml
@@ -16,12 +16,17 @@
<xi:include href="power-fpu.xml"/>
<xi:include href="power64-linux.xml"/>
<xi:include href="power-altivec.xml"/>
+ <xi:include href="power-vsx.xml"/>
<xi:include href="power64-core-valgrind-s1.xml"/>
<xi:include href="power-fpu-valgrind-s1.xml"/>
+ <xi:include href="power64-core2-valgrind-s1.xml"/>
<xi:include href="power64-linux-valgrind-s1.xml"/>
<xi:include href="power-altivec-valgrind-s1.xml"/>
+ <xi:include href="power-vsx-valgrind-s1.xml"/>
<xi:include href="power64-core-valgrind-s2.xml"/>
<xi:include href="power-fpu-valgrind-s2.xml"/>
+ <xi:include href="power64-core2-valgrind-s2.xml"/>
<xi:include href="power64-linux-valgrind-s2.xml"/>
<xi:include href="power-altivec-valgrind-s2.xml"/>
+ <xi:include href="power-vsx-valgrind-s2.xml"/>
</target>
diff --git a/coregrind/m_gdbserver/powerpc-altivec64l.xml b/coregrind/m_gdbserver/powerpc-altivec64l.xml
index d06dad9..3fc4fda 100644
--- a/coregrind/m_gdbserver/powerpc-altivec64l.xml
+++ b/coregrind/m_gdbserver/powerpc-altivec64l.xml
@@ -16,4 +16,5 @@
<xi:include href="power-fpu.xml"/>
<xi:include href="power64-linux.xml"/>
<xi:include href="power-altivec.xml"/>
+ <xi:include href="power-vsx.xml"/>
</target>
diff --git a/coregrind/m_gdbserver/valgrind-low-ppc64.c b/coregrind/m_gdbserver/valgrind-low-ppc64.c
index 3bf90b1..3c6146c 100644
--- a/coregrind/m_gdbserver/valgrind-low-ppc64.c
+++ b/coregrind/m_gdbserver/valgrind-low-ppc64.c
@@ -35,6 +35,51 @@
#include "libvex_guest_ppc64.h"
+/* The PPC64 register layout with vs register support (Power 7 and beyond)
+ consists of 64 VSR registers of size 128-bits. The 32 floating point
+ registers fp map to the upper 64-bits of vsr[0] to vsr[31]. The 32
+ vr[0] to vr[31] registers of size 128-bits map to vsr[31] to vsr[63]. The
+ lower 64-bits of the vsr[0] to vsr[31] registers are in the pseudo
+ registers vs[0]h to vs[31]h registers. These pseudo registers get printed
+ by GDB but there are no instructions that directly access these registers.
+ When GDB prints the vsr[0] to vsr[31] registers it combines the contents
+ of the floating point registers fp[0] to fp[31] and its corresponding
+ vs[0]h to vs[31]h registers to display the VSR contents. The vsr[32]
+ to vsr[63] contents are the same as the the vr[0] to vr[31] contents.
+
+ GDB also prints fp[32] to fp[63]. These are simply the upper 64 bits of
+ vsr[32] to vsr[63] however, these are not "real" floating point registers
+ as none of the floating point instructions can access these registers.
+
+ Register map.
+ MSB IBM bit numbering LSB
+ 0 63 64 127
+ vsr[0] | fp[0] | vs[0]h |
+ vsr[1] | fp[1] | vs[1]h |
+ vsr[2] | fp[2] | vs[2]h |
+ ...
+ vsr[31] | fp[31] | vs[31]h |
+ vsr[32] | vr[0] |
+ vsr[33] | vr[1] |
+ ...
+ vsr[63] | vr[31] |
+
+ Note, not shown above are the fake fp[32] to fp[63] that GDB prints
+
+ Valgrind has two shadow registers for each real register denoted with
+ the suffix s1 and s2. When printing the contents of the shadow registers,
+ GDB does not explicitly print the shadow registers vsr[0] to vsr[63]. GDB
+ prints the shadow register contents of the 32 floating point registers as
+ fp[0]s1 to fp[31]s1 and fp[0]s2 to fp[31]s2. The shadow register contents
+ of vs[0]hs1 to vs[31]hs1 and vs[0]hs2 to vs[31]hs2 are also printed. The
+ user needs to construct the vsr[i]s1 shadow register contents by looking
+ at fp[i]s1 for the upper 64-bits and vs[i]hs1 for the lower 64-bits. The
+ vsr[i]s2 shadow register contents are constructed similarly.
+
+ GDB prints the 128-bit shadow register contents of the 32 vr registers as
+ vr[0]s1 to vr[31]s1 and vr[0]s2 to vr[31]s2. These are also the value of the
+ VSR shadow registers vsr[32]s1 to vsr[63]s1 and vsr[32]s2 to vsr[63]s2. */
+
static struct reg regs[] = {
{ "r0", 0, 64 },
{ "r1", 64, 64 },
@@ -143,7 +188,40 @@ static struct reg regs[] = {
{ "vr31", 8544, 128 },
{ "vscr", 8672, 32 },
{ "vrsave", 8704, 32 },
+ { "vs0h", 8736, 64 },
+ { "vs1h", 8800, 64 },
+ { "vs2h", 8864, 64 },
+ { "vs3h", 8928, 64 },
+ { "vs4h", 8992, 64 },
+ { "vs5h", 9056, 64 },
+ { "vs6h", 9120, 64 },
+ { "vs7h", 9184, 64 },
+ { "vs8h", 9248, 64 },
+ { "vs9h", 9312, 64 },
+ { "vs10h", 9376, 64 },
+ { "vs11h", 9440, 64 },
+ { "vs12h", 9504, 64 },
+ { "vs13h", 9568, 64 },
+ { "vs14h", 9632, 64 },
+ { "vs15h", 9696, 64 },
+ { "vs16h", 9760, 64 },
+ { "vs17h", 9824, 64 },
+ { "vs18h", 9888, 64 },
+ { "vs19h", 9952, 64 },
+ { "vs20h", 10016, 64 },
+ { "vs21h", 10080, 64 },
+ { "vs22h", 10144, 64 },
+ { "vs23h", 10208, 64 },
+ { "vs24h", 10272, 64 },
+ { "vs25h", 10336, 64 },
+ { "vs26h", 10400, 64 },
+ { "vs27h", 10464, 64 },
+ { "vs28h", 10528, 64 },
+ { "vs29h", 10592, 64 },
+ { "vs30h", 10656, 64 },
+ { "vs31h", 10720, 64 },
};
+
static const char *expedite_regs[] = { "r1", "pc", 0 };
#define num_regs (sizeof (regs) / sizeof (regs[0]))
@@ -178,11 +256,42 @@ void transfer_register (ThreadId tid, int abs_regno, void * buf,
ThreadState* tst = VG_(get_ThreadState)(tid);
int set = abs_regno / num_regs;
int regno = abs_regno % num_regs;
+ int low_offset, high_offset;
+
*mod = False;
VexGuestPPC64State* ppc64 = (VexGuestPPC64State*) get_arch (set, tst);
- switch (regno) {
+
+#if defined (VG_LITTLEENDIAN)
+ /* Fetch the 64-bits for the VR registers (VSR[32] to VSR[63] stored as
+ * Little Endian. The 128-bit value is stored as an array of four 32-bit
+ * values. The lower 32-bits are in element 0 in Little Endian format.
+ */
+ low_offset = 0;
+
+ /* Fetch the upper 64-bits for the floating point register stored as
+ * Little Endian. The 128-bit value is stored as an array of four 32-bit
+ * values. The upper 32-bits are in element 3 in Little Endian format.
+ */
+ high_offset = 2;
+#elif defined (VG_BIGENDIAN)
+ /* Fetch the 64-bits for the VR registers (VSR[32] to VSR[63] stored as
+ * Little Endian. The 128-bit value is stored as an array of four 32-bit
+ * values. The lower 32-bits are in element 3 in Big Endian format.
+ */
+ low_offset = 2;
+
+ /* Fetch the upper 64-bits for the floating point register stored as
+ * Little Endian. The 128-bit value is stored as an array of four 32-bit
+ * values. The upper 32-bits are in element 0 in Big Endian format.
+ */
+ high_offset = 0;
+#else
+# error "Unknown endianness"
+#endif
+
+ switch (regno) {
// numbers here have to match the order of regs above
// Attention: gdb order does not match valgrind order.
case 0: VG_(transfer) (&ppc64->guest_GPR0, buf, dir, size, mod); break;
@@ -217,44 +326,46 @@ void transfer_register (ThreadId tid, int abs_regno, void * buf,
case 29: VG_(transfer) (&ppc64->guest_GPR29, buf, dir, size, mod); break;
case 30: VG_(transfer) (&ppc64->guest_GPR30, buf, dir, size, mod); break;
case 31: VG_(transfer) (&ppc64->guest_GPR31, buf, dir, size, mod); break;
- case 32: VG_(transfer) (&ppc64->guest_VSR0, buf, dir, size, mod); break;
- case 33: VG_(transfer) (&ppc64->guest_VSR1, buf, dir, size, mod); break;
- case 34: VG_(transfer) (&ppc64->guest_VSR2, buf, dir, size, mod); break;
- case 35: VG_(transfer) (&ppc64->guest_VSR3, buf, dir, size, mod); break;
- case 36: VG_(transfer) (&ppc64->guest_VSR4, buf, dir, size, mod); break;
- case 37: VG_(transfer) (&ppc64->guest_VSR5, buf, dir, size, mod); break;
- case 38: VG_(transfer) (&ppc64->guest_VSR6, buf, dir, size, mod); break;
- case 39: VG_(transfer) (&ppc64->guest_VSR7, buf, dir, size, mod); break;
- case 40: VG_(transfer) (&ppc64->guest_VSR8, buf, dir, size, mod); break;
- case 41: VG_(transfer) (&ppc64->guest_VSR9, buf, dir, size, mod); break;
- case 42: VG_(transfer) (&ppc64->guest_VSR10, buf, dir, size, mod); break;
- case 43: VG_(transfer) (&ppc64->guest_VSR11, buf, dir, size, mod); break;
- case 44: VG_(transfer) (&ppc64->guest_VSR12, buf, dir, size, mod); break;
- case 45: VG_(transfer) (&ppc64->guest_VSR13, buf, dir, size, mod); break;
- case 46: VG_(transfer) (&ppc64->guest_VSR14, buf, dir, size, mod); break;
- case 47: VG_(transfer) (&ppc64->guest_VSR15, buf, dir, size, mod); break;
- case 48: VG_(transfer) (&ppc64->guest_VSR16, buf, dir, size, mod); break;
- case 49: VG_(transfer) (&ppc64->guest_VSR17, buf, dir, size, mod); break;
- case 50: VG_(transfer) (&ppc64->guest_VSR18, buf, dir, size, mod); break;
- case 51: VG_(transfer) (&ppc64->guest_VSR19, buf, dir, size, mod); break;
- case 52: VG_(transfer) (&ppc64->guest_VSR20, buf, dir, size, mod); break;
- case 53: VG_(transfer) (&ppc64->guest_VSR21, buf, dir, size, mod); break;
- case 54: VG_(transfer) (&ppc64->guest_VSR22, buf, dir, size, mod); break;
- case 55: VG_(transfer) (&ppc64->guest_VSR23, buf, dir, size, mod); break;
- case 56: VG_(transfer) (&ppc64->guest_VSR24, buf, dir, size, mod); break;
- case 57: VG_(transfer) (&ppc64->guest_VSR25, buf, dir, size, mod); break;
- case 58: VG_(transfer) (&ppc64->guest_VSR26, buf, dir, size, mod); break;
- case 59: VG_(transfer) (&ppc64->guest_VSR27, buf, dir, size, mod); break;
- case 60: VG_(transfer) (&ppc64->guest_VSR28, buf, dir, size, mod); break;
- case 61: VG_(transfer) (&ppc64->guest_VSR29, buf, dir, size, mod); break;
- case 62: VG_(transfer) (&ppc64->guest_VSR30, buf, dir, size, mod); break;
- case 63: VG_(transfer) (&ppc64->guest_VSR31, buf, dir, size, mod); break;
+
+ case 32: VG_(transfer) (&ppc64->guest_VSR0[high_offset], buf, dir, size, mod); break;
+ case 33: VG_(transfer) (&ppc64->guest_VSR1[high_offset], buf, dir, size, mod); break;
+ case 34: VG_(transfer) (&ppc64->guest_VSR2[high_offset], buf, dir, size, mod); break;
+ case 35: VG_(transfer) (&ppc64->guest_VSR3[high_offset], buf, dir, size, mod); break;
+ case 36: VG_(transfer) (&ppc64->guest_VSR4[high_offset], buf, dir, size, mod); break;
+ case 37: VG_(transfer) (&ppc64->guest_VSR5[high_offset], buf, dir, size, mod); break;
+ case 38: VG_(transfer) (&ppc64->guest_VSR6[high_offset], buf, dir, size, mod); break;
+ case 39: VG_(transfer) (&ppc64->guest_VSR7[high_offset], buf, dir, size, mod); break;
+ case 40: VG_(transfer) (&ppc64->guest_VSR8[high_offset], buf, dir, size, mod); break;
+ case 41: VG_(transfer) (&ppc64->guest_VSR9[high_offset], buf, dir, size, mod); break;
+ case 42: VG_(transfer) (&ppc64->guest_VSR10[high_offset], buf, dir, size, mod); break;
+ case 43: VG_(transfer) (&ppc64->guest_VSR11[high_offset], buf, dir, size, mod); break;
+ case 44: VG_(transfer) (&ppc64->guest_VSR12[high_offset], buf, dir, size, mod); break;
+ case 45: VG_(transfer) (&ppc64->guest_VSR13[high_offset], buf, dir, size, mod); break;
+ case 46: VG_(transfer) (&ppc64->guest_VSR14[high_offset], buf, dir, size, mod); break;
+ case 47: VG_(transfer) (&ppc64->guest_VSR15[high_offset], buf, dir, size, mod); break;
+ case 48: VG_(transfer) (&ppc64->guest_VSR16[high_offset], buf, dir, size, mod); break;
+ case 49: VG_(transfer) (&ppc64->guest_VSR17[high_offset], buf, dir, size, mod); break;
+ case 50: VG_(transfer) (&ppc64->guest_VSR18[high_offset], buf, dir, size, mod); break;
+ case 51: VG_(transfer) (&ppc64->guest_VSR19[high_offset], buf, dir, size, mod); break;
+ case 52: VG_(transfer) (&ppc64->guest_VSR20[high_offset], buf, dir, size, mod); break;
+ case 53: VG_(transfer) (&ppc64->guest_VSR21[high_offset], buf, dir, size, mod); break;
+ case 54: VG_(transfer) (&ppc64->guest_VSR22[high_offset], buf, dir, size, mod); break;
+ case 55: VG_(transfer) (&ppc64->guest_VSR23[high_offset], buf, dir, size, mod); break;
+ case 56: VG_(transfer) (&ppc64->guest_VSR24[high_offset], buf, dir, size, mod); break;
+ case 57: VG_(transfer) (&ppc64->guest_VSR25[high_offset], buf, dir, size, mod); break;
+ case 58: VG_(transfer) (&ppc64->guest_VSR26[high_offset], buf, dir, size, mod); break;
+ case 59: VG_(transfer) (&ppc64->guest_VSR27[high_offset], buf, dir, size, mod); break;
+ case 60: VG_(transfer) (&ppc64->guest_VSR28[high_offset], buf, dir, size, mod); break;
+ case 61: VG_(transfer) (&ppc64->guest_VSR29[high_offset], buf, dir, size, mod); break;
+ case 62: VG_(transfer) (&ppc64->guest_VSR30[high_offset], buf, dir, size, mod); break;
+ case 63: VG_(transfer) (&ppc64->guest_VSR31[high_offset], buf, dir, size, mod); break;
+
case 64: VG_(transfer) (&ppc64->guest_CIA, buf, dir, size, mod); break;
case 65: *mod = False; break; // VEX does not model Machine State Register
case 66: {
UInt cr = LibVEX_GuestPPC64_get_CR (ppc64);
if (dir == valgrind_to_gdbserver) {
- VG_(transfer) (&cr, buf, dir, size, mod);
+ VG_(transfer) (&cr, buf, dir, size, mod);
} else {
UInt newcr;
VG_(transfer) (&newcr, buf, dir, size, mod);
@@ -280,40 +391,79 @@ void transfer_register (ThreadId tid, int abs_regno, void * buf,
case 70: VG_(transfer) (&ppc64->guest_FPROUND, buf, dir, size, mod); break;
case 71: *mod = False; break; // GDBTD???? VEX { "orig_r3", 4448, 64 },
case 72: *mod = False; break; // GDBTD???? VEX { "trap", 4512, 64 },
- case 73: VG_(transfer) (&ppc64->guest_VSR32, buf, dir, size, mod); break;
- case 74: VG_(transfer) (&ppc64->guest_VSR33, buf, dir, size, mod); break;
- case 75: VG_(transfer) (&ppc64->guest_VSR34, buf, dir, size, mod); break;
- case 76: VG_(transfer) (&ppc64->guest_VSR35, buf, dir, size, mod); break;
- case 77: VG_(transfer) (&ppc64->guest_VSR36, buf, dir, size, mod); break;
- case 78: VG_(transfer) (&ppc64->guest_VSR37, buf, dir, size, mod); break;
- case 79: VG_(transfer) (&ppc64->guest_VSR38, buf, dir, size, mod); break;
- case 80: VG_(transfer) (&ppc64->guest_VSR39, buf, dir, size, mod); break;
- case 81: VG_(transfer) (&ppc64->guest_VSR40, buf, dir, size, mod); break;
- case 82: VG_(transfer) (&ppc64->guest_VSR41, buf, dir, size, mod); break;
- case 83: VG_(transfer) (&ppc64->guest_VSR42, buf, dir, size, mod); break;
- case 84: VG_(transfer) (&ppc64->guest_VSR43, buf, dir, size, mod); break;
- case 85: VG_(transfer) (&ppc64->guest_VSR44, buf, dir, size, mod); break;
- case 86: VG_(transfer) (&ppc64->guest_VSR45, buf, dir, size, mod); break;
- case 87: VG_(transfer) (&ppc64->guest_VSR46, buf, dir, size, mod); break;
- case 88: VG_(transfer) (&ppc64->guest_VSR47, buf, dir, size, mod); break;
- case 89: VG_(transfer) (&ppc64->guest_VSR48, buf, dir, size, mod); break;
- case 90: VG_(transfer) (&ppc64->guest_VSR49, buf, dir, size, mod); break;
- case 91: VG_(transfer) (&ppc64->guest_VSR50, buf, dir, size, mod); break;
- case 92: VG_(transfer) (&ppc64->guest_VSR51, buf, dir, size, mod); break;
- case 93: VG_(transfer) (&ppc64->guest_VSR52, buf, dir, size, mod); break;
- case 94: VG_(transfer) (&ppc64->guest_VSR53, buf, dir, size, mod); break;
- case 95: VG_(transfer) (&ppc64->guest_VSR54, buf, dir, size, mod); break;
- case 96: VG_(transfer) (&ppc64->guest_VSR55, buf, dir, size, mod); break;
- case 97: VG_(transfer) (&ppc64->guest_VSR56, buf, dir, size, mod); break;
- case 98: VG_(transfer) (&ppc64->guest_VSR57, buf, dir, size, mod); break;
- case 99: VG_(transfer) (&ppc64->guest_VSR58, buf, dir, size, mod); break;
- case 100: VG_(transfer) (&ppc64->guest_VSR59, buf, dir, size, mod); break;
- case 101: VG_(transfer) (&ppc64->guest_VSR60, buf, dir, size, mod); break;
- case 102: VG_(transfer) (&ppc64->guest_VSR61, buf, dir, size, mod); break;
- case 103: VG_(transfer) (&ppc64->guest_VSR62, buf, dir, size, mod); break;
- case 104: VG_(transfer) (&ppc64->guest_VSR63, buf, dir, size, mod); break;
- case 105: VG_(transfer) (&ppc64->guest_VSCR, buf, dir, size, mod); break;
+
+ case 73: VG_(transfer) (&ppc64->guest_VSR32, buf, dir, size, mod); break;
+ case 74: VG_(transfer) (&ppc64->guest_VSR33, buf, dir, size, mod); break;
+ case 75: VG_(transfer) (&ppc64->guest_VSR34, buf, dir, size, mod); break;
+ case 76: VG_(transfer) (&ppc64->guest_VSR35, buf, dir, size, mod); break;
+ case 77: VG_(transfer) (&ppc64->guest_VSR36, buf, dir, size, mod); break;
+ case 78: VG_(transfer) (&ppc64->guest_VSR37, buf, dir, size, mod); break;
+ case 79: VG_(transfer) (&ppc64->guest_VSR38, buf, dir, size, mod); break;
+ case 80: VG_(transfer) (&ppc64->guest_VSR39, buf, dir, size, mod); break;
+ case 81: VG_(transfer) (&ppc64->guest_VSR40, buf, dir, size, mod); break;
+ case 82: VG_(transfer) (&ppc64->guest_VSR40, buf, dir, size, mod); break;
+ case 83: VG_(transfer) (&ppc64->guest_VSR42, buf, dir, size, mod); break;
+ case 84: VG_(transfer) (&ppc64->guest_VSR43, buf, dir, size, mod); break;
+ case 85: VG_(transfer) (&ppc64->guest_VSR44, buf, dir, size, mod); break;
+ case 86: VG_(transfer) (&ppc64->guest_VSR45, buf, dir, size, mod); break;
+ case 87: VG_(transfer) (&ppc64->guest_VSR46, buf, dir, size, mod); break;
+ case 88: VG_(transfer) (&ppc64->guest_VSR47, buf, dir, size, mod); break;
+ case 89: VG_(transfer) (&ppc64->guest_VSR48, buf, dir, size, mod); break;
+ case 90: VG_(transfer) (&ppc64->guest_VSR49, buf, dir, size, mod); break;
+ case 91: VG_(transfer) (&ppc64->guest_VSR50, buf, dir, size, mod); break;
+ case 92: VG_(transfer) (&ppc64->guest_VSR51, buf, dir, size, mod); break;
+ case 93: VG_(transfer) (&ppc64->guest_VSR52, buf, dir, size, mod); break;
+ case 94: VG_(transfer) (&ppc64->guest_VSR53, buf, dir, size, mod); break;
+ case 95: VG_(transfer) (&ppc64->guest_VSR54, buf, dir, size, mod); break;
+ case 96: VG_(transfer) (&ppc64->guest_VSR55, buf, dir, size, mod); break;
+ case 97: VG_(transfer) (&ppc64->guest_VSR56, buf, dir, size, mod); break;
+ case 98: VG_(transfer) (&ppc64->guest_VSR57, buf, dir, size, mod); break;
+ case 99: VG_(transfer) (&ppc64->guest_VSR58, buf, dir, size, mod); break;
+ case 100: VG_(transfer) (&ppc64->guest_VSR59, buf, dir, size, mod); break;
+ case 101: VG_(transfer) (&ppc64->guest_VSR60, buf, dir, size, mod); break;
+ case 102: VG_(transfer) (&ppc64->guest_VSR61, buf, dir, size, mod); break;
+ case 103: VG_(transfer) (&ppc64->guest_VSR62, buf, dir, size, mod); break;
+ case 104: VG_(transfer) (&ppc64->guest_VSR63, buf, dir, size, mod); break;
+ case 105: VG_(transfer) (&ppc64->guest_VSCR, buf, dir, size, mod); break;
case 106: VG_(transfer) (&ppc64->guest_VRSAVE, buf, dir, size, mod); break;
+
+ /* Fetch the lower 64-bits of the VSR registers. GDB will combine the
+ * lower 64-bits of the VSR with the upper 64-bits it got fetching the
+ * corresponding floating point register to display the full 128-bit
+ * VSR value.
+ */
+ case 107: VG_(transfer) (&ppc64->guest_VSR0[low_offset], buf, dir, size, mod); break;
+ case 108: VG_(transfer) (&ppc64->guest_VSR1[low_offset], buf, dir, size, mod); break;
+ case 109: VG_(transfer) (&ppc64->guest_VSR2[low_offset], buf, dir, size, mod); break;
+ case 110: VG_(transfer) (&ppc64->guest_VSR3[low_offset], buf, dir, size, mod); break;
+ case 111: VG_(transfer) (&ppc64->guest_VSR4[low_offset], buf, dir, size, mod); break;
+ case 112: VG_(transfer) (&ppc64->guest_VSR5[low_offset], buf, dir, size, mod); break;
+ case 113: VG_(transfer) (&ppc64->guest_VSR6[low_offset], buf, dir, size, mod); break;
+ case 114: VG_(transfer) (&ppc64->guest_VSR7[low_offset], buf, dir, size, mod); break;
+ case 115: VG_(transfer) (&ppc64->guest_VSR8[low_offset], buf, dir, size, mod); break;
+ case 116: VG_(transfer) (&ppc64->guest_VSR9[low_offset], buf, dir, size, mod); break;
+ case 117: VG_(transfer) (&ppc64->guest_VSR10[low_offset], buf, dir, size, mod); break;
+ case 118: VG_(transfer) (&ppc64->guest_VSR11[low_offset], buf, dir, size, mod); break;
+ case 119: VG_(transfer) (&ppc64->guest_VSR12[low_offset], buf, dir, size, mod); break;
+ case 120: VG_(transfer) (&ppc64->guest_VSR13[low_offset], buf, dir, size, mod); break;
+ case 121: VG_(transfer) (&ppc64->guest_VSR14[low_offset], buf, dir, size, mod); break;
+ case 122: VG_(transfer) (&ppc64->guest_VSR15[low_offset], buf, dir, size, mod); break;
+ case 123: VG_(transfer) (&ppc64->guest_VSR16[low_offset], buf, dir, size, mod); break;
+ case 124: VG_(transfer) (&ppc64->guest_VSR17[low_offset], buf, dir, size, mod); break;
+ case 125: VG_(transfer) (&ppc64->guest_VSR18[low_offset], buf, dir, size, mod); break;
+ case 126: VG_(transfer) (&ppc64->guest_VSR19[low_offset], buf, dir, size, mod); break;
+ case 127: VG_(transfer) (&ppc64->guest_VSR20[low_offset], buf, dir, size, mod); break;
+ case 128: VG_(transfer) (&ppc64->guest_VSR21[low_offset], buf, dir, size, mod); break;
+ case 129: VG_(transfer) (&ppc64->guest_VSR22[low_offset], buf, dir, size, mod); break;
+ case 130: VG_(transfer) (&ppc64->guest_VSR23[low_offset], buf, dir, size, mod); break;
+ case 131: VG_(transfer) (&ppc64->guest_VSR24[low_offset], buf, dir, size, mod); break;
+ case 132: VG_(transfer) (&ppc64->guest_VSR25[low_offset], buf, dir, size, mod); break;
+ case 133: VG_(transfer) (&ppc64->guest_VSR26[low_offset], buf, dir, size, mod); break;
+ case 134: VG_(transfer) (&ppc64->guest_VSR27[low_offset], buf, dir, size, mod); break;
+ case 135: VG_(transfer) (&ppc64->guest_VSR28[low_offset], buf, dir, size, mod); break;
+ case 136: VG_(transfer) (&ppc64->guest_VSR29[low_offset], buf, dir, size, mod); break;
+ case 137: VG_(transfer) (&ppc64->guest_VSR30[low_offset], buf, dir, size, mod); break;
+ case 138: VG_(transfer) (&ppc64->guest_VSR31[low_offset], buf, dir, size, mod); break;
default: vg_assert(0);
}
}
@@ -321,6 +471,14 @@ void transfer_register (ThreadId tid, int abs_regno, void * buf,
static
const char* target_xml (Bool shadow_mode)
{
+ /* NOTE, the current powerpc-altivec64l*.xml files includes the vsx
+ * registers. Power 6 and earlier power processors do not support the
+ * vsx registers. GDB has a bug in that it is only checking for ptrace
+ * support rather then checking the actual HW feature. Hence GDB on
+ * power 6 prints vsx registers that do not exist. Valgrind GDB support
+ * also has to include the vsx register definitions to be consistent with
+ * GDB.
+ */
if (shadow_mode) {
return "powerpc-altivec64l-valgrind.xml";
} else {
commit 323a91bfd7dd10d52c77ff31ae6d6b8d0bb37f32
Author: carll <carll@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Fri Apr 22 15:03:46 2016 +0000
PPC64, Valgrind with GDB does not display 64-bit and 128-bit registers
correctly
Forgot to add the new files to the previous commit 15864.
coregrind/m_gdbserver/power64-core2-valgrind-s1.xml
coregrind/m_gdbserver/power64-core2-valgrind-s2.xml
coregrind/m_gdbserver/power-vsx-valgrind-s1.xml
coregrind/m_gdbserver/power-vsx-valgrind-s2.xml
coregrind/m_gdbserver/power-vsx.xml
Bugzilla 360008 was opened for this issue.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15866 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_gdbserver/power-vsx-valgrind-s1.xml b/coregrind/m_gdbserver/power-vsx-valgrind-s1.xml
new file mode 100644
index 0000000..24730ff
--- /dev/null
+++ b/coregrind/m_gdbserver/power-vsx-valgrind-s1.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2008-2016 Free Software Foundation, Inc.
+
+ Copying and distribution of this file, with or without modification,
+ are permitted in any medium without royalty provided the copyright
+ notice and this notice are preserved. -->
+
+<!-- POWER7 VSX registers that do not overlap existing FP and VMX
+ registers. -->
+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
+<feature name="org.gnu.gdb.power.vsx">
+ <reg name="vs0hs1" bitsize="64" type="uint64"/>
+ <reg name="vs1hs1" bitsize="64" type="uint64"/>
+ <reg name="vs2hs1" bitsize="64" type="uint64"/>
+ <reg name="vs3hs1" bitsize="64" type="uint64"/>
+ <reg name="vs4hs1" bitsize="64" type="uint64"/>
+ <reg name="vs5hs1" bitsize="64" type="uint64"/>
+ <reg name="vs6hs1" bitsize="64" type="uint64"/>
+ <reg name="vs7hs1" bitsize="64" type="uint64"/>
+ <reg name="vs8hs1" bitsize="64" type="uint64"/>
+ <reg name="vs9hs1" bitsize="64" type="uint64"/>
+ <reg name="vs10hs1" bitsize="64" type="uint64"/>
+ <reg name="vs11hs1" bitsize="64" type="uint64"/>
+ <reg name="vs12hs1" bitsize="64" type="uint64"/>
+ <reg name="vs13hs1" bitsize="64" type="uint64"/>
+ <reg name="vs14hs1" bitsize="64" type="uint64"/>
+ <reg name="vs15hs1" bitsize="64" type="uint64"/>
+ <reg name="vs16hs1" bitsize="64" type="uint64"/>
+ <reg name="vs17hs1" bitsize="64" type="uint64"/>
+ <reg name="vs18hs1" bitsize="64" type="uint64"/>
+ <reg name="vs19hs1" bitsize="64" type="uint64"/>
+ <reg name="vs20hs1" bitsize="64" type="uint64"/>
+ <reg name="vs21hs1" bitsize="64" type="uint64"/>
+ <reg name="vs22hs1" bitsize="64" type="uint64"/>
+ <reg name="vs23hs1" bitsize="64" type="uint64"/>
+ <reg name="vs24hs1" bitsize="64" type="uint64"/>
+ <reg name="vs25hs1" bitsize="64" type="uint64"/>
+ <reg name="vs26hs1" bitsize="64" type="uint64"/>
+ <reg name="vs27hs1" bitsize="64" type="uint64"/>
+ <reg name="vs28hs1" bitsize="64" type="uint64"/>
+ <reg name="vs29hs1" bitsize="64" type="uint64"/>
+ <reg name="vs30hs1" bitsize="64" type="uint64"/>
+ <reg name="vs31hs1" bitsize="64" type="uint64"/>
+</feature>
diff --git a/coregrind/m_gdbserver/power-vsx-valgrind-s2.xml b/coregrind/m_gdbserver/power-vsx-valgrind-s2.xml
new file mode 100644
index 0000000..8854e8f
--- /dev/null
+++ b/coregrind/m_gdbserver/power-vsx-valgrind-s2.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2008-2016 Free Software Foundation, Inc.
+
+ Copying and distribution of this file, with or without modification,
+ are permitted in any medium without royalty provided the copyright
+ notice and this notice are preserved. -->
+
+<!-- POWER7 VSX registers that do not overlap existing FP and VMX
+ registers. -->
+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
+<feature name="org.gnu.gdb.power.vsx">
+ <reg name="vs0hs2" bitsize="64" type="uint64"/>
+ <reg name="vs1hs2" bitsize="64" type="uint64"/>
+ <reg name="vs2hs2" bitsize="64" type="uint64"/>
+ <reg name="vs3hs2" bitsize="64" type="uint64"/>
+ <reg name="vs4hs2" bitsize="64" type="uint64"/>
+ <reg name="vs5hs2" bitsize="64" type="uint64"/>
+ <reg name="vs6hs2" bitsize="64" type="uint64"/>
+ <reg name="vs7hs2" bitsize="64" type="uint64"/>
+ <reg name="vs8hs2" bitsize="64" type="uint64"/>
+ <reg name="vs9hs2" bitsize="64" type="uint64"/>
+ <reg name="vs10hs2" bitsize="64" type="uint64"/>
+ <reg name="vs11hs2" bitsize="64" type="uint64"/>
+ <reg name="vs12hs2" bitsize="64" type="uint64"/>
+ <reg name="vs13hs2" bitsize="64" type="uint64"/>
+ <reg name="vs14hs2" bitsize="64" type="uint64"/>
+ <reg name="vs15hs2" bitsize="64" type="uint64"/>
+ <reg name="vs16hs2" bitsize="64" type="uint64"/>
+ <reg name="vs17hs2" bitsize="64" type="uint64"/>
+ <reg name="vs18hs2" bitsize="64" type="uint64"/>
+ <reg name="vs19hs2" bitsize="64" type="uint64"/>
+ <reg name="vs20hs2" bitsize="64" type="uint64"/>
+ <reg name="vs21hs2" bitsize="64" type="uint64"/>
+ <reg name="vs22hs2" bitsize="64" type="uint64"/>
+ <reg name="vs23hs2" bitsize="64" type="uint64"/>
+ <reg name="vs24hs2" bitsize="64" type="uint64"/>
+ <reg name="vs25hs2" bitsize="64" type="uint64"/>
+ <reg name="vs26hs2" bitsize="64" type="uint64"/>
+ <reg name="vs27hs2" bitsize="64" type="uint64"/>
+ <reg name="vs28hs2" bitsize="64" type="uint64"/>
+ <reg name="vs29hs2" bitsize="64" type="uint64"/>
+ <reg name="vs30hs2" bitsize="64" type="uint64"/>
+ <reg name="vs31hs2" bitsize="64" type="uint64"/>
+</feature>
diff --git a/coregrind/m_gdbserver/power-vsx.xml b/coregrind/m_gdbserver/power-vsx.xml
new file mode 100644
index 0000000..411e35c
--- /dev/null
+++ b/coregrind/m_gdbserver/power-vsx.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2008-2016 Free Software Foundation, Inc.
+
+ Copying and distribution of this file, with or without modification,
+ are permitted in any medium without royalty provided the copyright
+ notice and this notice are preserved. -->
+
+<!-- POWER7 VSX registers that do not overlap existing FP and VMX
+ registers. -->
+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
+<feature name="org.gnu.gdb.power.vsx">
+ <reg name="vs0h" bitsize="64" type="uint64" regnum="107"/>
+ <reg name="vs1h" bitsize="64" type="uint64"/>
+ <reg name="vs2h" bitsize="64" type="uint64"/>
+ <reg name="vs3h" bitsize="64" type="uint64"/>
+ <reg name="vs4h" bitsize="64" type="uint64"/>
+ <reg name="vs5h" bitsize="64" type="uint64"/>
+ <reg name="vs6h" bitsize="64" type="uint64"/>
+ <reg name="vs7h" bitsize="64" type="uint64"/>
+ <reg name="vs8h" bitsize="64" type="uint64"/>
+ <reg name="vs9h" bitsize="64" type="uint64"/>
+ <reg name="vs10h" bitsize="64" type="uint64"/>
+ <reg name="vs11h" bitsize="64" type="uint64"/>
+ <reg name="vs12h" bitsize="64" type="uint64"/>
+ <reg name="vs13h" bitsize="64" type="uint64"/>
+ <reg name="vs14h" bitsize="64" type="uint64"/>
+ <reg name="vs15h" bitsize="64" type="uint64"/>
+ <reg name="vs16h" bitsize="64" type="uint64"/>
+ <reg name="vs17h" bitsize="64" type="uint64"/>
+ <reg name="vs18h" bitsize="64" type="uint64"/>
+ <reg name="vs19h" bitsize="64" type="uint64"/>
+ <reg name="vs20h" bitsize="64" type="uint64"/>
+ <reg name="vs21h" bitsize="64" type="uint64"/>
+ <reg name="vs22h" bitsize="64" type="uint64"/>
+ <reg name="vs23h" bitsize="64" type="uint64"/>
+ <reg name="vs24h" bitsize="64" type="uint64"/>
+ <reg name="vs25h" bitsize="64" type="uint64"/>
+ <reg name="vs26h" bitsize="64" type="uint64"/>
+ <reg name="vs27h" bitsize="64" type="uint64"/>
+ <reg name="vs28h" bitsize="64" type="uint64"/>
+ <reg name="vs29h" bitsize="64" type="uint64"/>
+ <reg name="vs30h" bitsize="64" type="uint64"/>
+ <reg name="vs31h" bitsize="64" type="uint64"/>
+</feature>
diff --git a/coregrind/m_gdbserver/power64-core2-valgrind-s1.xml b/coregrind/m_gdbserver/power64-core2-valgrind-s1.xml
new file mode 100644
index 0000000..1012a2d
--- /dev/null
+++ b/coregrind/m_gdbserver/power64-core2-valgrind-s1.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+
+ Copying and distribution of this file, with or without modification,
+ are permitted in any medium without royalty provided the copyright
+ notice and this notice are preserved. -->
+
+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
+<feature name="org.gnu.gdb.power.core2-valgrind-s1">
+ <reg name="pcs1" bitsize="64" type="code_ptr"/>
+ <reg name="msrs1" bitsize="64" type="uint64"/>
+ <reg name="crs1" bitsize="32" type="uint32"/>
+ <reg name="lrs1" bitsize="64" type="code_ptr"/>
+ <reg name="ctrs1" bitsize="64" type="uint64"/>
+ <reg name="xers1" bitsize="32" type="uint32"/>
+</feature>
diff --git a/coregrind/m_gdbserver/power64-core2-valgrind-s2.xml b/coregrind/m_gdbserver/power64-core2-valgrind-s2.xml
new file mode 100644
index 0000000..fa50bd4
--- /dev/null
+++ b/coregrind/m_gdbserver/power64-core2-valgrind-s2.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+
+ Copying and distribution of this file, with or without modification,
+ are permitted in any medium without royalty provided the copyright
+ notice and this notice are preserved. -->
+
+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
+<feature name="org.gnu.gdb.power.core2-valgrind-s2">
+ <reg name="pcs2" bitsize="64" type="code_ptr"/>
+ <reg name="msrs2" bitsize="64" type="uint64"/>
+ <reg name="crs2" bitsize="32" type="uint32"/>
+ <reg name="lrs2" bitsize="64" type="code_ptr"/>
+ <reg name="ctrs2" bitsize="64" type="uint64"/>
+ <reg name="xers2" bitsize="32" type="uint32"/>
+</feature>
Only in valgrind-3.11.0: autom4te.cache
diff -ur valgrind-3.11.0.orig/coregrind/Makefile.in valgrind-3.11.0/coregrind/Makefile.in
--- valgrind-3.11.0.orig/coregrind/Makefile.in 2016-04-29 15:07:46.688655051 +0200
+++ valgrind-3.11.0/coregrind/Makefile.in 2016-04-29 15:11:24.219880810 +0200
@@ -1746,12 +1746,17 @@
m_gdbserver/power64-core-valgrind-s1.xml \
m_gdbserver/power64-core-valgrind-s2.xml \
m_gdbserver/power64-core.xml \
+ m_gdbserver/power64-core2-valgrind-s1.xml \
+ m_gdbserver/power64-core2-valgrind-s2.xml \
m_gdbserver/power64-linux-valgrind-s1.xml \
m_gdbserver/power64-linux-valgrind-s2.xml \
m_gdbserver/power64-linux.xml \
m_gdbserver/power-altivec-valgrind-s1.xml \
m_gdbserver/power-altivec-valgrind-s2.xml \
m_gdbserver/power-altivec.xml \
+ m_gdbserver/power-vsx-valgrind-s1.xml \
+ m_gdbserver/power-vsx-valgrind-s2.xml \
+ m_gdbserver/power-vsx.xml \
m_gdbserver/power-core-valgrind-s1.xml \
m_gdbserver/power-core-valgrind-s2.xml \
m_gdbserver/power-core.xml \

View File

@ -1,950 +0,0 @@
commit 515c3b6de3eff6ddf88fd14a0084b8ad0c692553
Author: iraisr <iraisr@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Tue Mar 8 09:04:48 2016 +0000
Sanitize signal mask in ppoll and pselect syscalls
Reported and Linux patch contributed by Steven Smith <sos22@archy.org.uk>
Fixes BZ#359871
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15823 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_syswrap/priv_syswrap-main.h b/coregrind/m_syswrap/priv_syswrap-main.h
index cabad7c..3164c81 100644
--- a/coregrind/m_syswrap/priv_syswrap-main.h
+++ b/coregrind/m_syswrap/priv_syswrap-main.h
@@ -38,6 +38,9 @@
extern
void ML_(fixup_guest_state_to_restart_syscall) ( ThreadArchState* arch );
+extern
+void VG_(sanitize_client_sigmask)(vki_sigset_t *mask);
+
#if defined(VGO_darwin)
/* Longjmp to scheduler after client calls workq_ops(WQOPS_THREAD_RETURN)*/
extern
diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c
index 7c88bc2..4a8344b 100644
--- a/coregrind/m_syswrap/syswrap-amd64-linux.c
+++ b/coregrind/m_syswrap/syswrap-amd64-linux.c
@@ -1018,7 +1018,7 @@ static SyscallTableEntry syscall_table[] = {
LINX_(__NR_fchmodat, sys_fchmodat), // 268
LINX_(__NR_faccessat, sys_faccessat), // 269
- LINX_(__NR_pselect6, sys_pselect6), // 270
+ LINXY(__NR_pselect6, sys_pselect6), // 270
LINXY(__NR_ppoll, sys_ppoll), // 271
LINX_(__NR_unshare, sys_unshare), // 272
LINX_(__NR_set_robust_list, sys_set_robust_list), // 273
diff --git a/coregrind/m_syswrap/syswrap-arm-linux.c b/coregrind/m_syswrap/syswrap-arm-linux.c
index 3ccad12..224070c 100644
--- a/coregrind/m_syswrap/syswrap-arm-linux.c
+++ b/coregrind/m_syswrap/syswrap-arm-linux.c
@@ -1188,7 +1188,7 @@ static SyscallTableEntry syscall_main_table[] = {
LINX_(__NR_arm_fadvise64_64, sys_fadvise64_64), // 270 */(Linux?)
- LINX_(__NR_pselect6, sys_pselect6), // 335
+ LINXY(__NR_pselect6, sys_pselect6), // 335
LINXY(__NR_ppoll, sys_ppoll), // 336
LINXY(__NR_epoll_pwait, sys_epoll_pwait), // 346
diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c
index 8d3027d..abddff1 100644
--- a/coregrind/m_syswrap/syswrap-arm64-linux.c
+++ b/coregrind/m_syswrap/syswrap-arm64-linux.c
@@ -924,7 +924,7 @@ static SyscallTableEntry syscall_main_table[] = {
GENX_(__NR_writev, sys_writev), // 66
GENXY(__NR_pread64, sys_pread64), // 67
GENX_(__NR_pwrite64, sys_pwrite64), // 68
- LINX_(__NR_pselect6, sys_pselect6), // 72
+ LINXY(__NR_pselect6, sys_pselect6), // 72
LINXY(__NR_ppoll, sys_ppoll), // 73
LINXY(__NR_signalfd4, sys_signalfd4), // 74
LINX_(__NR_readlinkat, sys_readlinkat), // 78
diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c
index f2d1076..6fdacda 100644
--- a/coregrind/m_syswrap/syswrap-linux.c
+++ b/coregrind/m_syswrap/syswrap-linux.c
@@ -62,6 +62,7 @@
#include "priv_types_n_macros.h"
#include "priv_syswrap-generic.h"
#include "priv_syswrap-linux.h"
+#include "priv_syswrap-main.h"
#include "priv_syswrap-xen.h"
// Run a thread from beginning to end and return the thread's
@@ -1272,9 +1273,18 @@ POST(sys_get_robust_list)
POST_MEM_WRITE(ARG3, sizeof(struct vki_size_t *));
}
+struct pselect_sized_sigset {
+ const vki_sigset_t *ss;
+ vki_size_t ss_len;
+};
+struct pselect_adjusted_sigset {
+ struct pselect_sized_sigset ss; /* The actual syscall arg */
+ vki_sigset_t adjusted_ss;
+};
+
PRE(sys_pselect6)
{
- *flags |= SfMayBlock;
+ *flags |= SfMayBlock | SfPostOnFail;
PRINT("sys_pselect6 ( %ld, %#lx, %#lx, %#lx, %#lx, %#lx )",
SARG1, ARG2, ARG3, ARG4, ARG5, ARG6);
PRE_REG_READ6(long, "pselect6",
@@ -1293,15 +1303,41 @@ PRE(sys_pselect6)
ARG4, ARG1/8 /* __FD_SETSIZE/8 */ );
if (ARG5 != 0)
PRE_MEM_READ( "pselect6(timeout)", ARG5, sizeof(struct vki_timeval) );
- if (ARG6 != 0)
- PRE_MEM_READ( "pselect6(sig)", ARG6, sizeof(void *)+sizeof(vki_size_t) );
+ if (ARG6 != 0) {
+ const struct pselect_sized_sigset *pss =
+ (struct pselect_sized_sigset *)ARG6;
+ PRE_MEM_READ( "pselect6(sig)", ARG6, sizeof(*pss) );
+ if (!ML_(safe_to_deref)(pss, sizeof(*pss))) {
+ ARG6 = 1; /* Something recognisable to POST() hook. */
+ } else {
+ struct pselect_adjusted_sigset *pas;
+ pas = VG_(malloc)("syswrap.pselect6.1", sizeof(*pas));
+ ARG6 = (Addr)pas;
+ pas->ss.ss = (void *)1;
+ pas->ss.ss_len = pss->ss_len;
+ if (pss->ss_len == sizeof(*pss->ss)) {
+ PRE_MEM_READ("pselect6(sig->ss)", (Addr)pss->ss, pss->ss_len);
+ if (ML_(safe_to_deref)(pss->ss, sizeof(*pss->ss))) {
+ pas->adjusted_ss = *pss->ss;
+ pas->ss.ss = &pas->adjusted_ss;
+ VG_(sanitize_client_sigmask)(&pas->adjusted_ss);
+ }
+ }
+ }
+ }
+}
+POST(sys_pselect6)
+{
+ if (ARG6 != 0 && ARG6 != 1) {
+ VG_(free)((struct pselect_adjusted_sigset *)ARG6);
+ }
}
PRE(sys_ppoll)
{
UInt i;
struct vki_pollfd* ufds = (struct vki_pollfd *)ARG1;
- *flags |= SfMayBlock;
+ *flags |= SfMayBlock | SfPostOnFail;
PRINT("sys_ppoll ( %#lx, %lu, %#lx, %#lx, %lu )\n", ARG1,ARG2,ARG3,ARG4,ARG5);
PRE_REG_READ5(long, "ppoll",
struct vki_pollfd *, ufds, unsigned int, nfds,
@@ -1319,18 +1355,33 @@ PRE(sys_ppoll)
if (ARG3)
PRE_MEM_READ( "ppoll(tsp)", ARG3, sizeof(struct vki_timespec) );
- if (ARG4)
- PRE_MEM_READ( "ppoll(sigmask)", ARG4, sizeof(vki_sigset_t) );
+ if (ARG4 != 0 && sizeof(vki_sigset_t) == ARG5) {
+ const vki_sigset_t *guest_sigmask = (vki_sigset_t *)ARG4;
+ PRE_MEM_READ( "ppoll(sigmask)", ARG4, ARG5);
+ if (!ML_(safe_to_deref)(guest_sigmask, sizeof(*guest_sigmask))) {
+ ARG4 = 1; /* Something recognisable to POST() hook. */
+ } else {
+ vki_sigset_t *vg_sigmask =
+ VG_(malloc)("syswrap.ppoll.1", sizeof(*vg_sigmask));
+ ARG4 = (Addr)vg_sigmask;
+ *vg_sigmask = *guest_sigmask;
+ VG_(sanitize_client_sigmask)(vg_sigmask);
+ }
+ }
}
POST(sys_ppoll)
{
- if (RES > 0) {
+ vg_assert(SUCCESS || FAILURE);
+ if (SUCCESS && (RES >= 0)) {
UInt i;
struct vki_pollfd* ufds = (struct vki_pollfd *)ARG1;
for (i = 0; i < ARG2; i++)
POST_MEM_WRITE( (Addr)(&ufds[i].revents), sizeof(ufds[i].revents) );
}
+ if (ARG4 != 0 && ARG5 == sizeof(vki_sigset_t) && ARG4 != 1) {
+ VG_(free)((vki_sigset_t *) ARG4);
+ }
}
diff --git a/coregrind/m_syswrap/syswrap-main.c b/coregrind/m_syswrap/syswrap-main.c
index 054891f..d854194 100644
--- a/coregrind/m_syswrap/syswrap-main.c
+++ b/coregrind/m_syswrap/syswrap-main.c
@@ -1657,7 +1657,7 @@ static const SyscallTableEntry* get_syscall_entry ( Int syscallno )
/* Add and remove signals from mask so that we end up telling the
kernel the state we actually want rather than what the client
wants. */
-static void sanitize_client_sigmask(vki_sigset_t *mask)
+void VG_(sanitize_client_sigmask)(vki_sigset_t *mask)
{
VG_(sigdelset)(mask, VKI_SIGKILL);
VG_(sigdelset)(mask, VKI_SIGSTOP);
@@ -1979,7 +1979,7 @@ void VG_(client_syscall) ( ThreadId tid, UInt trc )
PRINT(" --> [async] ... \n");
mask = tst->sig_mask;
- sanitize_client_sigmask(&mask);
+ VG_(sanitize_client_sigmask)(&mask);
/* Gack. More impedance matching. Copy the possibly
modified syscall args back into the guest state. */
diff --git a/coregrind/m_syswrap/syswrap-mips64-linux.c b/coregrind/m_syswrap/syswrap-mips64-linux.c
index 12d147d..7c5fbdb 100644
--- a/coregrind/m_syswrap/syswrap-mips64-linux.c
+++ b/coregrind/m_syswrap/syswrap-mips64-linux.c
@@ -889,7 +889,7 @@ static SyscallTableEntry syscall_main_table[] = {
LINX_ (__NR_readlinkat, sys_readlinkat),
LINX_ (__NR_fchmodat, sys_fchmodat),
LINX_ (__NR_faccessat, sys_faccessat),
- LINX_ (__NR_pselect6, sys_pselect6),
+ LINXY (__NR_pselect6, sys_pselect6),
LINXY (__NR_ppoll, sys_ppoll),
PLAX_ (__NR_unshare, sys_unshare),
PLAX_ (__NR_splice, sys_splice),
diff --git a/coregrind/m_syswrap/syswrap-ppc32-linux.c b/coregrind/m_syswrap/syswrap-ppc32-linux.c
index 9ceaa15..379fcb3 100644
--- a/coregrind/m_syswrap/syswrap-ppc32-linux.c
+++ b/coregrind/m_syswrap/syswrap-ppc32-linux.c
@@ -1194,7 +1194,7 @@ static SyscallTableEntry syscall_table[] = {
PLAXY(__NR_spu_run, sys_spu_run), // 278
PLAX_(__NR_spu_create, sys_spu_create), // 279
- LINX_(__NR_pselect6, sys_pselect6), // 280
+ LINXY(__NR_pselect6, sys_pselect6), // 280
LINXY(__NR_ppoll, sys_ppoll), // 281
LINXY(__NR_openat, sys_openat), // 286
diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c
index 15b8979..77668c7 100644
--- a/coregrind/m_syswrap/syswrap-ppc64-linux.c
+++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c
@@ -1110,7 +1110,7 @@ static SyscallTableEntry syscall_table[] = {
LINX_(__NR_inotify_add_watch, sys_inotify_add_watch), // 276
LINX_(__NR_inotify_rm_watch, sys_inotify_rm_watch), // 277
- LINX_(__NR_pselect6, sys_pselect6), // 280
+ LINXY(__NR_pselect6, sys_pselect6), // 280
LINXY(__NR_ppoll, sys_ppoll), // 281
LINXY(__NR_openat, sys_openat), // 286
diff --git a/coregrind/m_syswrap/syswrap-s390x-linux.c b/coregrind/m_syswrap/syswrap-s390x-linux.c
index 0513789..107a569 100644
--- a/coregrind/m_syswrap/syswrap-s390x-linux.c
+++ b/coregrind/m_syswrap/syswrap-s390x-linux.c
@@ -992,7 +992,7 @@ static SyscallTableEntry syscall_table[] = {
LINX_(__NR_fchmodat, sys_fchmodat), // 299
LINX_(__NR_faccessat, sys_faccessat), // 300
- LINX_(__NR_pselect6, sys_pselect6), // 301
+ LINXY(__NR_pselect6, sys_pselect6), // 301
LINXY(__NR_ppoll, sys_ppoll), // 302
LINX_(__NR_unshare, sys_unshare), // 303
LINX_(__NR_set_robust_list, sys_set_robust_list), // 304
diff --git a/coregrind/m_syswrap/syswrap-solaris.c b/coregrind/m_syswrap/syswrap-solaris.c
index 7ac876f..a307f6c 100644
--- a/coregrind/m_syswrap/syswrap-solaris.c
+++ b/coregrind/m_syswrap/syswrap-solaris.c
@@ -71,6 +71,7 @@
#include "priv_types_n_macros.h"
#include "priv_syswrap-generic.h"
+#include "priv_syswrap-main.h"
#include "priv_syswrap-solaris.h"
/* Return the number of non-dead and daemon threads.
@@ -7327,7 +7328,7 @@ PRE(sys_pollsys)
UWord i;
struct vki_pollfd *ufds = (struct vki_pollfd *)ARG1;
- *flags |= SfMayBlock;
+ *flags |= SfMayBlock | SfPostOnFail;
PRINT("sys_pollsys ( %#lx, %lu, %#lx, %#lx )", ARG1, ARG2, ARG3, ARG4);
PRE_REG_READ4(long, "poll", pollfd_t *, fds, vki_nfds_t, nfds,
@@ -7343,18 +7344,37 @@ PRE(sys_pollsys)
if (ARG3)
PRE_MEM_READ("poll(timeout)", ARG3, sizeof(vki_timespec_t));
- if (ARG4)
+
+ if (ARG4) {
PRE_MEM_READ("poll(set)", ARG4, sizeof(vki_sigset_t));
+
+ const vki_sigset_t *guest_sigmask = (vki_sigset_t *) ARG4;
+ if (!ML_(safe_to_deref)(guest_sigmask, sizeof(vki_sigset_t))) {
+ ARG4 = 1; /* Something recognisable to POST() hook. */
+ } else {
+ vki_sigset_t *vg_sigmask =
+ VG_(malloc)("syswrap.pollsys.1", sizeof(vki_sigset_t));
+ ARG4 = (Addr) vg_sigmask;
+ *vg_sigmask = *guest_sigmask;
+ VG_(sanitize_client_sigmask)(vg_sigmask);
+ }
+ }
}
POST(sys_pollsys)
{
- if (RES >= 0) {
+ vg_assert(SUCCESS || FAILURE);
+
+ if (SUCCESS && (RES >= 0)) {
UWord i;
vki_pollfd_t *ufds = (vki_pollfd_t*)ARG1;
for (i = 0; i < ARG2; i++)
POST_FIELD_WRITE(ufds[i].revents);
}
+
+ if ((ARG4 != 0) && (ARG4 != 1)) {
+ VG_(free)((vki_sigset_t *) ARG4);
+ }
}
PRE(sys_labelsys)
diff --git a/coregrind/m_syswrap/syswrap-tilegx-linux.c b/coregrind/m_syswrap/syswrap-tilegx-linux.c
index aceceb4..4845f79 100644
--- a/coregrind/m_syswrap/syswrap-tilegx-linux.c
+++ b/coregrind/m_syswrap/syswrap-tilegx-linux.c
@@ -1202,7 +1202,7 @@ static SyscallTableEntry syscall_table[] = {
LINXY(__NR_preadv, sys_preadv), // 69
LINX_(__NR_pwritev, sys_pwritev), // 70
LINXY(__NR_sendfile, sys_sendfile), // 71
- LINX_(__NR_pselect6, sys_pselect6), // 72
+ LINXY(__NR_pselect6, sys_pselect6), // 72
LINXY(__NR_ppoll, sys_ppoll), // 73
LINXY(__NR_signalfd4, sys_signalfd4), // 74
LINX_(__NR_splice, sys_splice), // 75
diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c
index 3c80e6a..f1f97d7 100644
--- a/coregrind/m_syswrap/syswrap-x86-linux.c
+++ b/coregrind/m_syswrap/syswrap-x86-linux.c
@@ -1766,7 +1766,7 @@ static SyscallTableEntry syscall_table[] = {
LINX_(__NR_readlinkat, sys_readlinkat), // 305
LINX_(__NR_fchmodat, sys_fchmodat), // 306
LINX_(__NR_faccessat, sys_faccessat), // 307
- LINX_(__NR_pselect6, sys_pselect6), // 308
+ LINXY(__NR_pselect6, sys_pselect6), // 308
LINXY(__NR_ppoll, sys_ppoll), // 309
LINX_(__NR_unshare, sys_unshare), // 310
diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am
index 7eb2bf8..5d8e942 100644
--- a/none/tests/Makefile.am
+++ b/none/tests/Makefile.am
@@ -142,12 +142,14 @@ EXTRA_DIST = \
nestedfns.stderr.exp nestedfns.stdout.exp nestedfns.vgtest \
nodir.stderr.exp nodir.vgtest \
pending.stdout.exp pending.stderr.exp pending.vgtest \
+ ppoll_alarm.stdout.exp ppoll_alarm.stderr.exp ppoll_alarm.vgtest \
procfs-linux.stderr.exp-with-readlinkat \
procfs-linux.stderr.exp-without-readlinkat \
procfs-linux.vgtest \
procfs-non-linux.vgtest \
procfs-non-linux.stderr.exp-with-readlinkat \
procfs-non-linux.stderr.exp-without-readlinkat \
+ pselect_alarm.stdout.exp pselect_alarm.stderr.exp pselect_alarm.vgtest \
pth_atfork1.stderr.exp pth_atfork1.stdout.exp pth_atfork1.vgtest \
pth_blockedsig.stderr.exp \
pth_blockedsig.stdout.exp pth_blockedsig.vgtest \
@@ -215,7 +217,9 @@ check_PROGRAMS = \
mmap_fcntl_bug \
munmap_exe map_unaligned map_unmap mq \
pending \
+ ppoll_alarm \
procfs-cmdline-exe \
+ pselect_alarm \
pth_atfork1 pth_blockedsig pth_cancel1 pth_cancel2 pth_cvsimple \
pth_empty pth_exit pth_exit2 pth_mutexspeed pth_once pth_rwlock \
pth_stackalign \
@@ -289,6 +293,8 @@ libvexmultiarch_test_LDADD = \
../../VEX/libvexmultiarch-@VGCONF_ARCH_PRI@-@VGCONF_OS@.a \
../../VEX/libvex-@VGCONF_ARCH_PRI@-@VGCONF_OS@.a @LIB_UBSAN@
libvexmultiarch_test_SOURCES = libvex_test.c
+ppoll_alarm_LDADD = -lpthread
+pselect_alarm_LDADD = -lpthread
pth_atfork1_LDADD = -lpthread
pth_blockedsig_LDADD = -lpthread
pth_cancel1_CFLAGS = $(AM_CFLAGS) -Wno-shadow
diff --git a/none/tests/ppoll_alarm.c b/none/tests/ppoll_alarm.c
new file mode 100644
index 0000000..1b1794b
--- /dev/null
+++ b/none/tests/ppoll_alarm.c
@@ -0,0 +1,55 @@
+/* Tries to exploit bug in ppoll mask handling:
+ https://bugs.kde.org/show_bug.cgi?id=359871
+ where client program was able to successfully block VG_SIGVGKILL. */
+
+#define _GNU_SOURCE /* for ppoll */
+#include <poll.h>
+#include <pthread.h>
+#include <signal.h>
+#include <stdio.h>
+#include <unistd.h>
+
+static int ready = 0;
+static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+
+static void *
+mythr(void *ignore)
+{
+ pthread_mutex_lock(&mutex);
+ ready = 1;
+ pthread_cond_signal(&cond);
+ pthread_mutex_unlock(&mutex);
+
+ sigset_t ss;
+ sigfillset(&ss);
+ while (1) {
+ struct timespec ts = {10000, 0};
+ ppoll(NULL, 0, &ts, &ss);
+ }
+
+ return NULL;
+}
+
+int
+main()
+{
+ pthread_t thr;
+ int ret = pthread_create(&thr, NULL, mythr, NULL);
+ if (ret != 0) {
+ fprintf(stderr, "pthread_create failed\n");
+ return 1;
+ }
+
+ pthread_mutex_lock(&mutex);
+ while (ready == 0) {
+ pthread_cond_wait(&cond, &mutex);
+ }
+ pthread_mutex_unlock(&mutex);
+
+ alarm(1); /* Unhandled SIGALRM should cause exit. */
+ while (1)
+ sleep(1);
+
+ return 0;
+}
diff --git a/none/tests/ppoll_alarm.stderr.exp b/none/tests/ppoll_alarm.stderr.exp
new file mode 100644
index 0000000..e69de29
diff --git a/none/tests/ppoll_alarm.stdout.exp b/none/tests/ppoll_alarm.stdout.exp
new file mode 100644
index 0000000..e69de29
diff --git a/none/tests/ppoll_alarm.vgtest b/none/tests/ppoll_alarm.vgtest
new file mode 100644
index 0000000..b1309d3
--- /dev/null
+++ b/none/tests/ppoll_alarm.vgtest
@@ -0,0 +1,3 @@
+prog: ppoll_alarm
+vgopts: -q
+stderr_filter: filter_stderr
diff --git a/none/tests/pselect_alarm.c b/none/tests/pselect_alarm.c
new file mode 100644
index 0000000..7a68ec0
--- /dev/null
+++ b/none/tests/pselect_alarm.c
@@ -0,0 +1,61 @@
+/* Tries to exploit bug in pselect mask handling:
+ https://bugs.kde.org/show_bug.cgi?id=359871
+ where client program was able to successfully block VG_SIGVGKILL. */
+
+#include <sys/select.h>
+#include <assert.h>
+#include <errno.h>
+#include <pthread.h>
+#include <signal.h>
+#include <stdio.h>
+#include <unistd.h>
+
+static int ready = 0;
+static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+
+static void *
+mythr(void *ignore)
+{
+ pthread_mutex_lock(&mutex);
+ ready = 1;
+ pthread_cond_signal(&cond);
+ pthread_mutex_unlock(&mutex);
+
+ sigset_t ss;
+ sigfillset(&ss);
+ while (1) {
+ struct timespec ts = {10000, 0};
+ pselect(0, NULL, NULL, NULL, &ts, &ss);
+ }
+
+ return NULL;
+}
+
+int
+main()
+{
+ pthread_t thr;
+ int ret = pthread_create(&thr, NULL, mythr, NULL);
+ if (ret != 0) {
+ fprintf(stderr, "pthread_create failed\n");
+ return 1;
+ }
+
+ pthread_mutex_lock(&mutex);
+ while (ready == 0) {
+ pthread_cond_wait(&cond, &mutex);
+ }
+ pthread_mutex_unlock(&mutex);
+
+#if defined(VGO_linux)
+ assert(pselect(0, NULL, NULL, NULL, NULL, (sigset_t *)12) == -1);
+ assert(errno == EFAULT);
+#endif
+
+ alarm(1); /* Unhandled SIGALRM should cause exit. */
+ while (1)
+ sleep(1);
+
+ return 0;
+}
diff --git a/none/tests/pselect_alarm.stderr.exp b/none/tests/pselect_alarm.stderr.exp
new file mode 100644
index 0000000..e69de29
diff --git a/none/tests/pselect_alarm.stdout.exp b/none/tests/pselect_alarm.stdout.exp
new file mode 100644
index 0000000..e69de29
diff --git a/none/tests/pselect_alarm.vgtest b/none/tests/pselect_alarm.vgtest
new file mode 100644
index 0000000..84cc674
--- /dev/null
+++ b/none/tests/pselect_alarm.vgtest
@@ -0,0 +1,3 @@
+prog: pselect_alarm
+vgopts: -q
+stderr_filter: filter_stderr
diff --git a/tests/filter_stderr_basic b/tests/filter_stderr_basic
index 472cd8f..4b6e480 100755
--- a/tests/filter_stderr_basic
+++ b/tests/filter_stderr_basic
@@ -46,7 +46,7 @@ sed "/warning: line info addresses out of order/d" |
# of the bash process. Newer bash versions redirect such messages properly.
# Suppress any redirected abnormal termination messages. You can find the
# complete list of messages in the bash source file siglist.c.
-perl -n -e 'print if !/^(Segmentation fault|Alarm clock|Aborted|Bus error)( \(core dumped\))?$/' |
+perl -n -e 'print if !/^(Segmentation fault|Alarm clock|Aborted|Bus error|Killed)( \(core dumped\))?$/' |
# Similar as above, but for ksh on Solaris/illumos.
perl -n -e 'print if !/^(Memory fault|Killed) $/' |
Only in valgrind-3.11.0: autom4te.cache
diff -ru valgrind-3.11.0.orig/none/tests/Makefile.in valgrind-3.11.0/none/tests/Makefile.in
--- valgrind-3.11.0.orig/none/tests/Makefile.in 2016-03-09 20:07:53.451112914 +0100
+++ valgrind-3.11.0/none/tests/Makefile.in 2016-03-09 20:09:44.281584703 +0100
@@ -151,7 +151,8 @@
libvexmultiarch_test$(EXEEXT) manythreads$(EXEEXT) \
mmap_fcntl_bug$(EXEEXT) munmap_exe$(EXEEXT) \
map_unaligned$(EXEEXT) map_unmap$(EXEEXT) mq$(EXEEXT) \
- pending$(EXEEXT) procfs-cmdline-exe$(EXEEXT) \
+ pending$(EXEEXT) ppoll_alarm$(EXEEXT) \
+ procfs-cmdline-exe$(EXEEXT) pselect_alarm$(EXEEXT) \
pth_atfork1$(EXEEXT) pth_blockedsig$(EXEEXT) \
pth_cancel1$(EXEEXT) pth_cancel2$(EXEEXT) \
pth_cvsimple$(EXEEXT) pth_empty$(EXEEXT) pth_exit$(EXEEXT) \
@@ -329,12 +330,18 @@
pending_SOURCES = pending.c
pending_OBJECTS = pending.$(OBJEXT)
pending_LDADD = $(LDADD)
+ppoll_alarm_SOURCES = ppoll_alarm.c
+ppoll_alarm_OBJECTS = ppoll_alarm.$(OBJEXT)
+ppoll_alarm_DEPENDENCIES =
process_vm_readv_writev_SOURCES = process_vm_readv_writev.c
process_vm_readv_writev_OBJECTS = process_vm_readv_writev.$(OBJEXT)
process_vm_readv_writev_LDADD = $(LDADD)
procfs_cmdline_exe_SOURCES = procfs-cmdline-exe.c
procfs_cmdline_exe_OBJECTS = procfs-cmdline-exe.$(OBJEXT)
procfs_cmdline_exe_LDADD = $(LDADD)
+pselect_alarm_SOURCES = pselect_alarm.c
+pselect_alarm_OBJECTS = pselect_alarm.$(OBJEXT)
+pselect_alarm_DEPENDENCIES =
pth_atfork1_SOURCES = pth_atfork1.c
pth_atfork1_OBJECTS = pth_atfork1.$(OBJEXT)
pth_atfork1_DEPENDENCIES =
@@ -527,18 +534,18 @@
$(gxx304_SOURCES) ifunc.c ioctl_moans.c libvex_test.c \
$(libvexmultiarch_test_SOURCES) manythreads.c map_unaligned.c \
map_unmap.c mmap_fcntl_bug.c mq.c munmap_exe.c nestedfns.c \
- pending.c process_vm_readv_writev.c procfs-cmdline-exe.c \
- pth_atfork1.c pth_blockedsig.c pth_cancel1.c pth_cancel2.c \
- pth_cvsimple.c pth_empty.c pth_exit.c pth_exit2.c \
- pth_mutexspeed.c pth_once.c pth_rwlock.c pth_stackalign.c \
- rcrl.c readline1.c require-text-symbol.c res_search.c resolv.c \
- rlimit64_nofile.c rlimit_nofile.c selfrun.c sem.c semlimit.c \
- sha1_test.c shortpush.c shorts.c sigstackgrowth.c \
- stackgrowth.c syscall-restart1.c syscall-restart2.c syslog.c \
- system.c thread-exits.c threaded-fork.c threadederrno.c \
- timestamp.c $(tls_SOURCES) $(tls_so_SOURCES) \
- $(tls2_so_SOURCES) unit_debuglog.c \
- $(valgrind_cpp_test_SOURCES) vgprintf.c
+ pending.c ppoll_alarm.c process_vm_readv_writev.c \
+ procfs-cmdline-exe.c pselect_alarm.c pth_atfork1.c \
+ pth_blockedsig.c pth_cancel1.c pth_cancel2.c pth_cvsimple.c \
+ pth_empty.c pth_exit.c pth_exit2.c pth_mutexspeed.c pth_once.c \
+ pth_rwlock.c pth_stackalign.c rcrl.c readline1.c \
+ require-text-symbol.c res_search.c resolv.c rlimit64_nofile.c \
+ rlimit_nofile.c selfrun.c sem.c semlimit.c sha1_test.c \
+ shortpush.c shorts.c sigstackgrowth.c stackgrowth.c \
+ syscall-restart1.c syscall-restart2.c syslog.c system.c \
+ thread-exits.c threaded-fork.c threadederrno.c timestamp.c \
+ $(tls_SOURCES) $(tls_so_SOURCES) $(tls2_so_SOURCES) \
+ unit_debuglog.c $(valgrind_cpp_test_SOURCES) vgprintf.c
DIST_SOURCES = ansi.c args.c async-sigs.c bitfield1.c bug129866.c \
bug234814.c closeall.c $(coolo_sigaction_SOURCES) \
coolo_strlen.c discard.c exec-sigmask.c execve.c faultstatus.c \
@@ -548,18 +555,18 @@
$(gxx304_SOURCES) ifunc.c ioctl_moans.c libvex_test.c \
$(libvexmultiarch_test_SOURCES) manythreads.c map_unaligned.c \
map_unmap.c mmap_fcntl_bug.c mq.c munmap_exe.c nestedfns.c \
- pending.c process_vm_readv_writev.c procfs-cmdline-exe.c \
- pth_atfork1.c pth_blockedsig.c pth_cancel1.c pth_cancel2.c \
- pth_cvsimple.c pth_empty.c pth_exit.c pth_exit2.c \
- pth_mutexspeed.c pth_once.c pth_rwlock.c pth_stackalign.c \
- rcrl.c readline1.c require-text-symbol.c res_search.c resolv.c \
- rlimit64_nofile.c rlimit_nofile.c selfrun.c sem.c semlimit.c \
- sha1_test.c shortpush.c shorts.c sigstackgrowth.c \
- stackgrowth.c syscall-restart1.c syscall-restart2.c syslog.c \
- system.c thread-exits.c threaded-fork.c threadederrno.c \
- timestamp.c $(tls_SOURCES) $(tls_so_SOURCES) \
- $(tls2_so_SOURCES) unit_debuglog.c \
- $(valgrind_cpp_test_SOURCES) vgprintf.c
+ pending.c ppoll_alarm.c process_vm_readv_writev.c \
+ procfs-cmdline-exe.c pselect_alarm.c pth_atfork1.c \
+ pth_blockedsig.c pth_cancel1.c pth_cancel2.c pth_cvsimple.c \
+ pth_empty.c pth_exit.c pth_exit2.c pth_mutexspeed.c pth_once.c \
+ pth_rwlock.c pth_stackalign.c rcrl.c readline1.c \
+ require-text-symbol.c res_search.c resolv.c rlimit64_nofile.c \
+ rlimit_nofile.c selfrun.c sem.c semlimit.c sha1_test.c \
+ shortpush.c shorts.c sigstackgrowth.c stackgrowth.c \
+ syscall-restart1.c syscall-restart2.c syslog.c system.c \
+ thread-exits.c threaded-fork.c threadederrno.c timestamp.c \
+ $(tls_SOURCES) $(tls_so_SOURCES) $(tls2_so_SOURCES) \
+ unit_debuglog.c $(valgrind_cpp_test_SOURCES) vgprintf.c
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
ctags-recursive dvi-recursive html-recursive info-recursive \
install-data-recursive install-dvi-recursive \
@@ -1072,12 +1079,14 @@
nestedfns.stderr.exp nestedfns.stdout.exp nestedfns.vgtest \
nodir.stderr.exp nodir.vgtest \
pending.stdout.exp pending.stderr.exp pending.vgtest \
+ ppoll_alarm.stdout.exp ppoll_alarm.stderr.exp ppoll_alarm.vgtest \
procfs-linux.stderr.exp-with-readlinkat \
procfs-linux.stderr.exp-without-readlinkat \
procfs-linux.vgtest \
procfs-non-linux.vgtest \
procfs-non-linux.stderr.exp-with-readlinkat \
procfs-non-linux.stderr.exp-without-readlinkat \
+ pselect_alarm.stdout.exp pselect_alarm.stderr.exp pselect_alarm.vgtest \
pth_atfork1.stderr.exp pth_atfork1.stdout.exp pth_atfork1.vgtest \
pth_blockedsig.stderr.exp \
pth_blockedsig.stdout.exp pth_blockedsig.vgtest \
@@ -1152,6 +1161,8 @@
../../VEX/libvex-@VGCONF_ARCH_PRI@-@VGCONF_OS@.a @LIB_UBSAN@
libvexmultiarch_test_SOURCES = libvex_test.c
+ppoll_alarm_LDADD = -lpthread
+pselect_alarm_LDADD = -lpthread
pth_atfork1_LDADD = -lpthread
pth_blockedsig_LDADD = -lpthread
pth_cancel1_CFLAGS = $(AM_CFLAGS) -Wno-shadow
@@ -1390,6 +1401,10 @@
@rm -f pending$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(pending_OBJECTS) $(pending_LDADD) $(LIBS)
+ppoll_alarm$(EXEEXT): $(ppoll_alarm_OBJECTS) $(ppoll_alarm_DEPENDENCIES) $(EXTRA_ppoll_alarm_DEPENDENCIES)
+ @rm -f ppoll_alarm$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(ppoll_alarm_OBJECTS) $(ppoll_alarm_LDADD) $(LIBS)
+
process_vm_readv_writev$(EXEEXT): $(process_vm_readv_writev_OBJECTS) $(process_vm_readv_writev_DEPENDENCIES) $(EXTRA_process_vm_readv_writev_DEPENDENCIES)
@rm -f process_vm_readv_writev$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(process_vm_readv_writev_OBJECTS) $(process_vm_readv_writev_LDADD) $(LIBS)
@@ -1398,6 +1413,10 @@
@rm -f procfs-cmdline-exe$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(procfs_cmdline_exe_OBJECTS) $(procfs_cmdline_exe_LDADD) $(LIBS)
+pselect_alarm$(EXEEXT): $(pselect_alarm_OBJECTS) $(pselect_alarm_DEPENDENCIES) $(EXTRA_pselect_alarm_DEPENDENCIES)
+ @rm -f pselect_alarm$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(pselect_alarm_OBJECTS) $(pselect_alarm_LDADD) $(LIBS)
+
pth_atfork1$(EXEEXT): $(pth_atfork1_OBJECTS) $(pth_atfork1_DEPENDENCIES) $(EXTRA_pth_atfork1_DEPENDENCIES)
@rm -f pth_atfork1$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(pth_atfork1_OBJECTS) $(pth_atfork1_LDADD) $(LIBS)
@@ -1607,8 +1626,10 @@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/munmap_exe.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nestedfns-nestedfns.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pending.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppoll_alarm.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/process_vm_readv_writev.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/procfs-cmdline-exe.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pselect_alarm.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pth_atfork1.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pth_blockedsig.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pth_cancel1-pth_cancel1.Po@am__quote@
commit 8c67aa7a7fb1a125e75937ad438d5f9a8fd20c5d
Author: mjw <mjw@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Tue Jun 21 19:58:21 2016 +0000
Bug 364413 pselect sycallwrapper mishandles NULL sigmask.
Don't check or try to copy sigmask if it is NULL. The sigmask might be
given in a struct, where the length is non-zero, but the signal set
pointer is NULL.
Testcase provided by Paul Eggert <eggert@cs.ucla.edu>.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15893 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c
index 24a5ae9..9ace4fd 100644
--- a/coregrind/m_syswrap/syswrap-linux.c
+++ b/coregrind/m_syswrap/syswrap-linux.c
@@ -1316,11 +1316,15 @@ PRE(sys_pselect6)
pas->ss.ss = (void *)1;
pas->ss.ss_len = pss->ss_len;
if (pss->ss_len == sizeof(*pss->ss)) {
- PRE_MEM_READ("pselect6(sig->ss)", (Addr)pss->ss, pss->ss_len);
- if (ML_(safe_to_deref)(pss->ss, sizeof(*pss->ss))) {
- pas->adjusted_ss = *pss->ss;
- pas->ss.ss = &pas->adjusted_ss;
- VG_(sanitize_client_sigmask)(&pas->adjusted_ss);
+ if (pss->ss == NULL) {
+ pas->ss.ss = NULL;
+ } else {
+ PRE_MEM_READ("pselect6(sig->ss)", (Addr)pss->ss, pss->ss_len);
+ if (ML_(safe_to_deref)(pss->ss, sizeof(*pss->ss))) {
+ pas->adjusted_ss = *pss->ss;
+ pas->ss.ss = &pas->adjusted_ss;
+ VG_(sanitize_client_sigmask)(&pas->adjusted_ss);
+ }
}
}
}
diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am
index 0e11492..684c1af 100644
--- a/none/tests/Makefile.am
+++ b/none/tests/Makefile.am
@@ -150,6 +150,8 @@ EXTRA_DIST = \
procfs-non-linux.stderr.exp-with-readlinkat \
procfs-non-linux.stderr.exp-without-readlinkat \
pselect_alarm.stdout.exp pselect_alarm.stderr.exp pselect_alarm.vgtest \
+ pselect_signask_null.vgtest \
+ pselect_sigmask_null.stdout.exp pselect_sigmask_null.stderr.exp \
pth_atfork1.stderr.exp pth_atfork1.stdout.exp pth_atfork1.vgtest \
pth_blockedsig.stderr.exp \
pth_blockedsig.stdout.exp pth_blockedsig.vgtest \
@@ -222,6 +222,7 @@
ppoll_alarm \
procfs-cmdline-exe \
pselect_alarm \
+ pselect_sigmask_null \
pth_atfork1 pth_blockedsig pth_cancel1 pth_cancel2 pth_cvsimple \
pth_empty pth_exit pth_exit2 pth_mutexspeed pth_once pth_rwlock \
pth_stackalign \
diff --git a/none/tests/pselect_sigmask_null.c b/none/tests/pselect_sigmask_null.c
new file mode 100644
index 0000000..34bd584
--- /dev/null
+++ b/none/tests/pselect_sigmask_null.c
@@ -0,0 +1,26 @@
+/* Make sure handling of NULL sigmask is correct.
+ https://bugs.kde.org/show_bug.cgi?id=XXX
+ We might try to make a copy and adjust the mask.
+ Testcase provided by Paul Eggert <eggert@cs.ucla.edu> */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/select.h>
+
+int
+main (void)
+{
+ struct timespec timeout;
+ timeout.tv_sec = 1;
+ timeout.tv_nsec = 0;
+ switch (pselect (0, 0, 0, 0, &timeout, 0))
+ {
+ default:
+ abort ();
+ case -1:
+ perror ("pselect");
+ return 1;
+ case 0:
+ return 0;
+ }
+}
diff --git a/none/tests/pselect_sigmask_null.stderr.exp b/none/tests/pselect_sigmask_null.stderr.exp
new file mode 100644
index 0000000..e69de29
diff --git a/none/tests/pselect_sigmask_null.stdout.exp b/none/tests/pselect_sigmask_null.stdout.exp
new file mode 100644
index 0000000..e69de29
diff --git a/none/tests/pselect_sigmask_null.vgtest b/none/tests/pselect_sigmask_null.vgtest
new file mode 100644
index 0000000..e59688c
--- /dev/null
+++ b/none/tests/pselect_sigmask_null.vgtest
@@ -0,0 +1,2 @@
+prog: pselect_sigmask_null
+vgopts: -q
commit d41bebeb1e561ddfac17d9be65b29aa5bb3ebaf8
Author: mjw <mjw@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Tue Jun 21 21:06:27 2016 +0000
Bug 364413 followup - fix signask -> sigmask typo in EXTRA_DIST
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15894 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am
index 684c1af..7059e67 100644
--- a/none/tests/Makefile.am
+++ b/none/tests/Makefile.am
@@ -150,7 +150,7 @@ EXTRA_DIST = \
procfs-non-linux.stderr.exp-with-readlinkat \
procfs-non-linux.stderr.exp-without-readlinkat \
pselect_alarm.stdout.exp pselect_alarm.stderr.exp pselect_alarm.vgtest \
- pselect_signask_null.vgtest \
+ pselect_sigmask_null.vgtest \
pselect_sigmask_null.stdout.exp pselect_sigmask_null.stderr.exp \
pth_atfork1.stderr.exp pth_atfork1.stdout.exp pth_atfork1.vgtest \
pth_blockedsig.stderr.exp \
Only in valgrind-3.11.0: autom4te.cache
diff -ur valgrind-3.11.0.orig/none/tests/Makefile.in valgrind-3.11.0/none/tests/Makefile.in
--- valgrind-3.11.0.orig/none/tests/Makefile.in 2016-06-22 01:12:05.241643238 +0200
+++ valgrind-3.11.0/none/tests/Makefile.in 2016-06-22 01:16:22.545150491 +0200
@@ -153,12 +153,12 @@
map_unaligned$(EXEEXT) map_unmap$(EXEEXT) mq$(EXEEXT) \
pending$(EXEEXT) ppoll_alarm$(EXEEXT) \
procfs-cmdline-exe$(EXEEXT) pselect_alarm$(EXEEXT) \
- pth_atfork1$(EXEEXT) pth_blockedsig$(EXEEXT) \
- pth_cancel1$(EXEEXT) pth_cancel2$(EXEEXT) \
- pth_cvsimple$(EXEEXT) pth_empty$(EXEEXT) pth_exit$(EXEEXT) \
- pth_exit2$(EXEEXT) pth_mutexspeed$(EXEEXT) pth_once$(EXEEXT) \
- pth_rwlock$(EXEEXT) pth_stackalign$(EXEEXT) rcrl$(EXEEXT) \
- readline1$(EXEEXT) require-text-symbol$(EXEEXT) \
+ pselect_sigmask_null$(EXEEXT) pth_atfork1$(EXEEXT) \
+ pth_blockedsig$(EXEEXT) pth_cancel1$(EXEEXT) \
+ pth_cancel2$(EXEEXT) pth_cvsimple$(EXEEXT) pth_empty$(EXEEXT) \
+ pth_exit$(EXEEXT) pth_exit2$(EXEEXT) pth_mutexspeed$(EXEEXT) \
+ pth_once$(EXEEXT) pth_rwlock$(EXEEXT) pth_stackalign$(EXEEXT) \
+ rcrl$(EXEEXT) readline1$(EXEEXT) require-text-symbol$(EXEEXT) \
res_search$(EXEEXT) resolv$(EXEEXT) rlimit_nofile$(EXEEXT) \
selfrun$(EXEEXT) sem$(EXEEXT) semlimit$(EXEEXT) \
sha1_test$(EXEEXT) shortpush$(EXEEXT) shorts$(EXEEXT) \
@@ -342,6 +342,9 @@
pselect_alarm_SOURCES = pselect_alarm.c
pselect_alarm_OBJECTS = pselect_alarm.$(OBJEXT)
pselect_alarm_DEPENDENCIES =
+pselect_sigmask_null_SOURCES = pselect_sigmask_null.c
+pselect_sigmask_null_OBJECTS = pselect_sigmask_null.$(OBJEXT)
+pselect_sigmask_null_LDADD = $(LDADD)
pth_atfork1_SOURCES = pth_atfork1.c
pth_atfork1_OBJECTS = pth_atfork1.$(OBJEXT)
pth_atfork1_DEPENDENCIES =
@@ -535,17 +538,18 @@
$(libvexmultiarch_test_SOURCES) manythreads.c map_unaligned.c \
map_unmap.c mmap_fcntl_bug.c mq.c munmap_exe.c nestedfns.c \
pending.c ppoll_alarm.c process_vm_readv_writev.c \
- procfs-cmdline-exe.c pselect_alarm.c pth_atfork1.c \
- pth_blockedsig.c pth_cancel1.c pth_cancel2.c pth_cvsimple.c \
- pth_empty.c pth_exit.c pth_exit2.c pth_mutexspeed.c pth_once.c \
- pth_rwlock.c pth_stackalign.c rcrl.c readline1.c \
- require-text-symbol.c res_search.c resolv.c rlimit64_nofile.c \
- rlimit_nofile.c selfrun.c sem.c semlimit.c sha1_test.c \
- shortpush.c shorts.c sigstackgrowth.c stackgrowth.c \
- syscall-restart1.c syscall-restart2.c syslog.c system.c \
- thread-exits.c threaded-fork.c threadederrno.c timestamp.c \
- $(tls_SOURCES) $(tls_so_SOURCES) $(tls2_so_SOURCES) \
- unit_debuglog.c $(valgrind_cpp_test_SOURCES) vgprintf.c
+ procfs-cmdline-exe.c pselect_alarm.c pselect_sigmask_null.c \
+ pth_atfork1.c pth_blockedsig.c pth_cancel1.c pth_cancel2.c \
+ pth_cvsimple.c pth_empty.c pth_exit.c pth_exit2.c \
+ pth_mutexspeed.c pth_once.c pth_rwlock.c pth_stackalign.c \
+ rcrl.c readline1.c require-text-symbol.c res_search.c resolv.c \
+ rlimit64_nofile.c rlimit_nofile.c selfrun.c sem.c semlimit.c \
+ sha1_test.c shortpush.c shorts.c sigstackgrowth.c \
+ stackgrowth.c syscall-restart1.c syscall-restart2.c syslog.c \
+ system.c thread-exits.c threaded-fork.c threadederrno.c \
+ timestamp.c $(tls_SOURCES) $(tls_so_SOURCES) \
+ $(tls2_so_SOURCES) unit_debuglog.c \
+ $(valgrind_cpp_test_SOURCES) vgprintf.c
DIST_SOURCES = ansi.c args.c async-sigs.c bitfield1.c bug129866.c \
bug234814.c closeall.c $(coolo_sigaction_SOURCES) \
coolo_strlen.c discard.c exec-sigmask.c execve.c faultstatus.c \
@@ -556,17 +560,18 @@
$(libvexmultiarch_test_SOURCES) manythreads.c map_unaligned.c \
map_unmap.c mmap_fcntl_bug.c mq.c munmap_exe.c nestedfns.c \
pending.c ppoll_alarm.c process_vm_readv_writev.c \
- procfs-cmdline-exe.c pselect_alarm.c pth_atfork1.c \
- pth_blockedsig.c pth_cancel1.c pth_cancel2.c pth_cvsimple.c \
- pth_empty.c pth_exit.c pth_exit2.c pth_mutexspeed.c pth_once.c \
- pth_rwlock.c pth_stackalign.c rcrl.c readline1.c \
- require-text-symbol.c res_search.c resolv.c rlimit64_nofile.c \
- rlimit_nofile.c selfrun.c sem.c semlimit.c sha1_test.c \
- shortpush.c shorts.c sigstackgrowth.c stackgrowth.c \
- syscall-restart1.c syscall-restart2.c syslog.c system.c \
- thread-exits.c threaded-fork.c threadederrno.c timestamp.c \
- $(tls_SOURCES) $(tls_so_SOURCES) $(tls2_so_SOURCES) \
- unit_debuglog.c $(valgrind_cpp_test_SOURCES) vgprintf.c
+ procfs-cmdline-exe.c pselect_alarm.c pselect_sigmask_null.c \
+ pth_atfork1.c pth_blockedsig.c pth_cancel1.c pth_cancel2.c \
+ pth_cvsimple.c pth_empty.c pth_exit.c pth_exit2.c \
+ pth_mutexspeed.c pth_once.c pth_rwlock.c pth_stackalign.c \
+ rcrl.c readline1.c require-text-symbol.c res_search.c resolv.c \
+ rlimit64_nofile.c rlimit_nofile.c selfrun.c sem.c semlimit.c \
+ sha1_test.c shortpush.c shorts.c sigstackgrowth.c \
+ stackgrowth.c syscall-restart1.c syscall-restart2.c syslog.c \
+ system.c thread-exits.c threaded-fork.c threadederrno.c \
+ timestamp.c $(tls_SOURCES) $(tls_so_SOURCES) \
+ $(tls2_so_SOURCES) unit_debuglog.c \
+ $(valgrind_cpp_test_SOURCES) vgprintf.c
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
ctags-recursive dvi-recursive html-recursive info-recursive \
install-data-recursive install-dvi-recursive \
@@ -1087,6 +1092,8 @@
procfs-non-linux.stderr.exp-with-readlinkat \
procfs-non-linux.stderr.exp-without-readlinkat \
pselect_alarm.stdout.exp pselect_alarm.stderr.exp pselect_alarm.vgtest \
+ pselect_sigmask_null.vgtest \
+ pselect_sigmask_null.stdout.exp pselect_sigmask_null.stderr.exp \
pth_atfork1.stderr.exp pth_atfork1.stdout.exp pth_atfork1.vgtest \
pth_blockedsig.stderr.exp \
pth_blockedsig.stdout.exp pth_blockedsig.vgtest \
@@ -1417,6 +1424,10 @@
@rm -f pselect_alarm$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(pselect_alarm_OBJECTS) $(pselect_alarm_LDADD) $(LIBS)
+pselect_sigmask_null$(EXEEXT): $(pselect_sigmask_null_OBJECTS) $(pselect_sigmask_null_DEPENDENCIES) $(EXTRA_pselect_sigmask_null_DEPENDENCIES)
+ @rm -f pselect_sigmask_null$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(pselect_sigmask_null_OBJECTS) $(pselect_sigmask_null_LDADD) $(LIBS)
+
pth_atfork1$(EXEEXT): $(pth_atfork1_OBJECTS) $(pth_atfork1_DEPENDENCIES) $(EXTRA_pth_atfork1_DEPENDENCIES)
@rm -f pth_atfork1$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(pth_atfork1_OBJECTS) $(pth_atfork1_LDADD) $(LIBS)
@@ -1630,6 +1641,7 @@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/process_vm_readv_writev.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/procfs-cmdline-exe.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pselect_alarm.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pselect_sigmask_null.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pth_atfork1.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pth_blockedsig.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pth_cancel1-pth_cancel1.Po@am__quote@

View File

@ -1,757 +0,0 @@
commit f4d91a5df8b749c6cdfec25e38a44c02c90ad4be
Author: Mark Wielaard <mjw@redhat.com>
Date: Tue Jan 19 15:13:47 2016 +0100
Bug #358213 helgrind/drd pthread_barrier tests vs new glibc implementation
glibc 2.23 will have a new pthread_barrier implementation.
This implementation reacts differently on bad usage of barriers.
Because of this the bar_bad testcase will hang indefinitely.
In particular pthread_barrier_destroy will hang when there are
still other threads waiting on a barrier. To solve this we add
extra threads to will "unblock" the hanging destroy by sleeping
for a while and then also waiting on the barrier, which will unblock
the destroy operation. Or if this is the last test, just exit
the whole program since we are done anyway. Also newer glibc is
more picky about destroying uninitialized barriers, we would crash
when zero filling, so we now one fill. Which doesn't crash, but
depending on glibc version might return an error or hang. Since
depending on version we now get slightly different error reports
there are now alternative exp files.
Tested against glibc 2.17, glibc 2.22 and glibc 2.23-prerelease.
diff --git a/drd/tests/Makefile.am b/drd/tests/Makefile.am
index 2885391..cfd74d0 100644
--- a/drd/tests/Makefile.am
+++ b/drd/tests/Makefile.am
@@ -81,8 +81,10 @@ EXTRA_DIST = \
atomic_var.stderr.exp \
atomic_var.vgtest \
bar_bad.stderr.exp \
+ bar_bad.stderr.exp-nohang \
bar_bad.vgtest \
bar_bad_xml.stderr.exp \
+ bar_bad_xml.stderr.exp-nohang \
bar_bad_xml.vgtest \
bar_trivial.stderr.exp \
bar_trivial.stdout.exp \
diff --git a/drd/tests/bar_bad.stderr.exp b/drd/tests/bar_bad.stderr.exp
index 75f121f..3581b08 100644
--- a/drd/tests/bar_bad.stderr.exp
+++ b/drd/tests/bar_bad.stderr.exp
@@ -34,16 +34,5 @@ barrier 0x........ was first observed at:
destroy a barrier that was never initialised
-Not a barrier
- at 0x........: pthread_barrier_destroy (drd_pthread_intercepts.c:?)
- by 0x........: main (bar_bad.c:?)
-
-Destruction of barrier that is being waited upon: barrier 0x........
- at 0x........: free (vg_replace_malloc.c:...)
- by 0x........: main (bar_bad.c:?)
-barrier 0x........ was first observed at:
- at 0x........: pthread_barrier_init (drd_pthread_intercepts.c:?)
- by 0x........: main (bar_bad.c:?)
-
-ERROR SUMMARY: 7 errors from 6 contexts (suppressed: 0 from 0)
+ERROR SUMMARY: 5 errors from 4 contexts (suppressed: 0 from 0)
diff --git a/drd/tests/bar_bad.stderr.exp-nohang b/drd/tests/bar_bad.stderr.exp-nohang
new file mode 100644
index 0000000..44f9651
--- /dev/null
+++ b/drd/tests/bar_bad.stderr.exp-nohang
@@ -0,0 +1,42 @@
+
+
+initialise a barrier with zero count
+pthread_barrier_init: 'count' argument is zero: barrier 0x........
+ at 0x........: pthread_barrier_init (drd_pthread_intercepts.c:?)
+ by 0x........: main (bar_bad.c:?)
+
+
+initialise a barrier twice
+Barrier reinitialization: barrier 0x........
+ at 0x........: pthread_barrier_init (drd_pthread_intercepts.c:?)
+ by 0x........: main (bar_bad.c:?)
+barrier 0x........ was first observed at:
+ at 0x........: pthread_barrier_init (drd_pthread_intercepts.c:?)
+ by 0x........: main (bar_bad.c:?)
+
+
+initialise a barrier which has threads waiting on it
+Barrier reinitialization: barrier 0x........
+ at 0x........: pthread_barrier_init (drd_pthread_intercepts.c:?)
+ by 0x........: main (bar_bad.c:?)
+barrier 0x........ was first observed at:
+ at 0x........: pthread_barrier_init (drd_pthread_intercepts.c:?)
+ by 0x........: main (bar_bad.c:?)
+
+
+destroy a barrier that has waiting threads
+Destruction of a barrier with active waiters: barrier 0x........
+ at 0x........: pthread_barrier_destroy (drd_pthread_intercepts.c:?)
+ by 0x........: main (bar_bad.c:?)
+barrier 0x........ was first observed at:
+ at 0x........: pthread_barrier_init (drd_pthread_intercepts.c:?)
+ by 0x........: main (bar_bad.c:?)
+
+
+destroy a barrier that was never initialised
+Not a barrier
+ at 0x........: pthread_barrier_destroy (drd_pthread_intercepts.c:?)
+ by 0x........: main (bar_bad.c:?)
+
+
+ERROR SUMMARY: 6 errors from 5 contexts (suppressed: 0 from 0)
diff --git a/drd/tests/bar_bad_xml.stderr.exp b/drd/tests/bar_bad_xml.stderr.exp
index acb9656..8539f75 100644
--- a/drd/tests/bar_bad_xml.stderr.exp
+++ b/drd/tests/bar_bad_xml.stderr.exp
@@ -204,78 +204,6 @@ destroy a barrier that has waiting threads
destroy a barrier that was never initialised
-<error>
- <unique>0x........</unique>
- <tid>...</tid>
- <kind>GenericErr</kind>
- <what>Not a barrier</what>
- <stack>
- <frame>
- <ip>0x........</ip>
- <obj>...</obj>
- <fn>pthread_barrier_destroy</fn>
- <dir>...</dir>
- <file>drd_pthread_intercepts.c</file>
- <line>...</line>
- </frame>
- <frame>
- <ip>0x........</ip>
- <obj>...</obj>
- <fn>main</fn>
- <dir>...</dir>
- <file>bar_bad.c</file>
- <line>...</line>
- </frame>
- </stack>
-</error>
-
-<error>
- <unique>0x........</unique>
- <tid>...</tid>
- <kind>BarrierErr</kind>
- <what>Destruction of barrier that is being waited upon: barrier 0x........</what>
- <stack>
- <frame>
- <ip>0x........</ip>
- <obj>...</obj>
- <fn>free</fn>
- <dir>...</dir>
- <file>vg_replace_malloc.c</file>
- <line>...</line>
- </frame>
- <frame>
- <ip>0x........</ip>
- <obj>...</obj>
- <fn>main</fn>
- <dir>...</dir>
- <file>bar_bad.c</file>
- <line>...</line>
- </frame>
- </stack>
- <first_observed_at>
- <what>barrier</what>
- <address>0x........</address>
- <stack>
- <frame>
- <ip>0x........</ip>
- <obj>...</obj>
- <fn>pthread_barrier_init</fn>
- <dir>...</dir>
- <file>drd_pthread_intercepts.c</file>
- <line>...</line>
- </frame>
- <frame>
- <ip>0x........</ip>
- <obj>...</obj>
- <fn>main</fn>
- <dir>...</dir>
- <file>bar_bad.c</file>
- <line>...</line>
- </frame>
- </stack>
- </first_observed_at>
-</error>
-
<status>
<state>FINISHED</state>
@@ -299,14 +227,6 @@ destroy a barrier that was never initialised
<count>...</count>
<unique>0x........</unique>
</pair>
- <pair>
- <count>...</count>
- <unique>0x........</unique>
- </pair>
- <pair>
- <count>...</count>
- <unique>0x........</unique>
- </pair>
</errorcounts>
<suppcounts>...</suppcounts>
diff --git a/drd/tests/bar_bad_xml.stderr.exp-nohang b/drd/tests/bar_bad_xml.stderr.exp-nohang
new file mode 100644
index 0000000..a47cd60
--- /dev/null
+++ b/drd/tests/bar_bad_xml.stderr.exp-nohang
@@ -0,0 +1,264 @@
+<?xml version="1.0"?>
+
+<valgrindoutput>
+
+<protocolversion>4</protocolversion>
+<protocoltool>drd</protocoltool>
+
+<preamble>
+ <line>...</line>
+ <line>...</line>
+ <line>...</line>
+ <line>...</line>
+</preamble>
+
+<pid>...</pid>
+<ppid>...</ppid>
+<tool>drd</tool>
+
+<args>
+ <vargv>...</vargv>
+ <argv>
+ <exe>./../../helgrind/tests/bar_bad</exe>
+ </argv>
+</args>
+
+<status>
+ <state>RUNNING</state>
+ <time>...</time>
+</status>
+
+
+initialise a barrier with zero count
+<error>
+ <unique>0x........</unique>
+ <tid>...</tid>
+ <kind>BarrierErr</kind>
+ <what>pthread_barrier_init: 'count' argument is zero: barrier 0x........</what>
+ <stack>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>pthread_barrier_init</fn>
+ <dir>...</dir>
+ <file>drd_pthread_intercepts.c</file>
+ <line>...</line>
+ </frame>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>main</fn>
+ <dir>...</dir>
+ <file>bar_bad.c</file>
+ <line>...</line>
+ </frame>
+ </stack>
+</error>
+
+
+initialise a barrier twice
+<error>
+ <unique>0x........</unique>
+ <tid>...</tid>
+ <kind>BarrierErr</kind>
+ <what>Barrier reinitialization: barrier 0x........</what>
+ <stack>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>pthread_barrier_init</fn>
+ <dir>...</dir>
+ <file>drd_pthread_intercepts.c</file>
+ <line>...</line>
+ </frame>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>main</fn>
+ <dir>...</dir>
+ <file>bar_bad.c</file>
+ <line>...</line>
+ </frame>
+ </stack>
+ <first_observed_at>
+ <what>barrier</what>
+ <address>0x........</address>
+ <stack>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>pthread_barrier_init</fn>
+ <dir>...</dir>
+ <file>drd_pthread_intercepts.c</file>
+ <line>...</line>
+ </frame>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>main</fn>
+ <dir>...</dir>
+ <file>bar_bad.c</file>
+ <line>...</line>
+ </frame>
+ </stack>
+ </first_observed_at>
+</error>
+
+
+initialise a barrier which has threads waiting on it
+<error>
+ <unique>0x........</unique>
+ <tid>...</tid>
+ <kind>BarrierErr</kind>
+ <what>Barrier reinitialization: barrier 0x........</what>
+ <stack>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>pthread_barrier_init</fn>
+ <dir>...</dir>
+ <file>drd_pthread_intercepts.c</file>
+ <line>...</line>
+ </frame>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>main</fn>
+ <dir>...</dir>
+ <file>bar_bad.c</file>
+ <line>...</line>
+ </frame>
+ </stack>
+ <first_observed_at>
+ <what>barrier</what>
+ <address>0x........</address>
+ <stack>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>pthread_barrier_init</fn>
+ <dir>...</dir>
+ <file>drd_pthread_intercepts.c</file>
+ <line>...</line>
+ </frame>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>main</fn>
+ <dir>...</dir>
+ <file>bar_bad.c</file>
+ <line>...</line>
+ </frame>
+ </stack>
+ </first_observed_at>
+</error>
+
+
+destroy a barrier that has waiting threads
+<error>
+ <unique>0x........</unique>
+ <tid>...</tid>
+ <kind>BarrierErr</kind>
+ <what>Destruction of a barrier with active waiters: barrier 0x........</what>
+ <stack>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>pthread_barrier_destroy</fn>
+ <dir>...</dir>
+ <file>drd_pthread_intercepts.c</file>
+ <line>...</line>
+ </frame>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>main</fn>
+ <dir>...</dir>
+ <file>bar_bad.c</file>
+ <line>...</line>
+ </frame>
+ </stack>
+ <first_observed_at>
+ <what>barrier</what>
+ <address>0x........</address>
+ <stack>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>pthread_barrier_init</fn>
+ <dir>...</dir>
+ <file>drd_pthread_intercepts.c</file>
+ <line>...</line>
+ </frame>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>main</fn>
+ <dir>...</dir>
+ <file>bar_bad.c</file>
+ <line>...</line>
+ </frame>
+ </stack>
+ </first_observed_at>
+</error>
+
+
+destroy a barrier that was never initialised
+<error>
+ <unique>0x........</unique>
+ <tid>...</tid>
+ <kind>GenericErr</kind>
+ <what>Not a barrier</what>
+ <stack>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>pthread_barrier_destroy</fn>
+ <dir>...</dir>
+ <file>drd_pthread_intercepts.c</file>
+ <line>...</line>
+ </frame>
+ <frame>
+ <ip>0x........</ip>
+ <obj>...</obj>
+ <fn>main</fn>
+ <dir>...</dir>
+ <file>bar_bad.c</file>
+ <line>...</line>
+ </frame>
+ </stack>
+</error>
+
+
+<status>
+ <state>FINISHED</state>
+ <time>...</time>
+</status>
+
+<errorcounts>
+ <pair>
+ <count>...</count>
+ <unique>0x........</unique>
+ </pair>
+ <pair>
+ <count>...</count>
+ <unique>0x........</unique>
+ </pair>
+ <pair>
+ <count>...</count>
+ <unique>0x........</unique>
+ </pair>
+ <pair>
+ <count>...</count>
+ <unique>0x........</unique>
+ </pair>
+ <pair>
+ <count>...</count>
+ <unique>0x........</unique>
+ </pair>
+</errorcounts>
+
+<suppcounts>...</suppcounts>
+
+</valgrindoutput>
+
diff --git a/helgrind/tests/Makefile.am b/helgrind/tests/Makefile.am
index 8a0d6e6..df82169 100644
--- a/helgrind/tests/Makefile.am
+++ b/helgrind/tests/Makefile.am
@@ -19,6 +19,7 @@ EXTRA_DIST = \
cond_timedwait_test.vgtest cond_timedwait_test.stdout.exp \
cond_timedwait_test.stderr.exp \
bar_bad.vgtest bar_bad.stdout.exp bar_bad.stderr.exp \
+ bar_bad.stderr.exp-destroy-hang \
bar_trivial.vgtest bar_trivial.stdout.exp bar_trivial.stderr.exp \
free_is_write.vgtest free_is_write.stdout.exp \
free_is_write.stderr.exp \
diff --git a/helgrind/tests/bar_bad.c b/helgrind/tests/bar_bad.c
index dd6079c..424ae2f 100644
--- a/helgrind/tests/bar_bad.c
+++ b/helgrind/tests/bar_bad.c
@@ -15,23 +15,27 @@ void* child1 ( void* arg )
return NULL;
}
+void *sleep1 ( void* arg )
+{
+ /* Long sleep, we hope to never trigger. */
+ sleep (6);
+ pthread_barrier_wait ( (pthread_barrier_t*)arg );
+ return NULL;
+}
+
+void *exit1 ( void* arg )
+{
+ /* Sleep a bit, then exit, we are done. */
+ sleep (1);
+ exit (0);
+ return NULL;
+}
+
int main ( void )
{
pthread_barrier_t *bar1, *bar2, *bar3, *bar4, *bar5;
- pthread_t thr1, thr2;
int r;
-
- /* possibly set up a watchdog timer thread here. */
-
-
-
-
-
-
-
-
-
-
+ pthread_t thr1, thr2, slp1, slp2, ext1;
/* initialise a barrier with a zero count */
fprintf(stderr, "\ninitialise a barrier with zero count\n");
@@ -49,6 +53,9 @@ int main ( void )
fprintf(stderr, "\ninitialise a barrier which has threads waiting on it\n");
bar3 = malloc(sizeof(pthread_barrier_t));
pthread_barrier_init(bar3, NULL, 2);
+ /* create a thread, whose purpose is to "unblock" the barrier after
+ some sleeping in case it keeps being blocked. */
+ pthread_create(&slp1, NULL, sleep1, (void*)bar3);
/* create a thread, whose only purpose is to block on the barrier */
pthread_create(&thr1, NULL, child1, (void*)bar3);
/* guarantee that it gets there first */
@@ -61,6 +68,12 @@ int main ( void )
/* once again, create a thread, whose only purpose is to block. */
bar4 = malloc(sizeof(pthread_barrier_t));
pthread_barrier_init(bar4, NULL, 2);
+ /* create a thread, whose purpose is to "unblock" the barrier after
+ some sleeping in case it keeps being blocked. We hope it isn't
+ needed, but if it is, because pthread_barier_destroy hangs
+ and we will get an extra warning about the barrier being already
+ destroyed. */
+ pthread_create(&slp2, NULL, sleep1, (void*)bar4);
/* create a thread, whose only purpose is to block on the barrier */
pthread_create(&thr2, NULL, child1, (void*)bar4);
/* guarantee that it gets there first */
@@ -70,13 +83,16 @@ int main ( void )
/* destroy a barrier that was never initialised. This is a bit
tricky, in that we have to fill the barrier with bytes which
- ensure that the pthread_barrier_destroy call doesn't hang for
- some reason. Zero-fill seems to work ok on amd64-linux (glibc
+ ensure that the pthread_barrier_destroy call doesn't crash for
+ some reason. One-fill seems to work ok on amd64-linux (glibc
2.8). */
fprintf(stderr, "\ndestroy a barrier that was never initialised\n");
+ /* Create a thread that just exits the process after some sleep.
+ We are really done at this point, even if we hang. */
+ pthread_create(&ext1, NULL, exit1, NULL);
bar5 = malloc(sizeof(pthread_barrier_t));
assert(bar5);
- memset(bar5, 0, sizeof(*bar5));
+ memset(bar5, 1, sizeof(*bar5));
pthread_barrier_destroy(bar5);
/* now we need to clean up the mess .. */
@@ -85,5 +101,6 @@ int main ( void )
free(bar1); free(bar2); free(bar3); free(bar4); free(bar5);
- return 0;
+ /* Use exit, we want to kill any "sleeper threads". */
+ exit (0);
}
diff --git a/helgrind/tests/bar_bad.stderr.exp b/helgrind/tests/bar_bad.stderr.exp
index 74af4fa..d0901b2 100644
--- a/helgrind/tests/bar_bad.stderr.exp
+++ b/helgrind/tests/bar_bad.stderr.exp
@@ -8,14 +8,14 @@ Thread #x is the program's root thread
Thread #x: pthread_barrier_init: 'count' argument is zero
at 0x........: pthread_barrier_init (hg_intercepts.c:...)
- by 0x........: main (bar_bad.c:39)
+ by 0x........: main (bar_bad.c:43)
----------------------------------------------------------------
Thread #x's call to pthread_barrier_init failed
with error code 22 (EINVAL: Invalid argument)
at 0x........: pthread_barrier_init (hg_intercepts.c:...)
- by 0x........: main (bar_bad.c:39)
+ by 0x........: main (bar_bad.c:43)
initialise a barrier twice
@@ -23,7 +23,7 @@ initialise a barrier twice
Thread #x: pthread_barrier_init: barrier is already initialised
at 0x........: pthread_barrier_init (hg_intercepts.c:...)
- by 0x........: main (bar_bad.c:45)
+ by 0x........: main (bar_bad.c:49)
initialise a barrier which has threads waiting on it
@@ -31,13 +31,13 @@ initialise a barrier which has threads waiting on it
Thread #x: pthread_barrier_init: barrier is already initialised
at 0x........: pthread_barrier_init (hg_intercepts.c:...)
- by 0x........: main (bar_bad.c:57)
+ by 0x........: main (bar_bad.c:64)
----------------------------------------------------------------
Thread #x: pthread_barrier_init: threads are waiting at barrier
at 0x........: pthread_barrier_init (hg_intercepts.c:...)
- by 0x........: main (bar_bad.c:57)
+ by 0x........: main (bar_bad.c:64)
destroy a barrier that has waiting threads
@@ -45,14 +45,14 @@ destroy a barrier that has waiting threads
Thread #x: pthread_barrier_destroy: threads are waiting at barrier
at 0x........: pthread_barrier_destroy (hg_intercepts.c:...)
- by 0x........: main (bar_bad.c:69)
+ by 0x........: main (bar_bad.c:82)
----------------------------------------------------------------
Thread #x's call to pthread_barrier_destroy failed
with error code 16 (EBUSY: Device or resource busy)
at 0x........: pthread_barrier_destroy (hg_intercepts.c:...)
- by 0x........: main (bar_bad.c:69)
+ by 0x........: main (bar_bad.c:82)
destroy a barrier that was never initialised
@@ -60,5 +60,5 @@ destroy a barrier that was never initialised
Thread #x: pthread_barrier_destroy: barrier was never initialised
at 0x........: pthread_barrier_destroy (hg_intercepts.c:...)
- by 0x........: main (bar_bad.c:80)
+ by 0x........: main (bar_bad.c:96)
diff --git a/helgrind/tests/bar_bad.stderr.exp-destroy-hang b/helgrind/tests/bar_bad.stderr.exp-destroy-hang
new file mode 100644
index 0000000..ddf5624
--- /dev/null
+++ b/helgrind/tests/bar_bad.stderr.exp-destroy-hang
@@ -0,0 +1,72 @@
+
+initialise a barrier with zero count
+---Thread-Announcement------------------------------------------
+
+Thread #x is the program's root thread
+
+----------------------------------------------------------------
+
+Thread #x: pthread_barrier_init: 'count' argument is zero
+ at 0x........: pthread_barrier_init (hg_intercepts.c:...)
+ by 0x........: main (bar_bad.c:43)
+
+----------------------------------------------------------------
+
+Thread #x's call to pthread_barrier_init failed
+ with error code 22 (EINVAL: Invalid argument)
+ at 0x........: pthread_barrier_init (hg_intercepts.c:...)
+ by 0x........: main (bar_bad.c:43)
+
+
+initialise a barrier twice
+----------------------------------------------------------------
+
+Thread #x: pthread_barrier_init: barrier is already initialised
+ at 0x........: pthread_barrier_init (hg_intercepts.c:...)
+ by 0x........: main (bar_bad.c:49)
+
+
+initialise a barrier which has threads waiting on it
+----------------------------------------------------------------
+
+Thread #x: pthread_barrier_init: barrier is already initialised
+ at 0x........: pthread_barrier_init (hg_intercepts.c:...)
+ by 0x........: main (bar_bad.c:64)
+
+----------------------------------------------------------------
+
+Thread #x: pthread_barrier_init: threads are waiting at barrier
+ at 0x........: pthread_barrier_init (hg_intercepts.c:...)
+ by 0x........: main (bar_bad.c:64)
+
+
+destroy a barrier that has waiting threads
+----------------------------------------------------------------
+
+Thread #x: pthread_barrier_destroy: threads are waiting at barrier
+ at 0x........: pthread_barrier_destroy (hg_intercepts.c:...)
+ by 0x........: main (bar_bad.c:82)
+
+---Thread-Announcement------------------------------------------
+
+Thread #x was created
+ ...
+ by 0x........: pthread_create@* (hg_intercepts.c:...)
+ by 0x........: main (bar_bad.c:76)
+
+----------------------------------------------------------------
+
+Thread #x: pthread_barrier_wait: barrier is uninitialised
+ at 0x........: pthread_barrier_wait (hg_intercepts.c:...)
+ by 0x........: sleep1 (bar_bad.c:22)
+ by 0x........: mythread_wrapper (hg_intercepts.c:...)
+ ...
+
+
+destroy a barrier that was never initialised
+----------------------------------------------------------------
+
+Thread #x: pthread_barrier_destroy: barrier was never initialised
+ at 0x........: pthread_barrier_destroy (hg_intercepts.c:...)
+ by 0x........: main (bar_bad.c:96)
+
diff -ur valgrind-3.11.0.orig/drd/tests/Makefile.in valgrind-3.11.0/drd/tests/Makefile.in
--- valgrind-3.11.0.orig/drd/tests/Makefile.in 2016-01-25 21:16:13.095563405 +0100
+++ valgrind-3.11.0/drd/tests/Makefile.in 2016-01-25 21:17:33.386330569 +0100
@@ -1084,8 +1084,10 @@
atomic_var.stderr.exp \
atomic_var.vgtest \
bar_bad.stderr.exp \
+ bar_bad.stderr.exp-nohang \
bar_bad.vgtest \
bar_bad_xml.stderr.exp \
+ bar_bad_xml.stderr.exp-nohang \
bar_bad_xml.vgtest \
bar_trivial.stderr.exp \
bar_trivial.stdout.exp \
diff -ur valgrind-3.11.0.orig/helgrind/tests/Makefile.in valgrind-3.11.0/helgrind/tests/Makefile.in
--- valgrind-3.11.0.orig/helgrind/tests/Makefile.in 2016-01-25 21:16:12.883564020 +0100
+++ valgrind-3.11.0/helgrind/tests/Makefile.in 2016-01-25 21:17:34.266328017 +0100
@@ -835,6 +835,7 @@
cond_timedwait_test.vgtest cond_timedwait_test.stdout.exp \
cond_timedwait_test.stderr.exp \
bar_bad.vgtest bar_bad.stdout.exp bar_bad.stderr.exp \
+ bar_bad.stderr.exp-destroy-hang \
bar_trivial.vgtest bar_trivial.stdout.exp bar_trivial.stderr.exp \
free_is_write.vgtest free_is_write.stdout.exp \
free_is_write.stderr.exp \

File diff suppressed because it is too large Load Diff

View File

@ -1,76 +0,0 @@
diff --git a/VEX/priv/guest_amd64_toIR.c b/VEX/priv/guest_amd64_toIR.c
index 98596d2..06552e8 100644
--- a/VEX/priv/guest_amd64_toIR.c
+++ b/VEX/priv/guest_amd64_toIR.c
@@ -13396,7 +13396,8 @@ Long dis_ESC_0F__SSE2 ( Bool* decode_OK,
case 0x5A:
/* 0F 5A = CVTPS2PD -- convert 2 x F32 in low half mem/xmm to 2 x
F64 in xmm(G). */
- if (haveNo66noF2noF3(pfx) && sz == 4) {
+ if (haveNo66noF2noF3(pfx)
+ && (sz == 4 || /* ignore redundant REX.W */ sz == 8)) {
delta = dis_CVTPS2PD_128( vbi, pfx, delta, False/*!isAvx*/ );
goto decode_success;
}
diff --git a/none/tests/amd64/redundantRexW.c b/none/tests/amd64/redundantRexW.c
index e189267..0a50c3b 100644
--- a/none/tests/amd64/redundantRexW.c
+++ b/none/tests/amd64/redundantRexW.c
@@ -596,6 +596,23 @@ int main ( void )
after_test( "rex.WB subsd -0x8(%r13),%xmm1", regs, mem );
}
+ /* cvtps2pd mem, reg 48 0f 5a 07 rex.W cvtps2pd (%rdi),%xmm0 */
+ {
+ before_test( regs, mem );
+ __asm__ __volatile__(
+ "movq %0, %%r14\n"
+ "\tmovq %1, %%r15\n"
+ LOAD_XMMREGS_from_r14
+ "\tmovq %%r15, %%rdi\n"
+ "\t.byte 0x48,0x0f,0x5a,0x07\n"
+ SAVE_XMMREGS_to_r14
+ : /*out*/ : /*in*/ "r"(regs), "r"( -0 + (char*)&mem->dqw[2] )
+ : /*trash*/ "r14","r15","memory", XMMREGS,
+ "rdi"
+ );
+ after_test( "rex.W cvtps2pd (%rdi),%xmm0", regs, mem );
+ }
+
free(regs);
free(mem);
return 0;
diff --git a/none/tests/amd64/redundantRexW.stdout.exp b/none/tests/amd64/redundantRexW.stdout.exp
index dd1697a..94b255a 100644
--- a/none/tests/amd64/redundantRexW.stdout.exp
+++ b/none/tests/amd64/redundantRexW.stdout.exp
@@ -648,3 +648,29 @@ after "rex.WB subsd -0x8(%r13),%xmm1" (xmms in order [15..0]) {
%xmm15 ................................
}
+after "rex.W cvtps2pd (%rdi),%xmm0" (dqws in order [15 .. 0]) {
+ [0] ................................
+ [1] ................................
+ [2] ................................
+ [3] ................................
+ [4] ................................
+}
+after "rex.W cvtps2pd (%rdi),%xmm0" (xmms in order [15..0]) {
+ %xmm 0 113a1c7d5554535213bd9cffd4535251
+ %xmm 1 ................................
+ %xmm 2 ................................
+ %xmm 3 ................................
+ %xmm 4 ................................
+ %xmm 5 ................................
+ %xmm 6 ................................
+ %xmm 7 ................................
+ %xmm 8 ................................
+ %xmm 9 ................................
+ %xmm10 ................................
+ %xmm11 ................................
+ %xmm12 ................................
+ %xmm13 ................................
+ %xmm14 ................................
+ %xmm15 ................................
+}
+

View File

@ -1,116 +0,0 @@
diff --git a/coregrind/m_libcproc.c b/coregrind/m_libcproc.c
index f314b55..a30f7dc 100644
--- a/coregrind/m_libcproc.c
+++ b/coregrind/m_libcproc.c
@@ -450,9 +450,6 @@ void VG_(execv) ( const HChar* filename, const HChar** argv )
HChar** envp;
SysRes res;
- /* restore the DATA rlimit for the child */
- VG_(setrlimit)(VKI_RLIMIT_DATA, &VG_(client_rlimit_data));
-
envp = VG_(env_clone)(VG_(client_envp));
VG_(env_remove_valgrind_env_stuff)( envp, True /*ro_strings*/, NULL );
@@ -511,17 +508,9 @@ Int VG_(spawn) ( const HChar *filename, const HChar **argv )
# undef COPY_CHAR_TO_ARGENV
# undef COPY_STRING_TOARGENV
- /* HACK: Temporarily restore the DATA rlimit for spawned child. */
- VG_(setrlimit)(VKI_RLIMIT_DATA, &VG_(client_rlimit_data));
-
SysRes res = VG_(do_syscall5)(__NR_spawn, (UWord) filename, (UWord) NULL, 0,
(UWord) argenv, argenv_size);
- /* Restore DATA rlimit back to its previous value set in m_main.c. */
- struct vki_rlimit zero = { 0, 0 };
- zero.rlim_max = VG_(client_rlimit_data).rlim_max;
- VG_(setrlimit)(VKI_RLIMIT_DATA, &zero);
-
VG_(free)(argenv);
for (HChar **p = envp; *p != NULL; p++) {
VG_(free)(*p);
diff --git a/coregrind/m_main.c b/coregrind/m_main.c
index 1821c94..9b659ae 100644
--- a/coregrind/m_main.c
+++ b/coregrind/m_main.c
@@ -1627,7 +1627,6 @@ Int valgrind_main ( Int argc, HChar **argv, HChar **envp )
Bool logging_to_fd = False;
const HChar* xml_fname_unexpanded = NULL;
Int loglevel, i;
- struct vki_rlimit zero = { 0, 0 };
XArray* addr2dihandle = NULL;
//============================================================
@@ -1800,13 +1799,15 @@ Int valgrind_main ( Int argc, HChar **argv, HChar **envp )
VG_(debugLog)(1, "main", "... %s\n", VG_(name_of_launcher));
//--------------------------------------------------------------
- // Get the current process datasize rlimit, and set it to zero.
- // This prevents any internal uses of brk() from having any effect.
- // We remember the old value so we can restore it on exec, so that
- // child processes will have a reasonable brk value.
+ // We used to set the process datasize rlimit to zero to prevent
+ // any internal use of brk() from having any effect. But later
+ // linux kernels redefine RLIMIT_DATA as the size of any data
+ // areas, including some dynamic mmap memory allocations.
+ // See bug #357833 for the commit that went into linux 4.5
+ // changing the definition of RLIMIT_DATA. So don't mess with
+ // RLIMIT_DATA here now anymore. Just remember it for use in
+ // the syscall wrappers.
VG_(getrlimit)(VKI_RLIMIT_DATA, &VG_(client_rlimit_data));
- zero.rlim_max = VG_(client_rlimit_data).rlim_max;
- VG_(setrlimit)(VKI_RLIMIT_DATA, &zero);
// Get the current process stack rlimit.
VG_(getrlimit)(VKI_RLIMIT_STACK, &VG_(client_rlimit_stack));
diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c
index aa60d67..061c1e1 100644
--- a/coregrind/m_syswrap/syswrap-generic.c
+++ b/coregrind/m_syswrap/syswrap-generic.c
@@ -3014,9 +3014,6 @@ PRE(sys_execve)
vg_assert(j == tot_args+1);
}
- /* restore the DATA rlimit for the child */
- VG_(setrlimit)(VKI_RLIMIT_DATA, &VG_(client_rlimit_data));
-
/*
Set the signal state up for exec.
diff --git a/coregrind/m_syswrap/syswrap-solaris.c b/coregrind/m_syswrap/syswrap-solaris.c
index 4e2662c..c700b59 100644
--- a/coregrind/m_syswrap/syswrap-solaris.c
+++ b/coregrind/m_syswrap/syswrap-solaris.c
@@ -1589,21 +1589,12 @@ PRE(sys_spawn)
#undef COPY_CHAR_TO_ARGENV
#undef COPY_STRING_TOARGENV
- /* HACK: Temporarily restore the DATA rlimit for spawned child.
- This is a terrible hack to provide sensible brk limit for child. */
- VG_(setrlimit)(VKI_RLIMIT_DATA, &VG_(client_rlimit_data));
-
/* Actual spawn() syscall. */
SysRes res = VG_(do_syscall5)(__NR_spawn, (UWord) path, (UWord) attrs,
attrs_size, (UWord) argenv, argenv_size);
SET_STATUS_from_SysRes(res);
VG_(free)(argenv);
- /* Restore DATA rlimit back to its previous value set in m_main.c. */
- struct vki_rlimit zero = { 0, 0 };
- zero.rlim_max = VG_(client_rlimit_data).rlim_max;
- VG_(setrlimit)(VKI_RLIMIT_DATA, &zero);
-
if (SUCCESS) {
PRINT(" spawn: process %d spawned child %ld\n", VG_(getpid)(), RES);
}
@@ -3794,9 +3785,6 @@ PRE(sys_execve)
VG_(sigprocmask)(VKI_SIG_SETMASK, &tst->sig_mask, NULL);
}
- /* Restore the DATA rlimit for the child. */
- VG_(setrlimit)(VKI_RLIMIT_DATA, &VG_(client_rlimit_data));
-
/* Debug-only printing. */
if (0) {
HChar **cpp;

View File

@ -1,70 +0,0 @@
On a zEC12 or z13, a glibc with lock elision enabled infers from HWCAP
that the prerequisites for lock elision are met. Then it may use TBEGIN
and other transactional-execution instructions which are not implemented
by Valgrind. Likewise, the upcoming glibc 2.23 will exploit vector
instructions if they are advertised by HWCAP; and those are currently
not implemented by Valgrind either. In general, the increased use of
ifunc may lead to more such cases in the future.
This patch suppresses the advertising of those hardware features via
HWCAP which are either not known to Valgrind or currently unsupported.
Patch by Andreas Arnez (arnez@linux.vnet.ibm.com).
Fixes BZ #353680.
Modified: trunk/README.s390
==============================================================================
--- trunk/README.s390 (original)
+++ trunk/README.s390 Mon Oct 12 21:35:56 2015
@@ -22,6 +22,9 @@
- 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.
+- The vector facility is not supported; it is masked off from HWCAP.
Hardware facilities
Modified: trunk/coregrind/m_initimg/initimg-linux.c
==============================================================================
--- trunk/coregrind/m_initimg/initimg-linux.c (original)
+++ trunk/coregrind/m_initimg/initimg-linux.c Mon Oct 12 21:35:56 2015
@@ -701,6 +701,12 @@
in syswrap-arm-linux.c rather than to base this on
conditional compilation. */
}
+# elif defined(VGP_s390x_linux)
+ {
+ /* Advertise hardware features "below" TE only. TE and VXRS
+ (and anything above) are not supported by Valgrind. */
+ auxv->u.a_val &= VKI_HWCAP_S390_TE - 1;
+ }
# endif
break;
# if defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux)
Modified: trunk/include/vki/vki-s390x-linux.h
==============================================================================
--- trunk/include/vki/vki-s390x-linux.h (original)
+++ trunk/include/vki/vki-s390x-linux.h Mon Oct 12 21:35:56 2015
@@ -800,12 +800,15 @@
#define VKI_PTRACE_POKEUSR_AREA 0x5001
//----------------------------------------------------------------------
-// From linux-2.6.16.60/include/asm-s390/elf.h
+// From linux-3.18/include/asm-s390/elf.h
//----------------------------------------------------------------------
typedef vki_s390_fp_regs vki_elf_fpregset_t;
typedef vki_s390_regs vki_elf_gregset_t;
+#define VKI_HWCAP_S390_TE 1024
+#define VKI_HWCAP_S390_VXRS 2048
+
//----------------------------------------------------------------------
// From linux-2.6.16.60/include/asm-s390/ucontext.h

View File

@ -1,79 +0,0 @@
commit d9201968186f799b9a2c0793a29029819372a072
Author: mjw <mjw@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Tue Feb 23 15:19:49 2016 +0000
Bug 359703 s390: wire up separate socketcalls system calls
The linux 4.3 s390 kernel has separate system calls that were originally
hidden behind the socketcall multiplexer system call. Newer glibc versions
will use these direct system calls instead of socketcall when available.
Causing several regtest failures.
This fix simply wires up the split out system calls directly to the
existing syswrap handlers for s390.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15802 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_syswrap/syswrap-s390x-linux.c b/coregrind/m_syswrap/syswrap-s390x-linux.c
index e919b8f..0513789 100644
--- a/coregrind/m_syswrap/syswrap-s390x-linux.c
+++ b/coregrind/m_syswrap/syswrap-s390x-linux.c
@@ -1051,7 +1051,25 @@ static SyscallTableEntry syscall_table[] = {
// ?????(__NR_seccomp, ), // 348
LINXY(__NR_getrandom, sys_getrandom), // 349
- LINXY(__NR_memfd_create, sys_memfd_create) // 350
+ LINXY(__NR_memfd_create, sys_memfd_create), // 350
+
+ LINXY(__NR_recvmmsg, sys_recvmmsg), // 357
+ LINXY(__NR_sendmmsg, sys_sendmmsg), // 358
+ LINXY(__NR_socket, sys_socket), // 359
+ LINXY(__NR_socketpair, sys_socketpair), // 360
+ LINX_(__NR_bind, sys_bind), // 361
+ LINX_(__NR_connect, sys_connect), // 362
+ LINX_(__NR_listen, sys_listen), // 363
+ LINXY(__NR_accept4, sys_accept4), // 364
+ LINXY(__NR_getsockopt, sys_getsockopt), // 365
+ LINX_(__NR_setsockopt, sys_setsockopt), // 366
+ LINXY(__NR_getsockname, sys_getsockname), // 367
+ LINXY(__NR_getpeername, sys_getpeername), // 368
+ LINX_(__NR_sendto, sys_sendto), // 369
+ LINX_(__NR_sendmsg, sys_sendmsg), // 270
+ LINXY(__NR_recvfrom, sys_recvfrom), // 371
+ LINXY(__NR_recvmsg, sys_recvmsg), // 372
+ LINX_(__NR_shutdown, sys_shutdown) // 373
};
SyscallTableEntry* ML_(get_linux_syscall_entry) ( UInt sysno )
diff --git a/include/vki/vki-scnums-s390x-linux.h b/include/vki/vki-scnums-s390x-linux.h
index 2a4a8f1..0187045 100644
--- a/include/vki/vki-scnums-s390x-linux.h
+++ b/include/vki/vki-scnums-s390x-linux.h
@@ -316,7 +316,26 @@
#define __NR_seccomp 348
#define __NR_getrandom 349
#define __NR_memfd_create 350
-#define NR_syscalls 351
+
+#define __NR_recvmmsg 357
+#define __NR_sendmmsg 358
+#define __NR_socket 359
+#define __NR_socketpair 360
+#define __NR_bind 361
+#define __NR_connect 362
+#define __NR_listen 363
+#define __NR_accept4 364
+#define __NR_getsockopt 365
+#define __NR_setsockopt 366
+#define __NR_getsockname 367
+#define __NR_getpeername 368
+#define __NR_sendto 369
+#define __NR_sendmsg 370
+#define __NR_recvfrom 371
+#define __NR_recvmsg 372
+#define __NR_shutdown 373
+
+#define NR_syscalls 374
/*
* There are some system calls that are not present on 64 bit, some

View File

@ -1,63 +0,0 @@
commit 4b825ef5dcf064fd0f05323e7edd538ce02ac146
Author: florian <florian@8f6e269a-dfd6-0310-a8e1-e2731360e62c>
Date: Wed Feb 17 19:57:01 2016 +0000
s390: Implement popcnt insn. Part of fixing BZ #359289.
Patch by Andreas Arnez (arnez@linux.vnet.ibm.com)
git-svn-id: svn://svn.valgrind.org/vex/trunk@3210 8f6e269a-dfd6-0310-a8e1-e2731360e62c
diff --git a/VEX/priv/guest_s390_toIR.c b/VEX/priv/guest_s390_toIR.c
index 116a606..5e6acd4 100644
--- a/VEX/priv/guest_s390_toIR.c
+++ b/VEX/priv/guest_s390_toIR.c
@@ -12938,6 +12938,38 @@ s390_irgen_FLOGR(UChar r1, UChar r2)
}
static const HChar *
+s390_irgen_POPCNT(UChar r1, UChar r2)
+{
+ Int i;
+ IRTemp val = newTemp(Ity_I64);
+ IRTemp mask[3];
+
+ assign(val, get_gpr_dw0(r2));
+ for (i = 0; i < 3; i++) {
+ mask[i] = newTemp(Ity_I64);
+ }
+ assign(mask[0], mkU64(0x5555555555555555ULL));
+ assign(mask[1], mkU64(0x3333333333333333ULL));
+ assign(mask[2], mkU64(0x0F0F0F0F0F0F0F0FULL));
+ for (i = 0; i < 3; i++) {
+ IRTemp tmp = newTemp(Ity_I64);
+
+ assign(tmp,
+ binop(Iop_Add64,
+ binop(Iop_And64,
+ mkexpr(val),
+ mkexpr(mask[i])),
+ binop(Iop_And64,
+ binop(Iop_Shr64, mkexpr(val), mkU8(1 << i)),
+ mkexpr(mask[i]))));
+ val = tmp;
+ }
+ s390_cc_thunk_putZ(S390_CC_OP_BITWISE, val);
+ put_gpr_dw0(r1, mkexpr(val));
+ return "popcnt";
+}
+
+static const HChar *
s390_irgen_STCK(IRTemp op2addr)
{
IRDirty *d;
@@ -14999,7 +15031,8 @@ s390_decode_4byte_and_irgen(const UChar *bytes)
ovl.fmt.RRE.r2); goto ok;
case 0xb9df: s390_format_RRE_RR(s390_irgen_CLHLR, ovl.fmt.RRE.r1,
ovl.fmt.RRE.r2); goto ok;
- case 0xb9e1: /* POPCNT */ goto unimplemented;
+ case 0xb9e1: s390_format_RRE_RR(s390_irgen_POPCNT, ovl.fmt.RRE.r1,
+ ovl.fmt.RRE.r2); goto ok;
case 0xb9e2: s390_format_RRF_U0RR(s390_irgen_LOCGR, ovl.fmt.RRF3.r3,
ovl.fmt.RRF3.r1, ovl.fmt.RRF3.r2,
S390_XMNM_LOCGR); goto ok;

File diff suppressed because it is too large Load Diff

View File

@ -1,34 +0,0 @@
commit 632cb02573da3ff6237d9aeb9acd55c09c2ad317
Author: philippe <philippe@8f6e269a-dfd6-0310-a8e1-e2731360e62c>
Date: Tue Jul 12 20:49:05 2016 +0000
Fix n-i-bz amd64: memcheck false positive with shr %edx
False positive analysis and fix by Julian.
Thanks
git-svn-id: svn://svn.valgrind.org/vex/trunk@3223 8f6e269a-dfd6-0310-a8e1-e2731360e62c
diff --git a/VEX/priv/guest_amd64_helpers.c b/VEX/priv/guest_amd64_helpers.c
index ab53e15..3a0a4c6 100644
--- a/VEX/priv/guest_amd64_helpers.c
+++ b/VEX/priv/guest_amd64_helpers.c
@@ -1604,6 +1604,15 @@ IRExpr* guest_amd64_spechelper ( const HChar* function_name,
mkU64(0)));
}
+ /*---------------- SHRL ----------------*/
+
+ if (isU64(cc_op, AMD64G_CC_OP_SHRL) && isU64(cond, AMD64CondZ)) {
+ /* SHRL, then Z --> test dep1 == 0 */
+ return unop(Iop_1Uto64,
+ binop(Iop_CmpEQ32, unop(Iop_64to32, cc_dep1),
+ mkU32(0)));
+ }
+
/*---------------- COPY ----------------*/
/* This can happen, as a result of amd64 FP compares: "comisd ... ;
jbe" for example. */

View File

@ -1,54 +0,0 @@
commit 13747d21fe69dd730fc4bbe21fc9320d349b41db
Author: philippe <philippe@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Sun Jul 10 21:17:58 2016 +0000
Fix 365273 - Invalid write to stack location reported after signal handler runs
Analysis and patch by Earl Chew
Tested on x86/amd64/ppc64
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15902 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_signals.c b/coregrind/m_signals.c
index 3e8326f..9146d0c 100644
--- a/coregrind/m_signals.c
+++ b/coregrind/m_signals.c
@@ -2519,6 +2519,7 @@ void async_signalhandler ( Int sigNo,
Bool VG_(extend_stack)(ThreadId tid, Addr addr)
{
SizeT udelta;
+ Addr new_stack_base;
/* Get the segment containing addr. */
const NSegment* seg = VG_(am_find_nsegment)(addr);
@@ -2536,14 +2537,15 @@ Bool VG_(extend_stack)(ThreadId tid, Addr addr)
vg_assert(seg_next != NULL);
udelta = VG_PGROUNDUP(seg_next->start - addr);
+ new_stack_base = seg_next->start - udelta;
VG_(debugLog)(1, "signals",
- "extending a stack base 0x%lx down by %lu\n",
- seg_next->start, udelta);
+ "extending a stack base 0x%lx down by %lu"
+ " new base 0x%lx to cover 0x%lx\n",
+ seg_next->start, udelta, new_stack_base, addr);
Bool overflow;
if (! VG_(am_extend_into_adjacent_reservation_client)
( seg_next->start, -(SSizeT)udelta, &overflow )) {
- Addr new_stack_base = seg_next->start - udelta;
if (overflow)
VG_(umsg)("Stack overflow in thread #%u: can't grow stack to %#lx\n",
tid, new_stack_base);
@@ -2555,7 +2557,7 @@ Bool VG_(extend_stack)(ThreadId tid, Addr addr)
/* When we change the main stack, we have to let the stack handling
code know about it. */
- VG_(change_stack)(VG_(clstk_id), addr, VG_(clstk_end));
+ VG_(change_stack)(VG_(clstk_id), new_stack_base, VG_(clstk_end));
if (VG_(clo_sanity_level) > 2)
VG_(sanity_check_general)(False);

View File

@ -1,70 +0,0 @@
commit 266d48ed3aa5f5a6c422805d56abc5a32b90c09c
Author: mjw <mjw@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Wed Jan 20 22:24:43 2016 +0000
Bug #358030 Support direct socket calls on x86 32bit (new in linux 4.3)
Patch by ronald.wahl@raritan.com.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15764 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c
index 24d7dc1..3c80e6a 100644
--- a/coregrind/m_syswrap/syswrap-x86-linux.c
+++ b/coregrind/m_syswrap/syswrap-x86-linux.c
@@ -1824,8 +1824,23 @@ static SyscallTableEntry syscall_table[] = {
// LIN__(__NR_seccomp, sys_ni_syscall), // 354
LINXY(__NR_getrandom, sys_getrandom), // 355
- LINXY(__NR_memfd_create, sys_memfd_create) // 356
-// LIN__(__NR_bpf, sys_ni_syscall) // 357
+ LINXY(__NR_memfd_create, sys_memfd_create), // 356
+// LIN__(__NR_bpf, sys_ni_syscall), // 357
+ LINXY(__NR_socket, sys_socket), // 359
+ LINXY(__NR_socketpair, sys_socketpair), // 360
+ LINX_(__NR_bind, sys_bind), // 361
+ LINX_(__NR_connect, sys_connect), // 362
+ LINX_(__NR_listen, sys_listen), // 363
+ LINXY(__NR_accept4, sys_accept4), // 364
+ LINXY(__NR_getsockopt, sys_getsockopt), // 365
+ LINX_(__NR_setsockopt, sys_setsockopt), // 366
+ LINXY(__NR_getsockname, sys_getsockname), // 367
+ LINXY(__NR_getpeername, sys_getpeername), // 368
+ LINX_(__NR_sendto, sys_sendto), // 369
+ LINX_(__NR_sendmsg, sys_sendmsg), // 370
+ LINXY(__NR_recvfrom, sys_recvfrom), // 371
+ LINXY(__NR_recvmsg, sys_recvmsg), // 372
+ LINX_(__NR_shutdown, sys_shutdown) // 373
};
SyscallTableEntry* ML_(get_linux_syscall_entry) ( UInt sysno )
diff --git a/include/vki/vki-scnums-x86-linux.h b/include/vki/vki-scnums-x86-linux.h
index 5479b3e..a4e75a7 100644
--- a/include/vki/vki-scnums-x86-linux.h
+++ b/include/vki/vki-scnums-x86-linux.h
@@ -392,6 +392,25 @@
#define __NR_getrandom 355
#define __NR_memfd_create 356
#define __NR_bpf 357
+#define __NR_execveat 358
+#define __NR_socket 359
+#define __NR_socketpair 360
+#define __NR_bind 361
+#define __NR_connect 362
+#define __NR_listen 363
+#define __NR_accept4 364
+#define __NR_getsockopt 365
+#define __NR_setsockopt 366
+#define __NR_getsockname 367
+#define __NR_getpeername 368
+#define __NR_sendto 369
+#define __NR_sendmsg 370
+#define __NR_recvfrom 371
+#define __NR_recvmsg 372
+#define __NR_shutdown 373
+#define __NR_userfaultfd 374
+#define __NR_membarrier 375
+#define __NR_mlock2 376
#endif /* __VKI_SCNUMS_X86_LINUX_H */

File diff suppressed because it is too large Load Diff

View File

@ -1,167 +0,0 @@
commit f250c4d3241c156f8e65398e2af76e3e2ee1ccb5
Author: philippe <philippe@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Wed Nov 18 20:56:55 2015 +0000
Fix incorrect (or infinite loop) unwind on RHEL7 x86 32 bits.
On RHEL7 x86 32 bits, Valgrind unwinder cannot properly unwind
the stack just after a thread creation : the unwinder always retrieves
the same pc/sp/bp.
See below for an example.
This has as consequences that some stack traces are bigger than
needed (i.e. they always fill up the ips array). If
--merge-recursive-frames is given, then the unwinder enters in an
infinite loop (as identical frames will be merged, and the ips array
will never be filled in).
Thi patch adds an additional exit condition : after unwinding
a frame, if the previous sp is >= new sp, then unwinding stops.
Patch has been tested on debian 8/x86, RHEL7/x86.
0x0417db67 <+55>: mov 0x18(%esp),%ebx
0x0417db6b <+59>: mov 0x28(%esp),%edi
0x0417db6f <+63>: mov $0x78,%eax
0x0417db74 <+68>: mov %ebx,(%ecx)
0x0417db76 <+70>: int $0x80
=> 0x0417db78 <+72>: pop %edi
0x0417db79 <+73>: pop %esi
0x0417db7a <+74>: pop %ebx
0x0417db7b <+75>: test %eax,%eax
Valgrind stacktrace gives:
==21261== at 0x417DB78: clone (clone.S:110)
==21261== by 0x424702F: ???
==21261== by 0x424702F: ???
==21261== by 0x424702F: ???
==21261== by 0x424702F: ???
==21261== by 0x424702F: ???
==21261== by 0x424702F: ???
==21261== by 0x424702F: ???
...
(till the array of ips is full)
while gdb stacktrace gives:
(gdb) bt
#0 clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:110
#1 0x00000000 in ?? ()
(gdb) p $pc
$2 = (void (*)()) 0x417db78 <clone+72>
(gdb)
With the fix, valgrind gives:
==21261== at 0x417DB78: clone (clone.S:110)
==21261== by 0x424702F: ???
which looks more reasonable.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15729 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_stacktrace.c b/coregrind/m_stacktrace.c
index 8c1e9a4..137e780 100644
--- a/coregrind/m_stacktrace.c
+++ b/coregrind/m_stacktrace.c
@@ -350,6 +350,8 @@ UInt VG_(get_StackTrace_wrk) ( ThreadId tid_if_known,
uregs.xbp <= fp_max - 1 * sizeof(UWord)/*see comment below*/ &&
VG_IS_4_ALIGNED(uregs.xbp))
{
+ Addr old_xsp;
+
/* fp looks sane, so use it. */
uregs.xip = (((UWord*)uregs.xbp)[1]);
// We stop if we hit a zero (the traditional end-of-stack
@@ -382,6 +384,7 @@ UInt VG_(get_StackTrace_wrk) ( ThreadId tid_if_known,
}
}
+ old_xsp = uregs.xsp;
uregs.xsp = uregs.xbp + sizeof(Addr) /*saved %ebp*/
+ sizeof(Addr) /*ra*/;
uregs.xbp = (((UWord*)uregs.xbp)[0]);
@@ -393,6 +396,12 @@ UInt VG_(get_StackTrace_wrk) ( ThreadId tid_if_known,
if (debug) VG_(printf)(" cache FPUNWIND >2\n");
if (debug) unwind_case = "FO";
if (do_stats) stats.FO++;
+ if (old_xsp >= uregs.xsp) {
+ if (debug)
+ VG_(printf) (" FO end of stack old_xsp %p >= xsp %p\n",
+ (void*)old_xsp, (void*)uregs.xsp);
+ break;
+ }
} else {
fp_CF_verif_cache [hash] = xip_verified ^ CFUNWIND;
if (debug) VG_(printf)(" cache CFUNWIND >2\n");
@@ -406,6 +415,12 @@ UInt VG_(get_StackTrace_wrk) ( ThreadId tid_if_known,
} else {
if (debug) unwind_case = "FF";
if (do_stats) stats.FF++;
+ if (old_xsp >= uregs.xsp) {
+ if (debug)
+ VG_(printf) (" FF end of stack old_xsp %p >= xsp %p\n",
+ (void*)old_xsp, (void*)uregs.xsp);
+ break;
+ }
}
goto unwind_done;
} else {
commit 4520d562975820aced0fda6ed503379f337da66e
Author: philippe <philippe@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Wed Feb 17 22:41:14 2016 +0000
Fix incorrect (or infinite loop) unwind on RHEL7 amd64 64 bits.
Same kind of problems as explained and fixed in revision 15720:
In some cases, unwinding always retrieves the same pc/sp/bp.
Fix for 64 bits is similar: stop unwinding if the previous sp is >= new sp
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15794 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_stacktrace.c b/coregrind/m_stacktrace.c
index 137e780..ef4984c 100644
--- a/coregrind/m_stacktrace.c
+++ b/coregrind/m_stacktrace.c
@@ -607,16 +607,25 @@ UInt VG_(get_StackTrace_wrk) ( ThreadId tid_if_known,
* next function which is completely wrong.
*/
while (True) {
+ Addr old_xsp;
if (i >= max_n_ips)
break;
+ old_xsp = uregs.xsp;
+
/* Try to derive a new (ip,sp,fp) triple from the current set. */
/* First off, see if there is any CFI info to hand which can
be used. */
if ( VG_(use_CF_info)( &uregs, fp_min, fp_max ) ) {
if (0 == uregs.xip || 1 == uregs.xip) break;
+ if (old_xsp >= uregs.xsp) {
+ if (debug)
+ VG_(printf) (" CF end of stack old_xsp %p >= xsp %p\n",
+ (void*)old_xsp, (void*)uregs.xsp);
+ break;
+ }
if (sps) sps[i] = uregs.xsp;
if (fps) fps[i] = uregs.xbp;
ips[i++] = uregs.xip - 1; /* -1: refer to calling insn, not the RA */
@@ -646,6 +655,12 @@ UInt VG_(get_StackTrace_wrk) ( ThreadId tid_if_known,
if (0 == uregs.xip || 1 == uregs.xip) break;
uregs.xsp = uregs.xbp + sizeof(Addr) /*saved %rbp*/
+ sizeof(Addr) /*ra*/;
+ if (old_xsp >= uregs.xsp) {
+ if (debug)
+ VG_(printf) (" FF end of stack old_xsp %p >= xsp %p\n",
+ (void*)old_xsp, (void*)uregs.xsp);
+ break;
+ }
uregs.xbp = (((UWord*)uregs.xbp)[0]);
if (sps) sps[i] = uregs.xsp;
if (fps) fps[i] = uregs.xbp;

View File

@ -1,56 +0,0 @@
commit 3b6e36f530120f5e30d8a81d26e04018a8d0784f
Author: florian <florian@8f6e269a-dfd6-0310-a8e1-e2731360e62c>
Date: Tue Feb 16 21:14:47 2016 +0000
s390: Add machine model z13s
git-svn-id: svn://svn.valgrind.org/vex/trunk@3208 8f6e269a-dfd6-0310-a8e1-e2731360e62c
diff --git a/VEX/pub/libvex.h b/pub/libvex.h
index b2bd476..4dd23e6 100644
--- a/VEX/pub/libvex.h
+++ b/VEX/pub/libvex.h
@@ -141,7 +141,8 @@ typedef
#define VEX_S390X_MODEL_ZEC12 10
#define VEX_S390X_MODEL_ZBC12 11
#define VEX_S390X_MODEL_Z13 12
-#define VEX_S390X_MODEL_UNKNOWN 13 /* always last in list */
+#define VEX_S390X_MODEL_Z13S 13
+#define VEX_S390X_MODEL_UNKNOWN 14 /* always last in list */
#define VEX_S390X_MODEL_MASK 0x3F
#define VEX_HWCAPS_S390X_LDISP (1<<6) /* Long-displacement facility */
commit e6d40c0b4d4e8a7007a6f2fc0c2f0aac50aba274
Author: florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Tue Feb 16 21:15:32 2016 +0000
s390: Recognise machine model z13s (2965).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15789 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_machine.c b/coregrind/m_machine.c
index cd4606b..ae8b929 100644
--- a/coregrind/m_machine.c
+++ b/coregrind/m_machine.c
@@ -616,6 +616,7 @@ static UInt VG_(get_machine_model)(void)
{ "2827", VEX_S390X_MODEL_ZEC12 },
{ "2828", VEX_S390X_MODEL_ZBC12 },
{ "2964", VEX_S390X_MODEL_Z13 },
+ { "2965", VEX_S390X_MODEL_Z13S },
};
Int model, n, fh;
diff --git a/tests/s390x_features.c b/tests/s390x_features.c
index de34a98..bc671c6 100644
--- a/tests/s390x_features.c
+++ b/tests/s390x_features.c
@@ -89,6 +89,7 @@ model_info models[] = {
{ "2827", "zEC12" },
{ "2828", "zBC12" },
{ "2964", "z13" },
+ { "2965", "z13s" },
};

View File

@ -2,8 +2,8 @@
Summary: Tool for finding memory management bugs in programs
Name: %{?scl_prefix}valgrind
Version: 3.11.0
Release: 26%{?dist}
Version: 3.12.0
Release: 0.1.BETA1%{?dist}
Epoch: 1
License: GPLv2+
URL: http://www.valgrind.org/
@ -58,7 +58,8 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
# So those will already have their full symbol table.
%undefine _include_minidebuginfo
Source0: http://www.valgrind.org/downloads/valgrind-%{version}.tar.bz2
#Source0: http://www.valgrind.org/downloads/valgrind-%{version}.tar.bz2
Source0: valgrind-3.12.0.BETA1.tar.bz2
# Needs investigation and pushing upstream
Patch1: valgrind-3.9.0-cachegrind-improvements.patch
@ -69,128 +70,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#353083 arm64 doesn't implement various xattr system calls.
Patch4: valgrind-3.11.0-arm64-xattr.patch
# KDE#353084 arm64 doesn't support sigpending system call.
Patch5: valgrind-3.11.0-arm64-sigpending.patch
# KDE#353370 don't advertise RDRAND in cpuid for Core-i7-4910-like avx2
Patch6: valgrind-3.11.0-no-rdrand.patch
# KDE#278744 cvtps2pd with redundant RexW
Patch7: valgrind-3.11.0-rexw-cvtps2pd.patch
# KDE#353680 Crash with certain glibc versions due to non-implemented TBEGIN
Patch8: valgrind-3.11.0-s390-hwcap.patch
# KDE#355188 valgrind should intercept all malloc related global functions
Patch9: valgrind-3.11.0-wrapmalloc.patch
# RHBZ#1283774 - Valgrind: FATAL: aspacem assertion failed
Patch10: valgrind-3.11.0-aspacemgr.patch
# KDE#358213 - helgrind bar_bad testcase hangs with new glibc pthread barrier
Patch11: valgrind-3.11.0-pthread_barrier.patch
# KDE#357833 - Valgrind is broken on recent linux kernel (RLIMIT_DATA)
Patch12: valgrind-3.11.0-rlimit_data.patch
# KDE#357887 VG_(fclose) ought to close the file, you silly.
Patch13: valgrind-3.11.0-fclose.patch
# KDE#357871 Fix helgrind wrapper of pthread_spin_destroy
Patch14: valgrind-3.11.0-pthread_spin_destroy.patch
# KDE#358030 Support direct socket calls on x86 32bit (new in linux 4.3)
Patch15: valgrind-3.11.0-socketcall-x86-linux.patch
# KDE#356044 Dwarf line info reader misinterprets is_stmt register
Patch16: valgrind-3.11.0-is_stmt.patch
# Fix incorrect (or infinite loop) unwind on RHEL7 x86 32 bits. (svn r15729)
# Fix incorrect (or infinite loop) unwind on RHEL7 amd64 64 bits. (svn r15794)
Patch17: valgrind-3.11.0-x86_unwind.patch
# KDE#358478 drd/tests/std_thread.cpp doesn't build with GCC6
Patch18: valgrind-3.11.0-drd_std_thread.patch
# KDE#359201 futex syscall skips argument 5 if op is FUTEX_WAIT_BITSET
Patch19: valgrind-3.11.0-futex.patch
# KDE#359289 s390: Implement popcnt insn.
Patch20: valgrind-3.11.0-s390x-popcnt.patch
# KDE#359703 s390: wire up separate socketcalls system calls
Patch21: valgrind-3.11.0-s390-separate-socketcalls.patch
# KDE#359733 amd64 implement ld.so strchr/index override like x86
Patch22: valgrind-3.11.0-amd64-ld-index.patch
# KDE#359871 Incorrect mask handling in ppoll
Patch23: valgrind-3.11.0-ppoll-mask.patch
# KDE#359503 - Add missing syscalls for aarch64 (arm64)
Patch24: valgrind-3.11.0-arm64-more-syscalls.patch
# Workaround for KDE#345307 - still reachable memory in libstdc++ from gcc 5
Patch25: valgrind-3.11.0-libstdc++-supp.patch
# KDE#360519 - none/tests/arm64/memory.vgtest might fail with newer gcc
Patch26: valgrind-3.11.0-arm64-ldr-literal-test.patch
# KDE#360425 - arm64 unsupported instruction ldpsw
Patch27: valgrind-3.11.0-arm64-ldpsw.patch
# KDE#345307 - still reachable memory in libstdc++ from gcc 6
# Note that workaround (patch25) is still needed for gcc 5
Patch28: valgrind-3.11.0-cxx-freeres.patch
# KDE#361354 - ppc64[le]: wire up separate socketcalls system calls
Patch29: valgrind-3.11.0-ppc64-separate-socketcalls.patch
# KDE#356393 - valgrind (vex) crashes because isZeroU happened
Patch30: valgrind-3.11.0-isZeroU.patch
# KDE#359472 - PPC vsubuqm instruction doesn't always give the correct result
Patch31: valgrind-3.11.0-ppc64-128bit-mod-carry.patch
# KDE#212352 - vex amd64 unhandled opc_aux = 0x 2, first_opcode == 0xDC (FCOM)
Patch32: valgrind-3.11.0-amd64-fcom.patch
# s390: Recognise machine model z13s (2965)
Patch33: valgrind-3.11.0-z13s.patch
# Update gdbserver_tests filter for newer GDB version.
Patch34: valgrind-3.11.0-gdb-test-filters.patch
# KDE#361226 s390x: risbgn (EC59) not implemented
Patch35: valgrind-3.11.0-s390x-risbgn.patch
# KDE#359133 m_deduppoolalloc.c:258 (vgPlain_allocEltDedupPA): Assertion failed
Patch36: valgrind-3.11.0-deduppoolalloc.patch
# KDE#360035 - POWER PC bcdadd and bcdsubtract generate non-zero shadow bits
Patch37: valgrind-3.11.0-ppc-bcd-addsub.patch
# KDE#360008 - ppc64 vr registers not printed correctly with vgdb
Patch38: valgrind-3.11.0-ppc64-vgdb-vr-regs.patch
# KDE#363705 arm64 missing syscall name_to_handle_at and open_by_handle_at
Patch39: valgrind-3.11.0-arm64-handle_at.patch
# KDE#363714 ppc64 missing syscalls sync, waitid and name_to/open_by_handle_at
Patch40: valgrind-3.11.0-ppc64-syscalls.patch
# valgrind svn r3223 - memcheck false positive with shr %edx
Patch41: valgrind-3.11.0-shr.patch
# KDE#359952 - Enable PCMPxSTRx cases 0x70 and 0x19.
Patch42: valgrind-3.11.0-pcmpxstrx-0x70-0x19.patch
# KDE#365273 - Invalid write to stack location reported after signal handler
Patch43: valgrind-3.11.0-sighandler-stack.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
@ -298,64 +177,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}.BETA1
%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
# Older patch might not have created these (expected) empty files (patch23)
touch none/tests/ppoll_alarm.stderr.exp
touch none/tests/ppoll_alarm.stdout.exp
touch none/tests/pselect_alarm.stderr.exp
touch none/tests/pselect_alarm.stdout.exp
touch none/tests/pselect_sigmask_null.stderr.exp
touch none/tests/pselect_sigmask_null.stdout.exp
%patch24 -p1
# New filter (from patch24) needs to be executable.
chmod 755 memcheck/tests/arm64-linux/filter_stderr
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch28 -p1
%patch29 -p1
%patch30 -p1
%patch31 -p1
%patch32 -p1
%patch33 -p1
%patch34 -p1
%patch35 -p1
%patch36 -p1
%patch37 -p1
%patch38 -p1
%patch39 -p1
%patch40 -p1
%patch41 -p1
%patch42 -p1
%patch43 -p1
%build
# We need to use the software collection compiler and binutils if available.
@ -485,15 +311,16 @@ echo ===============TESTING===================
# On arm the gdb integration tests hang for unknown reasons.
# When building a scl we might pick a bad gdb.
# Only run the main tools tests.
%ifarch %{arm}
# Recent GDB crashes on the gdb_server tests. Disable everywhere for now.
#%ifarch %{arm}
./close_fds make nonexp-regtest || :
%else
%if %{is_scl}
./close_fds make nonexp-regtest || :
%else
./close_fds make regtest || :
%endif
%endif
#%else
# %if %{is_scl}
# ./close_fds make nonexp-regtest || :
# %else
# ./close_fds make regtest || :
# %endif
#%endif
# Make sure test failures show up in build.log
# Gather up the diffs (at most the first 20 lines for each one)
@ -555,6 +382,11 @@ echo ===============END TESTING===============
%endif
%changelog
* Tue Sep 20 2016 Mark Wielaard <mjw@redhat.com> - 3.12.0-0.1-BETA1
- Update to valgrind 3.12.0 pre-release.
- Drop upstreamed patches.
- Disable exp-tests in %%check. GDB crashes on gdb_server tests.
* Fri Jul 22 2016 Mark Wielaard <mjw@redhat.com> - 3.11.0-26
- Only build valgrind-openmpi when not creating a software collection.
- No support for multilib on secondary arches when creating scl.