You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(122) |
Nov
(152) |
Dec
(69) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(6) |
Feb
(25) |
Mar
(73) |
Apr
(82) |
May
(24) |
Jun
(25) |
Jul
(10) |
Aug
(11) |
Sep
(10) |
Oct
(54) |
Nov
(203) |
Dec
(182) |
| 2004 |
Jan
(307) |
Feb
(305) |
Mar
(430) |
Apr
(312) |
May
(187) |
Jun
(342) |
Jul
(487) |
Aug
(637) |
Sep
(336) |
Oct
(373) |
Nov
(441) |
Dec
(210) |
| 2005 |
Jan
(385) |
Feb
(480) |
Mar
(636) |
Apr
(544) |
May
(679) |
Jun
(625) |
Jul
(810) |
Aug
(838) |
Sep
(634) |
Oct
(521) |
Nov
(965) |
Dec
(543) |
| 2006 |
Jan
(494) |
Feb
(431) |
Mar
(546) |
Apr
(411) |
May
(406) |
Jun
(322) |
Jul
(256) |
Aug
(401) |
Sep
(345) |
Oct
(542) |
Nov
(308) |
Dec
(481) |
| 2007 |
Jan
(427) |
Feb
(326) |
Mar
(367) |
Apr
(255) |
May
(244) |
Jun
(204) |
Jul
(223) |
Aug
(231) |
Sep
(354) |
Oct
(374) |
Nov
(497) |
Dec
(362) |
| 2008 |
Jan
(322) |
Feb
(482) |
Mar
(658) |
Apr
(422) |
May
(476) |
Jun
(396) |
Jul
(455) |
Aug
(267) |
Sep
(280) |
Oct
(253) |
Nov
(232) |
Dec
(304) |
| 2009 |
Jan
(486) |
Feb
(470) |
Mar
(458) |
Apr
(423) |
May
(696) |
Jun
(461) |
Jul
(551) |
Aug
(575) |
Sep
(134) |
Oct
(110) |
Nov
(157) |
Dec
(102) |
| 2010 |
Jan
(226) |
Feb
(86) |
Mar
(147) |
Apr
(117) |
May
(107) |
Jun
(203) |
Jul
(193) |
Aug
(238) |
Sep
(300) |
Oct
(246) |
Nov
(23) |
Dec
(75) |
| 2011 |
Jan
(133) |
Feb
(195) |
Mar
(315) |
Apr
(200) |
May
(267) |
Jun
(293) |
Jul
(353) |
Aug
(237) |
Sep
(278) |
Oct
(611) |
Nov
(274) |
Dec
(260) |
| 2012 |
Jan
(303) |
Feb
(391) |
Mar
(417) |
Apr
(441) |
May
(488) |
Jun
(655) |
Jul
(590) |
Aug
(610) |
Sep
(526) |
Oct
(478) |
Nov
(359) |
Dec
(372) |
| 2013 |
Jan
(467) |
Feb
(226) |
Mar
(391) |
Apr
(281) |
May
(299) |
Jun
(252) |
Jul
(311) |
Aug
(352) |
Sep
(481) |
Oct
(571) |
Nov
(222) |
Dec
(231) |
| 2014 |
Jan
(185) |
Feb
(329) |
Mar
(245) |
Apr
(238) |
May
(281) |
Jun
(399) |
Jul
(382) |
Aug
(500) |
Sep
(579) |
Oct
(435) |
Nov
(487) |
Dec
(256) |
| 2015 |
Jan
(338) |
Feb
(357) |
Mar
(330) |
Apr
(294) |
May
(191) |
Jun
(108) |
Jul
(142) |
Aug
(261) |
Sep
(190) |
Oct
(54) |
Nov
(83) |
Dec
(22) |
| 2016 |
Jan
(49) |
Feb
(89) |
Mar
(33) |
Apr
(50) |
May
(27) |
Jun
(34) |
Jul
(53) |
Aug
(53) |
Sep
(98) |
Oct
(206) |
Nov
(93) |
Dec
(53) |
| 2017 |
Jan
(65) |
Feb
(82) |
Mar
(102) |
Apr
(86) |
May
(187) |
Jun
(67) |
Jul
(23) |
Aug
(93) |
Sep
(65) |
Oct
(45) |
Nov
(35) |
Dec
(17) |
| 2018 |
Jan
(26) |
Feb
(35) |
Mar
(38) |
Apr
(32) |
May
(8) |
Jun
(43) |
Jul
(27) |
Aug
(30) |
Sep
(43) |
Oct
(42) |
Nov
(38) |
Dec
(67) |
| 2019 |
Jan
(32) |
Feb
(37) |
Mar
(53) |
Apr
(64) |
May
(49) |
Jun
(18) |
Jul
(14) |
Aug
(53) |
Sep
(25) |
Oct
(30) |
Nov
(49) |
Dec
(31) |
| 2020 |
Jan
(87) |
Feb
(45) |
Mar
(37) |
Apr
(51) |
May
(99) |
Jun
(36) |
Jul
(11) |
Aug
(14) |
Sep
(20) |
Oct
(24) |
Nov
(40) |
Dec
(23) |
| 2021 |
Jan
(14) |
Feb
(53) |
Mar
(85) |
Apr
(15) |
May
(19) |
Jun
(3) |
Jul
(14) |
Aug
(1) |
Sep
(57) |
Oct
(73) |
Nov
(56) |
Dec
(22) |
| 2022 |
Jan
(3) |
Feb
(22) |
Mar
(6) |
Apr
(55) |
May
(46) |
Jun
(39) |
Jul
(15) |
Aug
(9) |
Sep
(11) |
Oct
(34) |
Nov
(20) |
Dec
(36) |
| 2023 |
Jan
(79) |
Feb
(41) |
Mar
(99) |
Apr
(169) |
May
(48) |
Jun
(16) |
Jul
(16) |
Aug
(57) |
Sep
(19) |
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
|
|
|
1
(14) |
|
2
|
3
(6) |
4
(9) |
5
(23) |
6
(6) |
7
(10) |
8
(2) |
|
9
(1) |
10
(5) |
11
(2) |
12
(5) |
13
(2) |
14
(2) |
15
(4) |
|
16
(3) |
17
(22) |
18
(21) |
19
(15) |
20
(24) |
21
(5) |
22
(5) |
|
23
(14) |
24
(2) |
25
(2) |
26
(1) |
27
|
28
|
29
(1) |
|
30
|
31
|
|
|
|
|
|
|
From: <sv...@va...> - 2016-10-05 19:52:00
|
Author: mjw
Date: Wed Oct 5 20:51:53 2016
New Revision: 16025
Log:
Add a warning to the get/set_thread_area wrapper for bad info pointers.
Also adjust the scalar.stderr.exp to catch the new warnings.
Patch by Julian Seward <js...@ac...>
Modified:
trunk/coregrind/m_syswrap/syswrap-x86-linux.c
trunk/memcheck/tests/x86-linux/scalar.stderr.exp
Modified: trunk/coregrind/m_syswrap/syswrap-x86-linux.c
==============================================================================
--- trunk/coregrind/m_syswrap/syswrap-x86-linux.c (original)
+++ trunk/coregrind/m_syswrap/syswrap-x86-linux.c Wed Oct 5 20:51:53 2016
@@ -596,7 +596,9 @@
static SysRes sys_modify_ldt ( ThreadId tid,
Int func, void* ptr, UInt bytecount )
{
- SysRes ret;
+ /* Set return value to something "safe". I think this will never
+ actually be returned, though. */
+ SysRes ret = VG_(mk_SysRes_Error)( VKI_ENOSYS );
if (func != 0 && func != 1 && func != 2 && func != 0x11) {
ret = VG_(mk_SysRes_Error)( VKI_ENOSYS );
@@ -634,8 +636,10 @@
vg_assert(8 == sizeof(VexGuestX86SegDescr));
vg_assert(sizeof(HWord) == sizeof(VexGuestX86SegDescr*));
- if (info == NULL || ! ML_(safe_to_deref)(info, sizeof(vki_modify_ldt_t)))
+ if (info == NULL || ! ML_(safe_to_deref)(info, sizeof(vki_modify_ldt_t))) {
+ VG_(umsg)("Warning: bad u_info address %p in set_thread_area\n", info);
return VG_(mk_SysRes_Error)( VKI_EFAULT );
+ }
gdt = (VexGuestX86SegDescr*)VG_(threads)[tid].arch.vex.guest_GDT;
@@ -686,8 +690,10 @@
vg_assert(sizeof(HWord) == sizeof(VexGuestX86SegDescr*));
vg_assert(8 == sizeof(VexGuestX86SegDescr));
- if (info == NULL || ! ML_(safe_to_deref)(info, sizeof(vki_modify_ldt_t)))
+ if (info == NULL || ! ML_(safe_to_deref)(info, sizeof(vki_modify_ldt_t))) {
+ VG_(umsg)("Warning: bad u_info address %p in get_thread_area\n", info);
return VG_(mk_SysRes_Error)( VKI_EFAULT );
+ }
idx = info->entry_number;
Modified: trunk/memcheck/tests/x86-linux/scalar.stderr.exp
==============================================================================
--- trunk/memcheck/tests/x86-linux/scalar.stderr.exp (original)
+++ trunk/memcheck/tests/x86-linux/scalar.stderr.exp Wed Oct 5 20:51:53 2016
@@ -3380,6 +3380,7 @@
by 0x........: main (scalar.c:1084)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
+Warning: bad u_info address 0x........ in set_thread_area
-----------------------------------------------------
244:__NR_get_thread_area 1s 1m
-----------------------------------------------------
@@ -3392,6 +3393,7 @@
by 0x........: main (scalar.c:1088)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
+Warning: bad u_info address 0x........ in get_thread_area
-----------------------------------------------------
245: __NR_io_setup 2s 1m
-----------------------------------------------------
|
|
From: <sv...@va...> - 2016-10-05 19:27:54
|
Author: philippe
Date: Wed Oct 5 20:27:47 2016
New Revision: 16024
Log:
Fix n-i-bz bug in auto free pool: a block using the last byte of the meta
pool was not auto-freed.
This was shown by:
./vg-in-place --leak-check=full ./memcheck/tests/leak-autofreepool 2 100
Without the patch, it reports 101 blocks leaked, with one block
being from the auto-free meta pool.
With the fix, there is (as expected) 100 leaked blocks.
Modified:
trunk/memcheck/mc_malloc_wrappers.c
Modified: trunk/memcheck/mc_malloc_wrappers.c
==============================================================================
--- trunk/memcheck/mc_malloc_wrappers.c (original)
+++ trunk/memcheck/mc_malloc_wrappers.c Wed Oct 5 20:27:47 2016
@@ -698,7 +698,7 @@
VG_(HT_ResetIter)(MC_(malloc_list));
while (!found && (mc = VG_(HT_Next)(MC_(malloc_list))) ) {
- if (mc->data >= StartAddr && mc->data + mc->szB < EndAddr) {
+ if (mc->data >= StartAddr && mc->data + mc->szB <= EndAddr) {
if (VG_(clo_verbosity) > 2) {
VG_(message)(Vg_UserMsg, "Auto-free of 0x%lx size=%lu\n",
mc->data, (mc->szB + 0UL));
|
|
From: <sv...@va...> - 2016-10-05 15:20:10
|
Author: sewardj
Date: Wed Oct 5 16:19:59 2016
New Revision: 16023
Log:
Update, primarily to record merge status info.
Modified:
trunk/docs/internals/3_11_BUGSTATUS.txt
Modified: trunk/docs/internals/3_11_BUGSTATUS.txt
==============================================================================
--- trunk/docs/internals/3_11_BUGSTATUS.txt (original)
+++ trunk/docs/internals/3_11_BUGSTATUS.txt Wed Oct 5 16:19:59 2016
@@ -282,11 +282,64 @@
val 15963 is a copy of trunk 15962
-TO MERGE (trunk -> 3_12_BRANCH)
-15966 (t) -> 15967 (b) a missing helgrind test file
-15968 (t) -> 15969 (b) Add none/tests/ppc64/ppc64_helpers.h to noinst_HEADERS.
-15970 (t) -> 15972 (b) fix for bugzilla 361253 [s390x]
-15971 (t) -> 15973 (b) Add feature check for tests that use -march=armv8-a+crc.
+TO MERGE (trunk -> 3_12_BRANCH unless otherwise indicated):
+
+15966 -> 15967 a missing helgrind test file
+15968 -> 15969 Add none/tests/ppc64/ppc64_helpers.h to noinst_HEADERS.
+15970 -> 15972 fix for bugzilla 361253 [s390x]
+15971 -> 15973 Add feature check for tests that use -march=armv8-a+crc.
+15975 -> 16007 Avoid unused variable warning.
+15976 Prelim support for macOS Sierra (10.12). Partial fix for #365327.
+15977 -> 16008 ppcBE, fix the expected output file for
+ none/tests/ppc64/jm_int_isa_2_07.stdout.exp
+15978 -> 16009 Use proper compiler flags on Solaris for fma4 test.
+15979 -> 16010 Fix expected error output of drd/tests/bar_bad* on Solaris.
+15980 -> 16009 Fix none/tests/amd64/Makefile.am typo s/AM_CFKAGS/AM_CFLAGS/
+15981 -> 16016 Add ioctl wrapper for MNTIOC_GETEXTMNTENT.
+15982 -> 16011 Fix #361615 - Inconsistent termination for multithreaded process
+ terminated by signal
+15983 -> 16011 Fix warning introduced by revision 15982
+15984 -> 16012 Added meta mempool support into memcheck Fixes BZ#367995
+15985 -> 16012 Fix test so that leaked bytes is the same in 32 and 64 bits
+15986 -> 16012 Add an optional 2nd arg to leak-autofreepool to test performance
+15987 -> 16012 mc-manual.xml: Fix some mismatched open/close tags.
+15988 -> 16013 Use AM_LDFLAGS instead of LDFLAGS in exp-bbv/tests Makefiles.
+15989 -> 16014 Don't require the current working directory to exist. #369209.
+
+15990 -> 16015 Fix pre_mem_read_sockaddr crash on invalid syscall arguments.
+ Bug #369356.
+15991 -> 16015 Fix crash in msghdr_foreachfield when iov_len isn't safe to
+ dereference. #369359
+15992 -> 16015 Fix crash when old/new sigprocmask isn't safe to dereference.
+ Bug #369360.
+15993 -> 16015 Fix crash in vmsplice linux kernel wrapper when iovec is bad.
+ Bug #369361.
+15994 -> 16015 Fix crash in linux [rt_]sigaction wrapper with bad old/new
+ sigaction handler. #369362
+15995 -> 16015 Fix crash in sys_modify_ldt wrapper on bad ptr. Bug #369383.
+15996 -> 16015 linux-x86 check get/set_thread_area pointer before use.
+ Bug #369402.
+15997 -> 16015 Don't check bad iovec array in process_vm_readv/writev.
+ Bug #369441.
+15998 -> 16015 Don't crash, but warn and return EINVAL on unknown fcntl command.
+(TODO: ask mjw about these)
+
+15999 -> 16017 Replace --wait-for-gdb=yes memory loop by a call to VG_(poll)
+ (5000 milliseconds)
+16000 -> 16017 Well, 5 seconds is too short for me to type a attach pid command
+ so increase to 8 seconds.
+3251 -> 3254 Fix for clean helpers on BE
+3252 -> 3255 Fix rounding mode check and instruction stxvl
+16001 -> 16019 mips32: test for syscalls prctl(GET/SET_FP_MODE)
+16002 Update svn:ignore list
+3253 -> 3256 mips64: support for fp32 mode
+16003 -> 16020 mips64: support for prctl(GET/SET_FP_MODE) syscalls
+16004 -> 16021 mips64: support for prctl(GET/SET_FP_MODE) syscalls
+16005 mips: update svn:ignore list
+16006 -> 16022 dhat: add "tot-blocks-allocd" metric
+
+16018 mips: replace use of (d)addi with (d)addiu
+(tracked up to and including 16022)
3.12.0.BETA1 is 3_12_BRANCHes at 15973/3250.
|
|
From: <sv...@va...> - 2016-10-05 14:58:15
|
Author: sewardj
Date: Wed Oct 5 15:58:08 2016
New Revision: 16022
Log:
Merge from trunk:
r16006 dhat: add "tot-blocks-allocd" metric
Modified:
branches/VALGRIND_3_12_BRANCH/ (props changed)
branches/VALGRIND_3_12_BRANCH/exp-dhat/dh_main.c
branches/VALGRIND_3_12_BRANCH/exp-dhat/docs/dh-manual.xml
Modified: branches/VALGRIND_3_12_BRANCH/exp-dhat/dh_main.c
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/exp-dhat/dh_main.c (original)
+++ branches/VALGRIND_3_12_BRANCH/exp-dhat/dh_main.c Wed Oct 5 15:58:08 2016
@@ -1065,8 +1065,9 @@
" sort the allocation points by the metric\n"
" defined by <string>, thusly:\n"
" max-bytes-live maximum live bytes [default]\n"
-" tot-bytes-allocd total allocation (turnover)\n"
+" tot-bytes-allocd bytes allocated in total (turnover)\n"
" max-blocks-live maximum live blocks\n"
+" tot-blocks-allocd blocks allocated in total (turnover)\n"
);
}
@@ -1175,6 +1176,9 @@
static ULong get_metric__max_blocks_live ( APInfo* api ) {
return api->max_blocks_live;
}
+static ULong get_metric__tot_blocks ( APInfo* api ) {
+ return api->tot_blocks;
+}
/* Given a string, return the metric-access function and also a Bool
indicating whether we want increasing or decreasing values of the
@@ -1200,6 +1204,11 @@
*increasingP = False;
return True;
}
+ if (0 == VG_(strcmp)(metric_name, "tot-blocks-allocd")) {
+ *get_metricP = get_metric__tot_blocks;
+ *increasingP = False;
+ return True;
+ }
return False;
}
Modified: branches/VALGRIND_3_12_BRANCH/exp-dhat/docs/dh-manual.xml
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/exp-dhat/docs/dh-manual.xml (original)
+++ branches/VALGRIND_3_12_BRANCH/exp-dhat/docs/dh-manual.xml Wed Oct 5 15:58:08 2016
@@ -372,16 +372,17 @@
allocation points according to some metric, and shows the
highest scoring entries. <varname>--sort-by</varname>
selects the metric used for sorting:</para>
- <para><varname>max-bytes-live </varname> maximum live bytes [default]</para>
- <para><varname>tot-bytes-allocd </varname> total allocation (turnover)</para>
- <para><varname>max-blocks-live </varname> maximum live blocks</para>
+ <para><varname>max-bytes-live </varname> maximum live bytes [default]</para>
+ <para><varname>tot-bytes-allocd </varname> bytes allocates in total (turnover)</para>
+ <para><varname>max-blocks-live </varname> maximum live blocks</para>
+ <para><varname>tot-blocks-allocd </varname> blocks allocated in total (turnover)</para>
<para>This controls the order in which allocation points are
displayed. You can choose to look at allocation points with
- the highest maximum liveness, or the highest total turnover, or
- by the highest number of live blocks. These give usefully
- different pictures of program behaviour. For example, sorting
- by maximum live blocks tends to show up allocation points
- creating large numbers of small objects.</para>
+ the highest number of live bytes, or the highest total byte turnover, or
+ by the highest number of live blocks, or the highest total block
+ turnover. These give usefully different pictures of program behaviour.
+ For example, sorting by maximum live blocks tends to show up allocation
+ points creating large numbers of small objects.</para>
</listitem>
</varlistentry>
|
|
From: <sv...@va...> - 2016-10-05 14:54:33
|
Author: sewardj
Date: Wed Oct 5 15:54:24 2016
New Revision: 16021
Log:
Merge from trunk:
r16004 mips64: support for prctl(GET/SET_FP_MODE) syscalls
Added:
branches/VALGRIND_3_12_BRANCH/none/tests/mips64/change_fp_mode.c
- copied unchanged from r16004, trunk/none/tests/mips64/change_fp_mode.c
branches/VALGRIND_3_12_BRANCH/none/tests/mips64/change_fp_mode.stderr.exp
- copied unchanged from r16004, trunk/none/tests/mips64/change_fp_mode.stderr.exp
branches/VALGRIND_3_12_BRANCH/none/tests/mips64/change_fp_mode.stdout.exp
- copied unchanged from r16004, trunk/none/tests/mips64/change_fp_mode.stdout.exp
branches/VALGRIND_3_12_BRANCH/none/tests/mips64/change_fp_mode.vgtest
- copied unchanged from r16004, trunk/none/tests/mips64/change_fp_mode.vgtest
Modified:
branches/VALGRIND_3_12_BRANCH/ (props changed)
branches/VALGRIND_3_12_BRANCH/none/tests/mips64/Makefile.am
Modified: branches/VALGRIND_3_12_BRANCH/none/tests/mips64/Makefile.am
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/none/tests/mips64/Makefile.am (original)
+++ branches/VALGRIND_3_12_BRANCH/none/tests/mips64/Makefile.am Wed Oct 5 15:54:24 2016
@@ -10,6 +10,7 @@
branch_and_jump_instructions.stdout.exp \
branch_and_jump_instructions.stderr.exp branch_and_jump_instructions.vgtest \
branches.stdout.exp branches.stderr.exp branches.vgtest \
+ change_fp_mode.stderr.exp change_fp_mode.stdout.exp change_fp_mode.vgtest \
cvm_bbit.stdout.exp cvm_bbit.stdout.exp-non-octeon \
cvm_bbit.stderr.exp cvm_bbit.vgtest \
cvm_ins.stdout.exp cvm_ins.stdout.exp-non-octeon \
@@ -65,6 +66,7 @@
arithmetic_instruction \
branch_and_jump_instructions \
branches \
+ change_fp_mode \
cvm_bbit \
cvm_ins \
cvm_lx_ins \
|
|
From: <sv...@va...> - 2016-10-05 14:53:18
|
Author: sewardj
Date: Wed Oct 5 15:53:11 2016
New Revision: 16020
Log:
Merge from trunk:
r16003 mips64: support for prctl(GET/SET_FP_MODE) syscalls
Modified:
branches/VALGRIND_3_12_BRANCH/ (props changed)
branches/VALGRIND_3_12_BRANCH/coregrind/m_syswrap/syswrap-mips64-linux.c
branches/VALGRIND_3_12_BRANCH/include/vki/vki-mips64-linux.h
Modified: branches/VALGRIND_3_12_BRANCH/coregrind/m_syswrap/syswrap-mips64-linux.c
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/coregrind/m_syswrap/syswrap-mips64-linux.c (original)
+++ branches/VALGRIND_3_12_BRANCH/coregrind/m_syswrap/syswrap-mips64-linux.c Wed Oct 5 15:53:11 2016
@@ -312,7 +312,7 @@
DECL_TEMPLATE (mips_linux, sys_cacheflush);
DECL_TEMPLATE (mips_linux, sys_sched_rr_get_interval);
DECL_TEMPLATE (mips_linux, sys_unshare);
-DECL_TEMPLATE (mips_linux, sys_arch_prctl);
+DECL_TEMPLATE (mips_linux, sys_prctl);
DECL_TEMPLATE (mips_linux, sys_ptrace);
DECL_TEMPLATE (mips_linux, sys_mmap);
DECL_TEMPLATE (mips_linux, sys_rt_sigreturn);
@@ -616,6 +616,52 @@
}
}
+PRE (sys_prctl)
+{
+ switch (ARG1) {
+ case VKI_PR_SET_FP_MODE:
+ {
+ VexArchInfo vai;
+ VG_(machine_get_VexArchInfo)(NULL, &vai);
+ /* Reject unsupported modes */
+ if ((ARG2 & ~VKI_PR_FP_MODE_FR) ||
+ ((ARG2 & VKI_PR_FP_MODE_FR) &&
+ !VEX_MIPS_HOST_FP_MODE(vai.hwcaps))) {
+ SET_STATUS_Failure(VKI_EOPNOTSUPP);
+ } else {
+ if (!(VG_(threads)[tid].arch.vex.guest_CP0_status &
+ MIPS_CP0_STATUS_FR) != !(ARG2 & VKI_PR_FP_MODE_FR)) {
+ ThreadId t;
+ for (t = 1; t < VG_N_THREADS; t++) {
+ if (VG_(threads)[t].status != VgTs_Empty) {
+ if (ARG2 & VKI_PR_FP_MODE_FR) {
+ VG_(threads)[t].arch.vex.guest_CP0_status |=
+ MIPS_CP0_STATUS_FR;
+ } else {
+ VG_(threads)[t].arch.vex.guest_CP0_status &=
+ ~MIPS_CP0_STATUS_FR;
+ }
+ }
+ }
+ /* Discard all translations */
+ VG_(discard_translations)(0, (ULong)(-1ll), "prctl(PR_SET_FP_MODE)");
+ }
+ SET_STATUS_Success(0);
+ }
+ break;
+ }
+ case VKI_PR_GET_FP_MODE:
+ if (VG_(threads)[tid].arch.vex.guest_CP0_status & MIPS_CP0_STATUS_FR)
+ SET_STATUS_Success(VKI_PR_FP_MODE_FR);
+ else
+ SET_STATUS_Success(0);
+ break;
+ default:
+ WRAPPER_PRE_NAME(linux, sys_prctl)(tid, layout, arrghs, status, flags);
+ break;
+ }
+}
+
#undef PRE
#undef POST
@@ -787,7 +833,7 @@
LINX_ (__NR_vhangup, sys_vhangup),
LINX_ (__NR_pivot_root,sys_pivot_root),
LINXY (__NR__sysctl, sys_sysctl),
- LINXY (__NR_prctl, sys_prctl),
+ PLAX_ (__NR_prctl, sys_prctl),
LINXY (__NR_adjtimex, sys_adjtimex),
GENX_ (__NR_setrlimit, sys_setrlimit),
GENX_ (__NR_chroot, sys_chroot),
Modified: branches/VALGRIND_3_12_BRANCH/include/vki/vki-mips64-linux.h
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/include/vki/vki-mips64-linux.h (original)
+++ branches/VALGRIND_3_12_BRANCH/include/vki/vki-mips64-linux.h Wed Oct 5 15:53:11 2016
@@ -1011,6 +1011,13 @@
#define VKI_ENOSYS 89 /* Function not implemented */
#define VKI_EOVERFLOW 79 /* Value too large for defined data type */
+//----------------------------------------------------------------------
+// From linux-3.7.0/arch/mips/include/uapi/asm/errno.h
+//----------------------------------------------------------------------
+
+#define VKI_EOPNOTSUPP 122 /* Operation not supported on transport
+ endpoint */
+
#endif // __VKI_MIPS64_LINUX_H
/*--------------------------------------------------------------------*/
|
|
From: <sv...@va...> - 2016-10-05 14:52:07
|
Author: sewardj
Date: Wed Oct 5 15:51:57 2016
New Revision: 16019
Log:
Merge from trunk:
r16001 mips32: test for syscalls prctl(GET/SET_FP_MODE)
Added:
branches/VALGRIND_3_12_BRANCH/none/tests/mips32/change_fp_mode.c
- copied unchanged from r16001, trunk/none/tests/mips32/change_fp_mode.c
branches/VALGRIND_3_12_BRANCH/none/tests/mips32/change_fp_mode.stderr.exp
- copied unchanged from r16001, trunk/none/tests/mips32/change_fp_mode.stderr.exp
branches/VALGRIND_3_12_BRANCH/none/tests/mips32/change_fp_mode.stdout.exp
- copied unchanged from r16001, trunk/none/tests/mips32/change_fp_mode.stdout.exp
branches/VALGRIND_3_12_BRANCH/none/tests/mips32/change_fp_mode.stdout.exp-fpu32
- copied unchanged from r16001, trunk/none/tests/mips32/change_fp_mode.stdout.exp-fpu32
branches/VALGRIND_3_12_BRANCH/none/tests/mips32/change_fp_mode.vgtest
- copied unchanged from r16001, trunk/none/tests/mips32/change_fp_mode.vgtest
Modified:
branches/VALGRIND_3_12_BRANCH/ (props changed)
branches/VALGRIND_3_12_BRANCH/none/tests/mips32/Makefile.am
Modified: branches/VALGRIND_3_12_BRANCH/none/tests/mips32/Makefile.am
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/none/tests/mips32/Makefile.am (original)
+++ branches/VALGRIND_3_12_BRANCH/none/tests/mips32/Makefile.am Wed Oct 5 15:51:57 2016
@@ -6,6 +6,8 @@
EXTRA_DIST = \
block_size.stdout.exp block_size.stderr.exp block_size.vgtest \
branches.stdout.exp branches.stderr.exp branches.vgtest \
+ change_fp_mode.stdout.exp change_fp_mode.stdout.exp-fpu32 \
+ change_fp_mode.stderr.exp change_fp_mode.vgtest \
FPUarithmetic.stdout.exp FPUarithmetic.stdout.exp-mips32 \
FPUarithmetic.stderr.exp FPUarithmetic.vgtest \
LoadStore.stdout.exp LoadStore.stdout.exp-BE LoadStore.stderr.exp \
@@ -42,6 +44,7 @@
allexec \
block_size \
branches \
+ change_fp_mode \
FPUarithmetic \
LoadStore \
LoadStore1 \
|
|
From: <sv...@va...> - 2016-10-05 14:48:31
|
Author: sewardj
Date: Wed Oct 5 15:48:24 2016
New Revision: 3256
Log:
Merge, from trunk:
r3253 mips64: support for fp32 mode
Modified:
branches/VEX_3_12_BRANCH/ (props changed)
branches/VEX_3_12_BRANCH/priv/guest_mips_toIR.c
Modified: branches/VEX_3_12_BRANCH/priv/guest_mips_toIR.c
==============================================================================
--- branches/VEX_3_12_BRANCH/priv/guest_mips_toIR.c (original)
+++ branches/VEX_3_12_BRANCH/priv/guest_mips_toIR.c Wed Oct 5 15:48:24 2016
@@ -1429,8 +1429,8 @@
IRTemp t4 = newTemp(Ity_I32);
IRTemp t5 = newTemp(Ity_I64);
- assign(t0, getFReg(dregNo));
- assign(t1, getFReg(dregNo + 1));
+ assign(t0, getFReg(dregNo & (~1)));
+ assign(t1, getFReg(dregNo | 1));
assign(t3, unop(Iop_ReinterpF32asI32, mkexpr(t0)));
assign(t4, unop(Iop_ReinterpF32asI32, mkexpr(t1)));
@@ -1467,8 +1467,8 @@
assign(t6, unop(Iop_ReinterpF64asI64, mkexpr(t1)));
assign(t4, unop(Iop_64HIto32, mkexpr(t6))); /* hi */
assign(t5, unop(Iop_64to32, mkexpr(t6))); /* lo */
- putFReg(dregNo, unop(Iop_ReinterpI32asF32, mkexpr(t5)));
- putFReg(dregNo + 1, unop(Iop_ReinterpI32asF32, mkexpr(t4)));
+ putFReg(dregNo & (~1), unop(Iop_ReinterpI32asF32, mkexpr(t5)));
+ putFReg(dregNo | 1, unop(Iop_ReinterpI32asF32, mkexpr(t4)));
}
}
@@ -12236,7 +12236,7 @@
assign(t1, unop(Iop_64HIto32, mkexpr(t0)));
putIReg(rt, mkWidenFrom32(ty, mkexpr(t1), True));
break;
- } else if ((fs & 1) == 0) {
+ } else {
putIReg(rt, mkWidenFrom32(ty, unop(Iop_ReinterpF32asI32,
getFReg(fs | 1)), True));
break;
@@ -12254,7 +12254,7 @@
getLoFromF64(Ity_F64, getDReg(fs)))));
putDReg(fs, unop(Iop_ReinterpI64asF64, mkexpr(t0)));
break;
- } else if ((fs & 1) == 0) {
+ } else {
putFReg(fs | 1, unop(Iop_ReinterpI32asF32,
mkNarrowTo32(ty, getIReg(rt))));
break;
@@ -12536,55 +12536,25 @@
switch (fmt) {
case 0x10: /* S */
DIP("movn.s f%u, f%u, r%u", fd, fs, rt);
- t1 = newTemp(Ity_F64);
- t2 = newTemp(Ity_F64);
- t3 = newTemp(Ity_I1);
- t4 = newTemp(Ity_F64);
- if (mode64) {
- assign(t1, getFReg(fs));
- assign(t2, getFReg(fd));
- assign(t3, binop(Iop_CmpNE64, mkU64(0), getIReg(rt)));
- } else {
- if (fp_mode64) {
- assign(t1, getFReg(fs));
- assign(t2, getFReg(fd));
- assign(t3, binop(Iop_CmpNE32, mkU32(0), getIReg(rt)));
- } else {
- assign(t1, unop(Iop_F32toF64, getFReg(fs)));
- assign(t2, unop(Iop_F32toF64, getFReg(fd)));
- assign(t3, binop(Iop_CmpNE32, mkU32(0), getIReg(rt)));
- }
- }
+ t1 = newTemp(Ity_I1);
- assign(t4, IRExpr_ITE(mkexpr(t3), mkexpr(t1), mkexpr(t2)));
- if (fp_mode64) {
- IRTemp f = newTemp(Ity_F64);
- IRTemp fd_hi = newTemp(Ity_I32);
- t5 = newTemp(Ity_I64);
- assign(f, getFReg(fd));
- assign(fd_hi, unop(Iop_64HIto32, unop(Iop_ReinterpF64asI64,
- mkexpr(f))));
-
- assign(t5, mkWidenFrom32(Ity_I64, unop(Iop_64to32,
- unop(Iop_ReinterpF64asI64, mkexpr(t4))), True));
+ if (mode64)
+ assign(t1, binop(Iop_CmpNE64, mkU64(0), getIReg(rt)));
+ else
+ assign(t1, binop(Iop_CmpNE32, mkU32(0), getIReg(rt)));
- putFReg(fd, unop (Iop_ReinterpI64asF64, mkexpr(t5)));
- } else
- putFReg(fd, binop(Iop_F64toF32, get_IR_roundingmode(),
- mkexpr(t4)));
+ putFReg(fd, IRExpr_ITE(mkexpr(t1), getFReg(fs), getFReg(fd)));
break;
case 0x11: /* D */
DIP("movn.d f%u, f%u, r%u", fd, fs, rt);
-
- t3 = newTemp(Ity_I1);
- t4 = newTemp(Ity_F64);
+ t1 = newTemp(Ity_I1);
if (mode64)
- assign(t3, binop(Iop_CmpNE64, mkU64(0), getIReg(rt)));
+ assign(t1, binop(Iop_CmpNE64, mkU64(0), getIReg(rt)));
else
- assign(t3, binop(Iop_CmpNE32, mkU32(0), getIReg(rt)));
+ assign(t1, binop(Iop_CmpNE32, mkU32(0), getIReg(rt)));
- putDReg(fd, IRExpr_ITE(mkexpr(t3), getDReg(fs), getDReg(fd)));
+ putDReg(fd, IRExpr_ITE(mkexpr(t1), getDReg(fs), getDReg(fd)));
break;
default:
goto decode_failure;
@@ -12595,51 +12565,25 @@
switch (fmt) {
case 0x10: /* S */
DIP("movz.s f%u, f%u, r%u", fd, fs, rt);
+ t1 = newTemp(Ity_I1);
- t1 = newTemp(Ity_F64);
- t2 = newTemp(Ity_F64);
- t3 = newTemp(Ity_I1);
- t4 = newTemp(Ity_F64);
- if (fp_mode64) {
- assign(t1, getFReg(fs));
- assign(t2, getFReg(fd));
- if (mode64)
- assign(t3, binop(Iop_CmpEQ64, mkU64(0), getIReg(rt)));
- else
- assign(t3, binop(Iop_CmpEQ32, mkU32(0), getIReg(rt)));
- } else {
- assign(t1, unop(Iop_F32toF64, getFReg(fs)));
- assign(t2, unop(Iop_F32toF64, getFReg(fd)));
- assign(t3, binop(Iop_CmpEQ32, mkU32(0), getIReg(rt)));
- }
- assign(t4, IRExpr_ITE(mkexpr(t3), mkexpr(t1), mkexpr(t2)));
-
- if (fp_mode64) {
- IRTemp f = newTemp(Ity_F64);
- IRTemp fd_hi = newTemp(Ity_I32);
- t7 = newTemp(Ity_I64);
- assign(f, getFReg(fd));
- assign(fd_hi, unop(Iop_64HIto32,
- unop(Iop_ReinterpF64asI64, mkexpr(f))));
- assign(t7, mkWidenFrom32(Ity_I64, unop(Iop_64to32,
- unop(Iop_ReinterpF64asI64, mkexpr(t4))), True));
-
- putFReg(fd, unop(Iop_ReinterpI64asF64, mkexpr(t7)));
- } else
- putFReg(fd, binop(Iop_F64toF32, get_IR_roundingmode(),
- mkexpr(t4)));
+ if (mode64)
+ assign(t1, binop(Iop_CmpEQ64, mkU64(0), getIReg(rt)));
+ else
+ assign(t1, binop(Iop_CmpEQ32, mkU32(0), getIReg(rt)));
+ putFReg(fd, IRExpr_ITE(mkexpr(t1), getFReg(fs), getFReg(fd)));
break;
case 0x11: /* D */
DIP("movz.d f%u, f%u, r%u", fd, fs, rt);
- t3 = newTemp(Ity_I1);
- t4 = newTemp(Ity_F64);
+ t1 = newTemp(Ity_I1);
+
if (mode64)
- assign(t3, binop(Iop_CmpEQ64, mkU64(0), getIReg(rt)));
+ assign(t1, binop(Iop_CmpEQ64, mkU64(0), getIReg(rt)));
else
- assign(t3, binop(Iop_CmpEQ32, mkU32(0), getIReg(rt)));
+ assign(t1, binop(Iop_CmpEQ32, mkU32(0), getIReg(rt)));
- putDReg(fd, IRExpr_ITE(mkexpr(t3), getDReg(fs), getDReg(fd)));
+ putDReg(fd, IRExpr_ITE(mkexpr(t1), getDReg(fs), getDReg(fd)));
break;
default:
goto decode_failure;
@@ -12840,13 +12784,14 @@
putFReg(fs, mkWidenFromF32(tyF, mkexpr(t1)));
} else
- putFReg(fs, unop(Iop_ReinterpI32asF32, getIReg(rt)));
+ putFReg(fs, unop(Iop_ReinterpI32asF32,
+ mkNarrowTo32(ty, getIReg(rt))));
break;
case 0x5: /* Doubleword Move to Floating Point DMTC1; MIPS64 */
DIP("dmtc1 r%u, f%u", rt, fs);
vassert(mode64);
- putFReg(fs, unop(Iop_ReinterpI64asF64, getIReg(rt)));
+ putDReg(fs, unop(Iop_ReinterpI64asF64, getIReg(rt)));
break;
case 0x0: /* MFC1 */
@@ -12858,13 +12803,15 @@
assign(t1, unop(Iop_64to32, mkexpr(t0)));
putIReg(rt, mkWidenFrom32(ty, mkexpr(t1), True));
} else
- putIReg(rt, unop(Iop_ReinterpF32asI32, getFReg(fs)));
+ putIReg(rt, mkWidenFrom32(ty,
+ unop(Iop_ReinterpF32asI32, getFReg(fs)),
+ True));
break;
case 0x1: /* Doubleword Move from Floating Point DMFC1;
MIPS64 */
DIP("dmfc1 r%u, f%u", rt, fs);
- putIReg(rt, unop(Iop_ReinterpF64asI64, getFReg(fs)));
+ putIReg(rt, unop(Iop_ReinterpF64asI64, getDReg(fs)));
break;
case 0x6: /* CTC1 */
@@ -13476,29 +13423,16 @@
case 0x31: /* LWC1 */
/* Load Word to Floating Point - LWC1 (MIPS32) */
DIP("lwc1 f%u, %u(r%u)", ft, imm, rs);
+ LOAD_STORE_PATTERN;
if (fp_mode64) {
- t1 = newTemp(Ity_F32);
+ t0 = newTemp(Ity_F32);
t2 = newTemp(Ity_I64);
- if (mode64) {
- t0 = newTemp(Ity_I64);
- /* new LO */
- assign(t0, binop(Iop_Add64, getIReg(rs),
- mkU64(extend_s_16to64(imm))));
- } else {
- t0 = newTemp(Ity_I32);
- /* new LO */
- assign(t0, binop(Iop_Add32, getIReg(rs),
- mkU32(extend_s_16to32(imm))));
- }
- assign(t1, load(Ity_F32, mkexpr(t0)));
+ assign(t0, load(Ity_F32, mkexpr(t1)));
assign(t2, mkWidenFrom32(Ity_I64, unop(Iop_ReinterpF32asI32,
- mkexpr(t1)), True));
+ mkexpr(t0)), True));
putDReg(ft, unop(Iop_ReinterpI64asF64, mkexpr(t2)));
} else {
- t0 = newTemp(Ity_I32);
- assign(t0, binop(Iop_Add32, getIReg(rs),
- mkU32(extend_s_16to32(imm))));
- putFReg(ft, load(Ity_F32, mkexpr(t0)));
+ putFReg(ft, load(Ity_F32, mkexpr(t1)));
}
break;
@@ -13591,16 +13525,14 @@
case 0x0: { /* LWXC1 */
/* Load Word Indexed to Floating Point - LWXC1 (MIPS32r2) */
DIP("lwxc1 f%u, r%u(r%u)", fd, rt, rs);
+ t2 = newTemp(ty);
+ assign(t2, binop(mode64 ? Iop_Add64 : Iop_Add32, getIReg(rs),
+ getIReg(rt)));
if (fp_mode64) {
t0 = newTemp(Ity_I64);
t1 = newTemp(Ity_I32);
t3 = newTemp(Ity_F32);
t4 = newTemp(Ity_I64);
-
- t2 = newTemp(ty);
- /* new LO */
- assign(t2, binop(mode64 ? Iop_Add64 : Iop_Add32, getIReg(rs),
- getIReg(rt)));
assign(t3, load(Ity_F32, mkexpr(t2)));
assign(t4, mkWidenFrom32(Ity_I64, unop(Iop_ReinterpF32asI32,
@@ -13608,9 +13540,7 @@
putFReg(fd, unop(Iop_ReinterpI64asF64, mkexpr(t4)));
} else {
- t0 = newTemp(Ity_I32);
- assign(t0, binop(Iop_Add32, getIReg(rs), getIReg(rt)));
- putFReg(fd, load(Ity_F32, mkexpr(t0)));
+ putFReg(fd, load(Ity_F32, mkexpr(t2)));
}
break;
}
@@ -13618,29 +13548,12 @@
case 0x1: { /* LDXC1 */
/* Load Doubleword Indexed to Floating Point
LDXC1 (MIPS32r2 and MIPS64) */
- if (fp_mode64) {
- DIP("ldxc1 f%u, r%u(r%u)", fd, rt, rs);
- t0 = newTemp(ty);
- assign(t0, binop(mode64 ? Iop_Add64 : Iop_Add32, getIReg(rs),
- getIReg(rt)));
- putFReg(fd, load(Ity_F64, mkexpr(t0)));
- break;
- } else {
- t0 = newTemp(Ity_I32);
- assign(t0, binop(Iop_Add32, getIReg(rs), getIReg(rt)));
-
- t1 = newTemp(Ity_I32);
- assign(t1, binop(Iop_Add32, mkexpr(t0), mkU32(4)));
-
-#if defined (_MIPSEL)
- putFReg(fd, load(Ity_F32, mkexpr(t0)));
- putFReg(fd + 1, load(Ity_F32, mkexpr(t1)));
-#elif defined (_MIPSEB)
- putFReg(fd + 1, load(Ity_F32, mkexpr(t0)));
- putFReg(fd, load(Ity_F32, mkexpr(t1)));
-#endif
- break;
- }
+ DIP("ldxc1 f%u, r%u(r%u)", fd, rt, rs);
+ t0 = newTemp(ty);
+ assign(t0, binop(mode64 ? Iop_Add64 : Iop_Add32, getIReg(rs),
+ getIReg(rt)));
+ putDReg(fd, load(Ity_F64, mkexpr(t0)));
+ break;
}
case 0x5: /* Load Doubleword Indexed Unaligned to Floating Point - LUXC1;
@@ -13656,42 +13569,22 @@
case 0x8: { /* Store Word Indexed from Floating Point - SWXC1 */
DIP("swxc1 f%u, r%u(r%u)", ft, rt, rs);
+ t0 = newTemp(ty);
+ assign(t0, binop(mode64 ? Iop_Add64 : Iop_Add32, getIReg(rs),
+ getIReg(rt)));
if (fp_mode64) {
- t0 = newTemp(ty);
- assign(t0, binop(mode64 ? Iop_Add64 : Iop_Add32, getIReg(rs),
- getIReg(rt)));
store(mkexpr(t0), getLoFromF64(tyF, getFReg(fs)));
-
} else {
- t0 = newTemp(Ity_I32);
- assign(t0, binop(Iop_Add32, getIReg(rs), getIReg(rt)));
-
store(mkexpr(t0), getFReg(fs));
}
break;
}
case 0x9: { /* Store Doubleword Indexed from Floating Point - SDXC1 */
- DIP("sdc1 f%u, %u(%u)", ft, imm, rs);
- if (fp_mode64) {
- t0 = newTemp(ty);
- assign(t0, binop(mode64 ? Iop_Add64 : Iop_Add32, getIReg(rs),
- getIReg(rt)));
- store(mkexpr(t0), getFReg(fs));
- } else {
- t0 = newTemp(Ity_I32);
- assign(t0, binop(Iop_Add32, getIReg(rs), getIReg(rt)));
-
- t1 = newTemp(Ity_I32);
- assign(t1, binop(Iop_Add32, mkexpr(t0), mkU32(4)));
-
-#if defined (_MIPSEL)
- store(mkexpr(t0), getFReg(fs));
- store(mkexpr(t1), getFReg(fs + 1));
-#elif defined (_MIPSEB)
- store(mkexpr(t0), getFReg(fs + 1));
- store(mkexpr(t1), getFReg(fs));
-#endif
- }
+ DIP("sdxc1 f%u, r%u(r%u)", fs, rt, rs);
+ t0 = newTemp(ty);
+ assign(t0, binop(mode64 ? Iop_Add64 : Iop_Add32, getIReg(rs),
+ getIReg(rt)));
+ store(mkexpr(t0), getDReg(fs));
break;
}
case 0xD: /* Store Doubleword Indexed Unaligned from Floating Point -
|
|
From: <sv...@va...> - 2016-10-05 14:16:33
|
Author: petarj
Date: Wed Oct 5 15:16:25 2016
New Revision: 16018
Log:
mips: replace use of (d)addi with (d)addiu
Replace use of daddi/addi with daddiu/addiu.
This is more R6-friendly and we actually want to use the instructions
that do not cause integer overflow exception.
Patch by Vicente Olivert Riera.
Related issue - BZ#356112.
Modified:
trunk/coregrind/m_dispatch/dispatch-mips32-linux.S
trunk/coregrind/m_dispatch/dispatch-mips64-linux.S
trunk/coregrind/m_libcsetjmp.c
trunk/coregrind/m_syswrap/syswrap-mips64-linux.c
trunk/coregrind/m_trampoline.S
trunk/helgrind/tests/tc08_hbl2.c
Modified: trunk/coregrind/m_dispatch/dispatch-mips32-linux.S
==============================================================================
--- trunk/coregrind/m_dispatch/dispatch-mips32-linux.S (original)
+++ trunk/coregrind/m_dispatch/dispatch-mips32-linux.S Wed Oct 5 15:16:25 2016
@@ -196,7 +196,7 @@
addu $13, $13, $14
lw $12, 0($13) /* t3 = VG_(tt_fast)[hash] :: ULong* */
- addi $13, $13, 4
+ addiu $13, $13, 4
lw $25, 0($13) /* little-endian, so comparing 1st 32bit word */
nop
Modified: trunk/coregrind/m_dispatch/dispatch-mips64-linux.S
==============================================================================
--- trunk/coregrind/m_dispatch/dispatch-mips64-linux.S (original)
+++ trunk/coregrind/m_dispatch/dispatch-mips64-linux.S Wed Oct 5 15:16:25 2016
@@ -196,7 +196,7 @@
daddu $13, $13, $14
ld $12, 0($13) /* t3 = VG_(tt_fast)[hash] :: ULong* */
- daddi $13, $13, 8
+ daddiu $13, $13, 8
ld $25, 0($13) /* little-endian, so comparing 1st 32bit word */
nop
Modified: trunk/coregrind/m_libcsetjmp.c
==============================================================================
--- trunk/coregrind/m_libcsetjmp.c (original)
+++ trunk/coregrind/m_libcsetjmp.c Wed Oct 5 15:16:25 2016
@@ -594,7 +594,7 @@
/* Checking whether second argument is zero. */
" bnez $a1, 1f \n\t"
" nop \n\t"
-" addi $a1, $a1, 1 \n\t" /* We must return 1 if val=0. */
+" addiu $a1, $a1, 1 \n\t" /* We must return 1 if val=0. */
"1: \n\t"
" move $v0, $a1 \n\t" /* Return value of second argument. */
" j $ra \n\t"
Modified: trunk/coregrind/m_syswrap/syswrap-mips64-linux.c
==============================================================================
--- trunk/coregrind/m_syswrap/syswrap-mips64-linux.c (original)
+++ trunk/coregrind/m_syswrap/syswrap-mips64-linux.c Wed Oct 5 15:16:25 2016
@@ -173,7 +173,7 @@
" ld $30, 8($29)\n"
" ld $28, 16($29)\n"
" jr $31\n"
-" daddi $29,$29, 32\n"
+" daddiu $29,$29, 32\n"
".previous\n"
);
Modified: trunk/coregrind/m_trampoline.S
==============================================================================
--- trunk/coregrind/m_trampoline.S (original)
+++ trunk/coregrind/m_trampoline.S Wed Oct 5 15:16:25 2016
@@ -1278,8 +1278,8 @@
//la $a0, string
j strlen_cond
strlen_loop:
- addi $v0, $v0, 1
- addi $a0, $a0, 1
+ addiu $v0, $v0, 1
+ addiu $a0, $a0, 1
strlen_cond:
lbu $t0, ($a0)
bne $t0, $zero, strlen_loop
Modified: trunk/helgrind/tests/tc08_hbl2.c
==============================================================================
--- trunk/helgrind/tests/tc08_hbl2.c (original)
+++ trunk/helgrind/tests/tc08_hbl2.c Wed Oct 5 15:16:25 2016
@@ -125,11 +125,11 @@
# define INC(_lval,_lqual) \
__asm__ __volatile__ ( \
"L1xyzzy1" _lqual":\n" \
- " move $t0, %0\n" \
- " ll $t1, 0($t0)\n" \
- " addi $t1, $t1, 1\n" \
- " sc $t1, 0($t0)\n" \
- " beqz $t1, L1xyzzy1" _lqual \
+ " move $t0, %0\n" \
+ " ll $t1, 0($t0)\n" \
+ " addiu $t1, $t1, 1\n" \
+ " sc $t1, 0($t0)\n" \
+ " beqz $t1, L1xyzzy1" _lqual \
: /*out*/ : /*in*/ "r"(&(_lval)) \
: /*trash*/ "t0", "t1", "memory" \
)
|
|
From: <sv...@va...> - 2016-10-05 13:22:20
|
Author: sewardj
Date: Wed Oct 5 14:22:13 2016
New Revision: 3255
Log:
Merge from trunk:
r3252 Fix rounding mode check and instruction stxvl
Modified:
branches/VEX_3_12_BRANCH/ (props changed)
branches/VEX_3_12_BRANCH/priv/guest_ppc_toIR.c
branches/VEX_3_12_BRANCH/priv/host_ppc_isel.c
Modified: branches/VEX_3_12_BRANCH/priv/guest_ppc_toIR.c
==============================================================================
--- branches/VEX_3_12_BRANCH/priv/guest_ppc_toIR.c (original)
+++ branches/VEX_3_12_BRANCH/priv/guest_ppc_toIR.c Wed Oct 5 14:22:13 2016
@@ -20181,10 +20181,10 @@
{
UInt ea_off = 0;
IRExpr* irx_addr;
- IRTemp word0 = newTemp( Ity_I32 );
- IRTemp word1 = newTemp( Ity_I32 );
- IRTemp word2 = newTemp( Ity_I32 );
- IRTemp word3 = newTemp( Ity_I32 );
+ IRTemp word0 = newTemp( Ity_I64 );
+ IRTemp word1 = newTemp( Ity_I64 );
+ IRTemp word2 = newTemp( Ity_I64 );
+ IRTemp word3 = newTemp( Ity_I64 );
DIP("stxvx %d,r%u,r%u\n", (UInt)XS, rA_addr, rB_addr);
assign( word0, binop( Iop_Shr64,
@@ -20346,7 +20346,7 @@
mkexpr( shift ) ),
mkexpr( nb_mask ) ),
binop( Iop_AndV128,
- unop( Iop_Not64, mkexpr( nb_mask ) ),
+ unop( Iop_NotV128, mkexpr( nb_mask ) ),
mkexpr( current_mem) ) ) );
} else {
Modified: branches/VEX_3_12_BRANCH/priv/host_ppc_isel.c
==============================================================================
--- branches/VEX_3_12_BRANCH/priv/host_ppc_isel.c (original)
+++ branches/VEX_3_12_BRANCH/priv/host_ppc_isel.c Wed Oct 5 14:22:13 2016
@@ -1238,7 +1238,7 @@
return False;
vassert(mode->Iex.Const.con->tag == Ico_U32);
- vassert(mode->Iex.Const.con->Ico.U8 == 0x8);
+ vassert(mode->Iex.Const.con->Ico.U32 == 0x8);
return True;
}
|
|
From: <sv...@va...> - 2016-10-05 13:20:14
|
Author: sewardj
Date: Wed Oct 5 14:20:06 2016
New Revision: 3254
Log:
Merge from trunk:
r3251 Fix for clean helpers on BE
Modified:
branches/VEX_3_12_BRANCH/ (props changed)
branches/VEX_3_12_BRANCH/priv/guest_ppc_helpers.c
branches/VEX_3_12_BRANCH/priv/guest_ppc_toIR.c
Modified: branches/VEX_3_12_BRANCH/priv/guest_ppc_helpers.c
==============================================================================
--- branches/VEX_3_12_BRANCH/priv/guest_ppc_helpers.c (original)
+++ branches/VEX_3_12_BRANCH/priv/guest_ppc_helpers.c Wed Oct 5 14:20:06 2016
@@ -220,6 +220,11 @@
/*--- Misc BCD clean helpers. ---*/
/*---------------------------------------------------------------*/
+/* NOTE, the clean and dirty helpers need to called using the
+ * fnptr_to_fnentry() function wrapper to handle the Big Endian
+ * pointer-to-function ABI and the Little Endian ABI.
+ */
+
/* This C-helper takes a 128-bit BCD value as two 64-bit pieces.
* It checks the string to see if it is a valid 128-bit BCD value.
* A valid BCD value has a sign value in bits [3:0] between 0xA
Modified: branches/VEX_3_12_BRANCH/priv/guest_ppc_toIR.c
==============================================================================
--- branches/VEX_3_12_BRANCH/priv/guest_ppc_toIR.c (original)
+++ branches/VEX_3_12_BRANCH/priv/guest_ppc_toIR.c Wed Oct 5 14:20:06 2016
@@ -4321,7 +4321,8 @@
}
-static IRExpr * is_BCDstring128 (UInt Signed, IRExpr *src)
+static IRExpr * is_BCDstring128 ( const VexAbiInfo* vbi,
+ UInt Signed, IRExpr *src )
{
IRTemp valid = newTemp( Ity_I64 );
@@ -4338,7 +4339,7 @@
assign( valid,
mkIRExprCCall( Ity_I64, 0 /*regparms*/,
"is_BCDstring128_helper",
- &is_BCDstring128_helper,
+ fnptr_to_fnentry( vbi, &is_BCDstring128_helper ),
mkIRExprVec_3( mkU64( Signed ),
unop( Iop_V128HIto64, src ),
unop( Iop_V128to64, src ) ) ) );
@@ -4383,7 +4384,8 @@
mkU64( 0xF ) ) );
}
-static IRTemp increment_BCDstring (IRExpr *src, IRExpr *carry_in)
+static IRTemp increment_BCDstring ( const VexAbiInfo* vbi,
+ IRExpr *src, IRExpr *carry_in )
{
/* The src is a 128-bit value containing 31 BCD digits with the sign in
* the least significant byte. The bytes are BCD values between 0x0 and 0x9.
@@ -4418,7 +4420,8 @@
assign( bcd_result0,
mkIRExprCCall( Ity_I64, 0 /*regparms*/,
"increment_BCDstring32_helper",
- &increment_BCDstring32_helper,
+ fnptr_to_fnentry( vbi,
+ &increment_BCDstring32_helper ),
mkIRExprVec_3( mkU64( True /*Signed*/ ),
bcd_string0,
binop( Iop_32HLto64, mkU32( 0 ),
@@ -4427,7 +4430,8 @@
assign( bcd_result1,
mkIRExprCCall( Ity_I64, 0 /*regparms*/,
"increment_BCDstring32_helper",
- &increment_BCDstring32_helper,
+ fnptr_to_fnentry( vbi,
+ &increment_BCDstring32_helper ),
mkIRExprVec_3( mkU64( False /*Unsigned*/ ),
bcd_string1,
binop( Iop_Shr64,
@@ -4436,7 +4440,8 @@
assign( bcd_result2,
mkIRExprCCall( Ity_I64, 0 /*regparms*/,
"increment_BCDstring32_helper",
- &increment_BCDstring32_helper,
+ fnptr_to_fnentry( vbi,
+ &increment_BCDstring32_helper ),
mkIRExprVec_3( mkU64( False /*Unsigned*/ ),
bcd_string2,
binop( Iop_Shr64,
@@ -4445,7 +4450,8 @@
assign( bcd_result3,
mkIRExprCCall( Ity_I64, 0 /*regparms*/,
"increment_BCDstring32_helper",
- &increment_BCDstring32_helper,
+ fnptr_to_fnentry( vbi,
+ &increment_BCDstring32_helper ),
mkIRExprVec_3( mkU64( False /*Unsigned*/ ),
bcd_string3,
binop( Iop_Shr64,
@@ -4470,7 +4476,8 @@
return bcd_result;
}
-static IRExpr * convert_to_zoned ( IRExpr *src, IRExpr *upper_byte )
+static IRExpr * convert_to_zoned ( const VexAbiInfo* vbi,
+ IRExpr *src, IRExpr *upper_byte )
{
/* The function takes a V128 packed decimal value and returns
* the value in zoned format. Note, the sign of the value is ignored.
@@ -4486,7 +4493,7 @@
assign( result_low,
mkIRExprCCall( Ity_I64, 0 /*regparms*/,
"convert_to_zoned_helper",
- &convert_to_zoned_helper,
+ fnptr_to_fnentry( vbi, &convert_to_zoned_helper ),
mkIRExprVec_4( unop( Iop_V128HIto64, src ),
unop( Iop_V128to64, src ),
upper_byte,
@@ -4495,7 +4502,7 @@
assign( result_hi,
mkIRExprCCall( Ity_I64, 0 /*regparms*/,
"convert_to_zoned_helper",
- &convert_to_zoned_helper,
+ fnptr_to_fnentry( vbi, &convert_to_zoned_helper ),
mkIRExprVec_4( unop( Iop_V128HIto64, src ),
unop( Iop_V128to64, src ),
upper_byte,
@@ -4508,7 +4515,7 @@
return mkexpr( result );
}
-static IRExpr * convert_to_national ( IRExpr *src ) {
+static IRExpr * convert_to_national ( const VexAbiInfo* vbi, IRExpr *src ) {
/* The function takes 128-bit value which has a 64-bit packed decimal
* value in the lower 64-bits of the source. The packed decimal is
* converted to the national format via a clean helper. The clean
@@ -4528,14 +4535,14 @@
assign( result_low,
mkIRExprCCall( Ity_I64, 0 /*regparms*/,
"convert_to_national_helper",
- &convert_to_national_helper,
+ fnptr_to_fnentry( vbi, &convert_to_national_helper ),
mkIRExprVec_2( unop( Iop_V128to64, src ),
mkU64( 0 ) ) ) );
assign( result_hi,
mkIRExprCCall( Ity_I64, 0 /*regparms*/,
"convert_to_national_helper",
- &convert_to_national_helper,
+ fnptr_to_fnentry( vbi, &convert_to_national_helper ),
mkIRExprVec_2( unop( Iop_V128to64, src ),
mkU64( 1 ) ) ) );
@@ -4545,7 +4552,7 @@
return mkexpr( result );
}
-static IRExpr * convert_from_zoned ( IRExpr *src ) {
+static IRExpr * convert_from_zoned ( const VexAbiInfo* vbi, IRExpr *src ) {
/* The function takes 128-bit zoned value and returns a signless 64-bit
* packed decimal value in the lower 64-bits of the 128-bit result.
*/
@@ -4557,7 +4564,8 @@
mkU64( 0 ),
mkIRExprCCall( Ity_I64, 0 /*regparms*/,
"convert_from_zoned_helper",
- &convert_from_zoned_helper,
+ fnptr_to_fnentry( vbi,
+ &convert_from_zoned_helper ),
mkIRExprVec_2( unop( Iop_V128HIto64,
src ),
unop( Iop_V128to64,
@@ -4567,7 +4575,7 @@
return mkexpr( result );
}
-static IRExpr * convert_from_national ( IRExpr *src ) {
+static IRExpr * convert_from_national ( const VexAbiInfo* vbi, IRExpr *src ) {
/* The function takes 128-bit national value and returns a 64-bit
* packed decimal value.
*/
@@ -4576,7 +4584,8 @@
assign( result,
mkIRExprCCall( Ity_I64, 0 /*regparms*/,
"convert_from_national_helper",
- &convert_from_national_helper,
+ fnptr_to_fnentry( vbi,
+ &convert_from_national_helper ),
mkIRExprVec_2( unop( Iop_V128HIto64,
src ),
unop( Iop_V128to64,
@@ -22076,7 +22085,7 @@
d = unsafeIRDirty_0_N (
0/*regparms*/,
"ppc64g_dirtyhelper_LVS",
- &ppc64g_dirtyhelper_LVS,
+ fnptr_to_fnentry( vbi, &ppc64g_dirtyhelper_LVS ),
args_le );
}
DIP("lvsl v%d,r%u,r%u\n", vD_addr, rA_addr, rB_addr);
@@ -22126,7 +22135,7 @@
d = unsafeIRDirty_0_N (
0/*regparms*/,
"ppc64g_dirtyhelper_LVS",
- &ppc64g_dirtyhelper_LVS,
+ fnptr_to_fnentry( vbi, &ppc64g_dirtyhelper_LVS ),
args_le );
}
DIP("lvsr v%d,r%u,r%u\n", vD_addr, rA_addr, rB_addr);
@@ -25035,7 +25044,7 @@
except when an overflow occurs. But since we can't be 100% accurate
in our emulation of CR6, it seems best to just not support it all.
*/
-static Bool dis_av_bcd_misc ( UInt theInstr )
+static Bool dis_av_bcd_misc ( UInt theInstr, const VexAbiInfo* vbi )
{
UChar opc1 = ifieldOPC(theInstr);
UChar vRT_addr = ifieldRegDS(theInstr);
@@ -25087,8 +25096,10 @@
valid =
unop( Iop_64to32,
binop( Iop_And64,
- is_BCDstring128( /*Signed*/True, mkexpr( vA ) ),
- is_BCDstring128( /*Signed*/True, mkexpr( vB ) ) ) );
+ is_BCDstring128( vbi,
+ /*Signed*/True, mkexpr( vA ) ),
+ is_BCDstring128( vbi,
+ /*Signed*/True, mkexpr( vB ) ) ) );
sign_vb = binop( Iop_AndV128,
binop( Iop_64HLtoV128,
@@ -25149,7 +25160,7 @@
return True;
}
-static Bool dis_av_bcd ( UInt theInstr )
+static Bool dis_av_bcd ( UInt theInstr, const VexAbiInfo* vbi )
{
/* VX-Form */
UChar opc1 = ifieldOPC(theInstr);
@@ -25221,8 +25232,10 @@
valid =
unop( Iop_64to32,
binop( Iop_And64,
- is_BCDstring128( /* Signed */True, mkexpr( vA ) ),
- is_BCDstring128( /* Signed */True, mkexpr( vB ) ) ) );
+ is_BCDstring128( vbi,
+ /* Signed */True, mkexpr( vA ) ),
+ is_BCDstring128( vbi,
+ /* Signed */True, mkexpr( vB ) ) ) );
/* src A */
zeroA = BCDstring_zero( binop( Iop_AndV128,
@@ -25440,7 +25453,7 @@
valid =
unop( Iop_64to32,
- is_BCDstring128( /* Signed */True, mkexpr( vB ) ) );
+ is_BCDstring128( vbi, /* Signed */True, mkexpr( vB ) ) );
} else {
/* string is an unsigned BCD value */
@@ -25450,7 +25463,8 @@
valid =
unop( Iop_64to32,
- is_BCDstring128( /* Unsigned */False, mkexpr( vB ) ) );
+ is_BCDstring128( vbi, /* Unsigned */False,
+ mkexpr( vB ) ) );
}
/* if PS = 0
@@ -25507,7 +25521,7 @@
new_sign_val ),
binop( Iop_AndV128,
not_excess_shift_mask,
- mkexpr( increment_BCDstring( result,
+ mkexpr( increment_BCDstring( vbi, result,
mkexpr( round)
) ) ) ) );
} else { // bcdus.
@@ -25623,7 +25637,7 @@
}
valid =
unop( Iop_64to32,
- is_BCDstring128( /* Signed */True, mkexpr( vB ) ) );
+ is_BCDstring128( vbi, /* Signed */True, mkexpr( vB ) ) );
} else { // bcdutrunc.
/* Check if all of the digits are zero */
@@ -25636,7 +25650,8 @@
pos = mkNOT1( zero );
valid =
unop( Iop_64to32,
- is_BCDstring128( /* Unsigned */False, mkexpr( vB ) ) );
+ is_BCDstring128( vbi, /* Unsigned */False,
+ mkexpr( vB ) ) );
}
/* If vB is not valid, the result is undefined, but we need to
@@ -25708,7 +25723,8 @@
/* Check each of the nibbles for a valid digit 0 to 9 */
valid =
unop( Iop_64to32,
- is_BCDstring128( /* Signed */True, mkexpr( vB ) ) );
+ is_BCDstring128( vbi, /* Signed */True,
+ mkexpr( vB ) ) );
overflow = mkU1( 0 ); // not used
}
break;
@@ -25863,7 +25879,8 @@
pos = mkAND1( mkNOT1( sign ), mkNOT1( zero ) );
assign( tmp,
- convert_to_zoned( mkexpr( vB ), mkU64( upper_byte ) ) );
+ convert_to_zoned( vbi, mkexpr( vB ),
+ mkU64( upper_byte ) ) );
/* Insert the sign based on ps and sign of vB
* in the lower byte.
@@ -25906,7 +25923,8 @@
*/
valid =
unop( Iop_64to32,
- is_BCDstring128( /* Signed */True, mkexpr( vB ) ) );
+ is_BCDstring128( vbi, /* Signed */True,
+ mkexpr( vB ) ) );
}
break;
@@ -25940,7 +25958,8 @@
*/
valid =
unop( Iop_64to32,
- is_BCDstring128( /* Signed */True, mkexpr( vB ) ) );
+ is_BCDstring128( vbi, /* Signed */True,
+ mkexpr( vB ) ) );
/* Upper 24 hex digits of VB, i.e. hex ditgits vB[0:23],
* must be zero for the ox_flag to be zero. This goes
@@ -26001,7 +26020,7 @@
pos = mkAND1( mkNOT1( sign ), mkNOT1( zero ) );
assign( tmp,
- convert_to_national( mkexpr( vB ) ) );
+ convert_to_national( vbi, mkexpr( vB ) ) );
/* If vB is positive insert sign value 0x002B, otherwise
* insert 0x002D for negative. Have to use sign not neg
@@ -26009,7 +26028,7 @@
* OR'd with (sign << 1 | NOT sign) << 1.
* sign = 1 if vB is negative.
*/
- putVReg(vRT_addr,
+ putVReg( vRT_addr,
binop( Iop_OrV128,
mkexpr( tmp ),
binop( Iop_64HLtoV128,
@@ -26033,7 +26052,8 @@
*/
valid =
unop( Iop_64to32,
- is_BCDstring128( /* Signed */True, mkexpr( vB ) ) );
+ is_BCDstring128( vbi, /* Signed */True,
+ mkexpr( vB ) ) );
overflow = ox_flag;
}
@@ -26049,7 +26069,7 @@
valid = unop( Iop_1Uto32, is_Zoned_decimal( vB, ps ) );
assign( tmp,
- convert_from_zoned( mkexpr( vB ) ) );
+ convert_from_zoned( vbi, mkexpr( vB ) ) );
/* If the result of checking the lower 4 bits of each 8-bit
* value is zero, then the "number" was zero.
@@ -26129,7 +26149,7 @@
/* sign = 1 if vB is negative */
sign = binop( Iop_CmpEQ64, mkexpr( hword_7 ), mkU64( 0x002D ) );
- assign( tmp, convert_from_national( mkexpr( vB ) ) );
+ assign( tmp, convert_from_national( vbi, mkexpr( vB ) ) );
/* If the result of checking the lower 4 bits of each 16-bit
* value is zero, then the "number" was zero.
@@ -26221,7 +26241,8 @@
valid =
unop( Iop_64to32,
- is_BCDstring128( /* Signed */True, mkexpr( vB ) ) );
+ is_BCDstring128( vbi, /* Signed */True,
+ mkexpr( vB ) ) );
/* if PS = 0
vB positive, sign is C
@@ -28388,7 +28409,7 @@
case 0x181: // bcdcfn., bcdcfz.
// bcdctz., bcdcfsq., bcdctsq.
if (!allow_isa_2_07) goto decode_noP8;
- if (dis_av_bcd( theInstr )) goto decode_success;
+ if (dis_av_bcd( theInstr, abiinfo )) goto decode_success;
goto decode_failure;
default:
break; // Fall through...
@@ -28401,7 +28422,7 @@
case 0x341: // bcdcpsgn
if (!allow_isa_2_07) goto decode_noP8;
- if (dis_av_bcd_misc( theInstr )) goto decode_success;
+ if (dis_av_bcd_misc( theInstr, abiinfo )) goto decode_success;
goto decode_failure;
|
|
From: <sv...@va...> - 2016-10-05 13:17:13
|
Author: sewardj
Date: Wed Oct 5 14:17:03 2016
New Revision: 16017
Log:
Merge from trunk:
r15999 Replace --wait-for-gdb=yes memory loop by a call to VG_(poll)
(5000 milliseconds)
r16000 Well, 5 seconds is too short for me to type a attach pid command
so increase to 8 seconds.
Modified:
branches/VALGRIND_3_12_BRANCH/ (props changed)
branches/VALGRIND_3_12_BRANCH/coregrind/m_main.c
Modified: branches/VALGRIND_3_12_BRANCH/coregrind/m_main.c
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/coregrind/m_main.c (original)
+++ branches/VALGRIND_3_12_BRANCH/coregrind/m_main.c Wed Oct 5 14:17:03 2016
@@ -2166,36 +2166,10 @@
/* Hook to delay things long enough so we can get the pid and
attach GDB in another shell. */
if (VG_(clo_wait_for_gdb)) {
- ULong iters, q;
- VG_(debugLog)(1, "main", "Wait for GDB\n");
- VG_(printf)("pid=%d, entering delay loop\n", VG_(getpid)());
-
-# if defined(VGP_x86_linux)
- iters = 10;
-# elif defined(VGP_amd64_linux) || defined(VGP_ppc64be_linux) \
- || defined(VGP_ppc64le_linux) || defined(VGP_tilegx_linux)
- iters = 10;
-# elif defined(VGP_ppc32_linux)
- iters = 5;
-# elif defined(VGP_arm_linux)
- iters = 5;
-# elif defined(VGP_arm64_linux)
- iters = 5;
-# elif defined(VGP_s390x_linux)
- iters = 10;
-# elif defined(VGP_mips32_linux) || defined(VGP_mips64_linux)
- iters = 10;
-# elif defined(VGO_darwin)
- iters = 3;
-# elif defined(VGO_solaris)
- iters = 10;
-# else
-# error "Unknown plat"
-# endif
-
- iters *= 1000ULL * 1000 * 1000;
- for (q = 0; q < iters; q++)
- __asm__ __volatile__("" ::: "memory","cc");
+ const int ms = 8000; // milliseconds
+ VG_(debugLog)(1, "main", "Wait for GDB during %d ms\n", ms);
+ VG_(printf)("pid=%d, entering delay %d ms loop\n", VG_(getpid)(), ms);
+ VG_(poll)(NULL, 0, ms);
}
//--------------------------------------------------------------
|
Author: sewardj
Date: Wed Oct 5 14:12:24 2016
New Revision: 16016
Log:
Merge from trunk:
r15981 Add ioctl wrapper for MNTIOC_GETEXTMNTENT.
Modified:
branches/VALGRIND_3_12_BRANCH/ (props changed)
branches/VALGRIND_3_12_BRANCH/coregrind/m_syswrap/syswrap-solaris.c
branches/VALGRIND_3_12_BRANCH/include/vki/vki-solaris.h
branches/VALGRIND_3_12_BRANCH/memcheck/tests/solaris/scalar_ioctl.c
branches/VALGRIND_3_12_BRANCH/memcheck/tests/solaris/scalar_ioctl.stderr.exp
Modified: branches/VALGRIND_3_12_BRANCH/coregrind/m_syswrap/syswrap-solaris.c
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/coregrind/m_syswrap/syswrap-solaris.c (original)
+++ branches/VALGRIND_3_12_BRANCH/coregrind/m_syswrap/syswrap-solaris.c Wed Oct 5 14:12:24 2016
@@ -3042,6 +3042,21 @@
break;
/* mntio */
+ case VKI_MNTIOC_GETEXTMNTENT:
+ {
+ PRE_MEM_READ("ioctl(MNTIOC_GETEXTMNTENT)",
+ ARG3, sizeof(struct vki_mntentbuf));
+
+ struct vki_mntentbuf *embuf = (struct vki_mntentbuf *) ARG3;
+ if (ML_(safe_to_deref(embuf, sizeof(*embuf)))) {
+ PRE_MEM_WRITE("ioctl(MNTIOC_GETEXTMNTENT, embuf->mbuf_emp)",
+ (Addr) embuf->mbuf_emp, sizeof(struct vki_extmnttab));
+ PRE_MEM_WRITE("ioctl(MNTIOC_GETEXTMNTENT, embuf->mbuf_buf)",
+ (Addr) embuf->mbuf_buf, embuf->mbuf_bufsize);
+ }
+ }
+ break;
+
case VKI_MNTIOC_GETMNTANY:
{
PRE_MEM_READ("ioctl(MNTIOC_GETMNTANY)",
@@ -3050,13 +3065,11 @@
struct vki_mntentbuf *embuf = (struct vki_mntentbuf *) ARG3;
if (ML_(safe_to_deref(embuf, sizeof(*embuf)))) {
PRE_MEM_READ("ioctl(MNTIOC_GETMNTANY, embuf->mbuf_emp)",
- (Addr) embuf->mbuf_emp,
- sizeof(struct vki_mnttab));
+ (Addr) embuf->mbuf_emp, sizeof(struct vki_mnttab));
PRE_MEM_WRITE("ioctl(MNTIOC_GETMNTANY, embuf->mbuf_buf)",
- (Addr) embuf->mbuf_buf,
- embuf->mbuf_bufsize);
- struct vki_mnttab *mnt
- = (struct vki_mnttab *) embuf->mbuf_emp;
+ (Addr) embuf->mbuf_buf, embuf->mbuf_bufsize);
+
+ struct vki_mnttab *mnt = (struct vki_mnttab *) embuf->mbuf_emp;
if (ML_(safe_to_deref(mnt, sizeof(struct vki_mnttab)))) {
if (mnt->mnt_special != NULL)
PRE_MEM_RASCIIZ("ioctl(MNTIOC_GETMNTANY, mnt->mnt_special)",
@@ -3331,6 +3344,32 @@
break;
/* mntio */
+ case VKI_MNTIOC_GETEXTMNTENT:
+ {
+ struct vki_mntentbuf *embuf = (struct vki_mntentbuf *) ARG3;
+ struct vki_extmnttab *mnt = (struct vki_extmnttab *) embuf->mbuf_emp;
+
+ POST_MEM_WRITE((Addr) mnt, sizeof(struct vki_extmnttab));
+ if (mnt != NULL) {
+ if (mnt->mnt_special != NULL)
+ POST_MEM_WRITE((Addr) mnt->mnt_special,
+ VG_(strlen)(mnt->mnt_special) + 1);
+ if (mnt->mnt_mountp != NULL)
+ POST_MEM_WRITE((Addr) mnt->mnt_mountp,
+ VG_(strlen)(mnt->mnt_mountp) + 1);
+ if (mnt->mnt_fstype != NULL)
+ POST_MEM_WRITE((Addr) mnt->mnt_fstype,
+ VG_(strlen)(mnt->mnt_fstype) + 1);
+ if (mnt->mnt_mntopts != NULL)
+ POST_MEM_WRITE((Addr) mnt->mnt_mntopts,
+ VG_(strlen)(mnt->mnt_mntopts) + 1);
+ if (mnt->mnt_time != NULL)
+ POST_MEM_WRITE((Addr) mnt->mnt_time,
+ VG_(strlen)(mnt->mnt_time) + 1);
+ }
+ }
+ break;
+
case VKI_MNTIOC_GETMNTANY:
{
struct vki_mntentbuf *embuf = (struct vki_mntentbuf *) ARG3;
Modified: branches/VALGRIND_3_12_BRANCH/include/vki/vki-solaris.h
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/include/vki/vki-solaris.h (original)
+++ branches/VALGRIND_3_12_BRANCH/include/vki/vki-solaris.h Wed Oct 5 14:12:24 2016
@@ -644,10 +644,12 @@
#include <sys/mntio.h>
+#define VKI_MNTIOC_GETEXTMNTENT MNTIOC_GETEXTMNTENT
#define VKI_MNTIOC_GETMNTANY MNTIOC_GETMNTANY
#include <sys/mnttab.h>
+#define vki_extmnttab extmnttab
#define vki_mntentbuf mntentbuf
#define vki_mnttab mnttab
Modified: branches/VALGRIND_3_12_BRANCH/memcheck/tests/solaris/scalar_ioctl.c
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/memcheck/tests/solaris/scalar_ioctl.c (original)
+++ branches/VALGRIND_3_12_BRANCH/memcheck/tests/solaris/scalar_ioctl.c Wed Oct 5 14:12:24 2016
@@ -28,6 +28,46 @@
/* mntio */
__attribute__((noinline))
+static void sys_ioctl_MNTIOC_GETEXTMNTENT(void)
+{
+ GO(SYS_ioctl, "(MNTIOC_GETEXTMNTENT) 3s 1m");
+ SY(SYS_ioctl, x0 - 1, x0 + MNTIOC_GETEXTMNTENT, x0 + 1); FAIL;
+}
+
+__attribute__((noinline))
+static void sys_ioctl_MNTIOC_GETEXTMNTENT_2(void)
+{
+ struct mntentbuf embuf;
+
+ embuf.mbuf_emp = (void *) (x0 + 1);
+ embuf.mbuf_buf = (void *) (x0 + 1);
+ embuf.mbuf_bufsize = x0 + 1;
+
+ GO(SYS_ioctl, "(MNTIOC_GETEXTMNTENT) 4s 2m");
+ SY(SYS_ioctl, x0 - 1, x0 + MNTIOC_GETEXTMNTENT, &embuf + x0); FAIL;
+}
+
+__attribute__((noinline))
+static void sys_ioctl_MNTIOC_GETEXTMNTENT_3(void)
+{
+ struct extmnttab mnt;
+ struct mntentbuf embuf;
+
+ mnt.mnt_special = (void *) (x0 + 1);
+ mnt.mnt_mountp = (void *) (x0 + 1);
+ mnt.mnt_fstype = (void *) (x0 + 1);
+ mnt.mnt_mntopts = (void *) (x0 + 1);
+ mnt.mnt_time = (void *) (x0 + 1);
+
+ embuf.mbuf_emp = x0 + &mnt;
+ embuf.mbuf_buf = (void *) (x0 + 1);
+ embuf.mbuf_bufsize = x0 + 1;
+
+ GO(SYS_ioctl, "(MNTIOC_GETEXTMNTENT) 5s 6m");
+ SY(SYS_ioctl, x0 - 1, x0 + MNTIOC_GETEXTMNTENT, &embuf + x0); FAIL;
+}
+
+__attribute__((noinline))
static void sys_ioctl_MNTIOC_GETMNTANY(void)
{
GO(SYS_ioctl, "(MNTIOC_GETMNTANY) 3s 1m");
@@ -484,6 +524,9 @@
sys_ioctl_POOL_STATUSQ();
/* mntio */
+ sys_ioctl_MNTIOC_GETEXTMNTENT();
+ sys_ioctl_MNTIOC_GETEXTMNTENT_2();
+ sys_ioctl_MNTIOC_GETEXTMNTENT_3();
sys_ioctl_MNTIOC_GETMNTANY();
sys_ioctl_MNTIOC_GETMNTANY_2();
sys_ioctl_MNTIOC_GETMNTANY_3();
Modified: branches/VALGRIND_3_12_BRANCH/memcheck/tests/solaris/scalar_ioctl.stderr.exp
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/memcheck/tests/solaris/scalar_ioctl.stderr.exp (original)
+++ branches/VALGRIND_3_12_BRANCH/memcheck/tests/solaris/scalar_ioctl.stderr.exp Wed Oct 5 14:12:24 2016
@@ -15,6 +15,66 @@
Address 0x........ is not stack'd, malloc'd or (recently) free'd
---------------------------------------------------------
+ 54: SYS_ioctl (MNTIOC_GETEXTMNTENT) 3s 1m
+---------------------------------------------------------
+Syscall param ioctl(fd) contains uninitialised byte(s)
+ ...
+
+Syscall param ioctl(request) contains uninitialised byte(s)
+ ...
+
+Syscall param ioctl(arg) contains uninitialised byte(s)
+ ...
+
+Syscall param ioctl(MNTIOC_GETEXTMNTENT) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+---------------------------------------------------------
+ 54: SYS_ioctl (MNTIOC_GETEXTMNTENT) 4s 2m
+---------------------------------------------------------
+Syscall param ioctl(fd) contains uninitialised byte(s)
+ ...
+
+Syscall param ioctl(request) contains uninitialised byte(s)
+ ...
+
+Syscall param ioctl(arg) contains uninitialised byte(s)
+ ...
+
+Syscall param ioctl(MNTIOC_GETEXTMNTENT) points to uninitialised byte(s)
+ ...
+ Address 0x........ is on thread 1's stack
+
+Syscall param ioctl(MNTIOC_GETEXTMNTENT, embuf->mbuf_emp) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+Syscall param ioctl(MNTIOC_GETEXTMNTENT, embuf->mbuf_buf) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+---------------------------------------------------------
+ 54: SYS_ioctl (MNTIOC_GETEXTMNTENT) 5s 6m
+---------------------------------------------------------
+Syscall param ioctl(fd) contains uninitialised byte(s)
+ ...
+
+Syscall param ioctl(request) contains uninitialised byte(s)
+ ...
+
+Syscall param ioctl(arg) contains uninitialised byte(s)
+ ...
+
+Syscall param ioctl(MNTIOC_GETEXTMNTENT) points to uninitialised byte(s)
+ ...
+ Address 0x........ is on thread 1's stack
+
+Syscall param ioctl(MNTIOC_GETEXTMNTENT, embuf->mbuf_buf) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+---------------------------------------------------------
54: SYS_ioctl (MNTIOC_GETMNTANY) 3s 1m
---------------------------------------------------------
Syscall param ioctl(fd) contains uninitialised byte(s)
@@ -343,6 +403,9 @@
---------------------------------------------------------
54: SYS_ioctl (I_FIND) 3s 1m
---------------------------------------------------------
+
+More than 100 errors detected. Subsequent errors
+will still be recorded, but in less detail than before.
Syscall param ioctl(fd) contains uninitialised byte(s)
...
@@ -402,9 +465,6 @@
Syscall param ioctl(fd) contains uninitialised byte(s)
...
-
-More than 100 errors detected. Subsequent errors
-will still be recorded, but in less detail than before.
Syscall param ioctl(request) contains uninitialised byte(s)
...
|
Author: sewardj
Date: Wed Oct 5 06:42:01 2016
New Revision: 16015
Log:
Merge from trunk:
r15990 Fix pre_mem_read_sockaddr crash on invalid syscall arguments.
Bug #369356.
r15991 Fix crash in msghdr_foreachfield when iov_len isn't safe to dereference.
Bug #369359
r15992 Fix crash when old/new sigprocmask isn't safe to dereference.
Bug #369360.
r15993 Fix crash in vmsplice linux kernel wrapper when iovec is bad.
Bug #369361.
r15994 Fix crash in linux [rt_]sigaction wrapper with bad old/new
sigaction handler. Bug #369362
r15995 Fix crash in sys_modify_ldt wrapper on bad ptr.
Bug #369383.
r15996 linux-x86 check get/set_thread_area pointer before use.
Bug #369402.
r15997 Don't check bad iovec array in process_vm_readv/writev.
Bug #369441.
r15998 Don't crash, but warn and return EINVAL on unknown fcntl command.
Modified:
branches/VALGRIND_3_12_BRANCH/ (props changed)
branches/VALGRIND_3_12_BRANCH/NEWS (contents, props changed)
branches/VALGRIND_3_12_BRANCH/coregrind/m_syswrap/syswrap-generic.c
branches/VALGRIND_3_12_BRANCH/coregrind/m_syswrap/syswrap-linux.c
branches/VALGRIND_3_12_BRANCH/coregrind/m_syswrap/syswrap-x86-linux.c
Modified: branches/VALGRIND_3_12_BRANCH/NEWS
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/NEWS (original)
+++ branches/VALGRIND_3_12_BRANCH/NEWS Wed Oct 5 06:42:01 2016
@@ -179,6 +179,15 @@
361253 [s390x] ex_clone.c:42: undefined reference to `pthread_create'
369169 ppc64 fails jm_int_isa_2_07 test
369209 valgrind loops and eats up all memory if cwd doesn't exist.
+369356 pre_mem_read_sockaddr syscall wrapper can crash with bad sockaddr
+369359 msghdr_foreachfield can crash when handling bad iovec
+369360 Bad sigprocmask old or new sets can crash valgrind
+369361 vmsplice syscall wrapper crashes on bad iovec
+369362 Bad sigaction arguments crash valgrind
+369383 x86 sys_modify_ldt wrapper crashes on bad ptr
+369402 Bad set/get_thread_area pointer crashes valgrind
+369441 bad lvec argument crashes process_vm_readv/writev syscall wrappers
+369446 valgrind crashes on unknown fcntl command
n-i-bz Fix incorrect (or infinite loop) unwind on RHEL7 x86 and amd64
n-i-bz massif --pages-as-heap=yes does not report peak caused by mmap+munmap
Modified: branches/VALGRIND_3_12_BRANCH/coregrind/m_syswrap/syswrap-generic.c
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/coregrind/m_syswrap/syswrap-generic.c (original)
+++ branches/VALGRIND_3_12_BRANCH/coregrind/m_syswrap/syswrap-generic.c Wed Oct 5 06:42:01 2016
@@ -1056,15 +1056,19 @@
VG_(sprintf) ( fieldName, "(%s.msg_iov)", name );
- foreach_func ( tid, True, fieldName,
- (Addr)iov, msg->msg_iovlen * sizeof( struct vki_iovec ) );
-
- for ( i = 0; i < msg->msg_iovlen; ++i, ++iov ) {
- UInt iov_len = iov->iov_len <= length ? iov->iov_len : length;
- VG_(sprintf) ( fieldName, "(%s.msg_iov[%u])", name, i );
- foreach_func ( tid, False, fieldName,
- (Addr)iov->iov_base, iov_len );
- length = length - iov_len;
+ if (ML_(safe_to_deref)(&msg->msg_iovlen, sizeof (UInt))) {
+ foreach_func ( tid, True, fieldName, (Addr)iov,
+ msg->msg_iovlen * sizeof( struct vki_iovec ) );
+
+ for ( i = 0; i < msg->msg_iovlen && length > 0; ++i, ++iov ) {
+ if (ML_(safe_to_deref)(&iov->iov_len, sizeof (UInt))) {
+ UInt iov_len = iov->iov_len <= length ? iov->iov_len : length;
+ VG_(sprintf) ( fieldName, "(%s.msg_iov[%u])", name, i );
+ foreach_func ( tid, False, fieldName,
+ (Addr)iov->iov_base, iov_len );
+ length = length - iov_len;
+ }
+ }
}
}
@@ -1128,12 +1132,20 @@
VG_(sprintf) ( outmsg, description, "sa_family" );
PRE_MEM_READ( outmsg, (Addr) &sa->sa_family, sizeof(vki_sa_family_t));
+ /* Don't do any extra checking if we cannot determine the sa_family. */
+ if (! ML_(safe_to_deref) (&sa->sa_family, sizeof(vki_sa_family_t))) {
+ VG_(free) (outmsg);
+ return;
+ }
+
switch (sa->sa_family) {
case VKI_AF_UNIX:
- VG_(sprintf) ( outmsg, description, "sun_path" );
- PRE_MEM_RASCIIZ( outmsg, (Addr) saun->sun_path );
- // GrP fixme max of sun_len-2? what about nul char?
+ if (ML_(safe_to_deref) (&saun->sun_path, sizeof (Addr))) {
+ VG_(sprintf) ( outmsg, description, "sun_path" );
+ PRE_MEM_RASCIIZ( outmsg, (Addr) saun->sun_path );
+ // GrP fixme max of sun_len-2? what about nul char?
+ }
break;
case VKI_AF_INET:
Modified: branches/VALGRIND_3_12_BRANCH/coregrind/m_syswrap/syswrap-linux.c
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/coregrind/m_syswrap/syswrap-linux.c (original)
+++ branches/VALGRIND_3_12_BRANCH/coregrind/m_syswrap/syswrap-linux.c Wed Oct 5 06:42:01 2016
@@ -3277,7 +3277,7 @@
PRE_MEM_READ( "sigaction(act->sa_handler)", (Addr)&sa->ksa_handler, sizeof(sa->ksa_handler));
PRE_MEM_READ( "sigaction(act->sa_mask)", (Addr)&sa->sa_mask, sizeof(sa->sa_mask));
PRE_MEM_READ( "sigaction(act->sa_flags)", (Addr)&sa->sa_flags, sizeof(sa->sa_flags));
- if (ML_(safe_to_deref)(sa,sizeof(sa))
+ if (ML_(safe_to_deref)(sa,sizeof(sa))
&& (sa->sa_flags & VKI_SA_RESTORER))
PRE_MEM_READ( "sigaction(act->sa_restorer)", (Addr)&sa->sa_restorer, sizeof(sa->sa_restorer));
}
@@ -3287,26 +3287,43 @@
oldp = &old;
}
- if (ARG2 != 0) {
- struct vki_old_sigaction *oldnew = (struct vki_old_sigaction *)ARG2;
+ /* If the new or old sigaction is not NULL, but the structs
+ aren't accessible then sigaction returns EFAULT and we cannot
+ use either struct for our own bookkeeping. Just fail early. */
+ if (ARG2 != 0
+ && ! ML_(safe_to_deref)((void *)ARG2,
+ sizeof(struct vki_old_sigaction))) {
+ VG_(umsg)("Warning: bad act handler address %p in sigaction()\n",
+ (void *)ARG2);
+ SET_STATUS_Failure ( VKI_EFAULT );
+ } else if ((ARG3 != 0
+ && ! ML_(safe_to_deref)((void *)ARG3,
+ sizeof(struct vki_old_sigaction)))) {
+ VG_(umsg)("Warning: bad oldact handler address %p in sigaction()\n",
+ (void *)ARG3);
+ SET_STATUS_Failure ( VKI_EFAULT );
+ } else {
+ if (ARG2 != 0) {
+ struct vki_old_sigaction *oldnew = (struct vki_old_sigaction *)ARG2;
- new.ksa_handler = oldnew->ksa_handler;
- new.sa_flags = oldnew->sa_flags;
- new.sa_restorer = oldnew->sa_restorer;
- convert_sigset_to_rt(&oldnew->sa_mask, &new.sa_mask);
- newp = &new;
- }
+ new.ksa_handler = oldnew->ksa_handler;
+ new.sa_flags = oldnew->sa_flags;
+ new.sa_restorer = oldnew->sa_restorer;
+ convert_sigset_to_rt(&oldnew->sa_mask, &new.sa_mask);
+ newp = &new;
+ }
- SET_STATUS_from_SysRes( VG_(do_sys_sigaction)(ARG1, newp, oldp) );
+ SET_STATUS_from_SysRes( VG_(do_sys_sigaction)(ARG1, newp, oldp) );
- if (ARG3 != 0 && SUCCESS && RES == 0) {
- struct vki_old_sigaction *oldold = (struct vki_old_sigaction *)ARG3;
+ if (ARG3 != 0 && SUCCESS && RES == 0) {
+ struct vki_old_sigaction *oldold = (struct vki_old_sigaction *)ARG3;
- oldold->ksa_handler = oldp->ksa_handler;
- oldold->sa_flags = oldp->sa_flags;
- oldold->sa_restorer = oldp->sa_restorer;
- oldold->sa_mask = oldp->sa_mask.sig[0];
- }
+ oldold->ksa_handler = oldp->ksa_handler;
+ oldold->sa_flags = oldp->sa_flags;
+ oldold->sa_restorer = oldp->sa_restorer;
+ oldold->sa_mask = oldp->sa_mask.sig[0];
+ }
+ }
}
POST(sys_sigaction)
{
@@ -3373,20 +3390,39 @@
PRE_MEM_READ( "rt_sigaction(act->sa_handler)", (Addr)&sa->ksa_handler, sizeof(sa->ksa_handler));
PRE_MEM_READ( "rt_sigaction(act->sa_mask)", (Addr)&sa->sa_mask, sizeof(sa->sa_mask));
PRE_MEM_READ( "rt_sigaction(act->sa_flags)", (Addr)&sa->sa_flags, sizeof(sa->sa_flags));
- if (sa->sa_flags & VKI_SA_RESTORER)
+ if (ML_(safe_to_deref)(sa,sizeof(sa))
+ && (sa->sa_flags & VKI_SA_RESTORER))
PRE_MEM_READ( "rt_sigaction(act->sa_restorer)", (Addr)&sa->sa_restorer, sizeof(sa->sa_restorer));
}
if (ARG3 != 0)
PRE_MEM_WRITE( "rt_sigaction(oldact)", ARG3, sizeof(vki_sigaction_fromK_t));
- // XXX: doesn't seem right to be calling do_sys_sigaction for
- // sys_rt_sigaction... perhaps this function should be renamed
- // VG_(do_sys_rt_sigaction)() --njn
-
- SET_STATUS_from_SysRes(
- VG_(do_sys_sigaction)(ARG1, (const vki_sigaction_toK_t *)ARG2,
- (vki_sigaction_fromK_t *)ARG3)
- );
+ /* If the new or old sigaction is not NULL, but the structs
+ aren't accessible then sigaction returns EFAULT and we cannot
+ use either struct for our own bookkeeping. Just fail early. */
+ if (ARG2 != 0
+ && ! ML_(safe_to_deref)((void *)ARG2,
+ sizeof(vki_sigaction_toK_t))) {
+ VG_(umsg)("Warning: bad act handler address %p in rt_sigaction()\n",
+ (void *)ARG2);
+ SET_STATUS_Failure ( VKI_EFAULT );
+ } else if ((ARG3 != 0
+ && ! ML_(safe_to_deref)((void *)ARG3,
+ sizeof(vki_sigaction_fromK_t)))) {
+ VG_(umsg)("Warning: bad oldact handler address %p in rt_sigaction()\n",
+ (void *)ARG3);
+ SET_STATUS_Failure ( VKI_EFAULT );
+ } else {
+
+ // XXX: doesn't seem right to be calling do_sys_sigaction for
+ // sys_rt_sigaction... perhaps this function should be renamed
+ // VG_(do_sys_rt_sigaction)() --njn
+
+ SET_STATUS_from_SysRes(
+ VG_(do_sys_sigaction)(ARG1, (const vki_sigaction_toK_t *)ARG2,
+ (vki_sigaction_fromK_t *)ARG3)
+ );
+ }
}
POST(sys_rt_sigaction)
{
@@ -3408,8 +3444,23 @@
PRE_MEM_WRITE( "rt_sigprocmask(oldset)", ARG3, sizeof(vki_sigset_t));
// Like the kernel, we fail if the sigsetsize is not exactly what we expect.
+ // Since we want to use the set and oldset for bookkeeping we also want
+ // to make sure they are addressable otherwise, like the kernel, we EFAULT.
if (sizeof(vki_sigset_t) != ARG4)
- SET_STATUS_Failure( VKI_EMFILE );
+ SET_STATUS_Failure( VKI_EINVAL );
+ else if (ARG2 != 0
+ && ! ML_(safe_to_deref)((void *)ARG2, sizeof(vki_sigset_t))) {
+ VG_(dmsg)("Warning: Bad set handler address %p in sigprocmask\n",
+ (void *)ARG2);
+ SET_STATUS_Failure ( VKI_EFAULT );
+ }
+ else if (ARG3 != 0
+ && ! ML_(safe_to_deref)((void *)ARG3, sizeof(vki_sigset_t))) {
+ VG_(dmsg)("Warning: Bad oldset address %p in sigprocmask\n",
+ (void *)ARG3);
+ SET_STATUS_Failure ( VKI_EFAULT );
+ }
+
else {
SET_STATUS_from_SysRes(
VG_(do_sys_sigprocmask) ( tid, ARG1 /*how*/,
@@ -4953,8 +5004,8 @@
ARG2, ARG3 * sizeof(struct vki_iovec) );
PRE_MEM_READ( "process_vm_readv(rvec)",
ARG4, ARG5 * sizeof(struct vki_iovec) );
- if (ARG2 != 0) {
- /* TODO: Don't do any of the following if lvec is invalid */
+ if (ARG2 != 0
+ && ML_(safe_to_deref) ((void *)ARG2, sizeof(struct vki_iovec) * ARG3)) {
const struct vki_iovec *vec = (const struct vki_iovec *)ARG2;
UInt i;
for (i = 0; i < ARG3; i++)
@@ -4991,8 +5042,8 @@
ARG2, ARG3 * sizeof(struct vki_iovec) );
PRE_MEM_READ( "process_vm_writev(rvec)",
ARG4, ARG5 * sizeof(struct vki_iovec) );
- if (ARG2 != 0) {
- /* TODO: Don't do any of the following if lvec is invalid */
+ if (ARG2 != 0
+ && ML_(safe_to_deref) ((void *)ARG2, sizeof(struct vki_iovec) * ARG3)) {
const struct vki_iovec *vec = (const struct vki_iovec *)ARG2;
UInt i;
for (i = 0; i < ARG3; i++)
@@ -5295,10 +5346,14 @@
for (iov = (struct vki_iovec *)ARG2;
iov < (struct vki_iovec *)ARG2 + ARG3; iov++)
{
- if ((fdfl & VKI_O_ACCMODE) == VKI_O_RDONLY)
- PRE_MEM_WRITE( "vmsplice(iov[...])", (Addr)iov->iov_base, iov->iov_len );
- else
- PRE_MEM_READ( "vmsplice(iov[...])", (Addr)iov->iov_base, iov->iov_len );
+ if (ML_(safe_to_deref) (iov, sizeof(struct vki_iovec))) {
+ if ((fdfl & VKI_O_ACCMODE) == VKI_O_RDONLY)
+ PRE_MEM_WRITE( "vmsplice(iov[...])",
+ (Addr)iov->iov_base, iov->iov_len );
+ else
+ PRE_MEM_READ( "vmsplice(iov[...])",
+ (Addr)iov->iov_base, iov->iov_len );
+ }
}
}
}
@@ -5432,7 +5487,8 @@
default:
PRINT("sys_fcntl[UNKNOWN] ( %lu, %lu, %lu )", ARG1, ARG2, ARG3);
- I_die_here;
+ VG_(umsg)("Warning: unimplemented fcntl command: %lu\n", ARG2);
+ SET_STATUS_Failure( VKI_EINVAL );
break;
}
Modified: branches/VALGRIND_3_12_BRANCH/coregrind/m_syswrap/syswrap-x86-linux.c
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/coregrind/m_syswrap/syswrap-x86-linux.c (original)
+++ branches/VALGRIND_3_12_BRANCH/coregrind/m_syswrap/syswrap-x86-linux.c Wed Oct 5 06:42:01 2016
@@ -596,24 +596,31 @@
static SysRes sys_modify_ldt ( ThreadId tid,
Int func, void* ptr, UInt bytecount )
{
- SysRes ret = VG_(mk_SysRes_Error)( VKI_ENOSYS );
+ SysRes ret;
- switch (func) {
- case 0:
- ret = read_ldt(tid, ptr, bytecount);
- break;
- case 1:
- ret = write_ldt(tid, ptr, bytecount, 1);
- break;
- case 2:
- VG_(unimplemented)("sys_modify_ldt: func == 2");
- /* god knows what this is about */
- /* ret = read_default_ldt(ptr, bytecount); */
- /*UNREACHED*/
- break;
- case 0x11:
- ret = write_ldt(tid, ptr, bytecount, 0);
- break;
+ if (func != 0 && func != 1 && func != 2 && func != 0x11) {
+ ret = VG_(mk_SysRes_Error)( VKI_ENOSYS );
+ } else if (ptr != NULL && ! ML_(safe_to_deref)(ptr, bytecount)) {
+ ret = VG_(mk_SysRes_Error)( VKI_EFAULT );
+ } else {
+ switch (func) {
+ case 0:
+ ret = read_ldt(tid, ptr, bytecount);
+ break;
+ case 1:
+ ret = write_ldt(tid, ptr, bytecount, 1);
+ break;
+ case 2:
+ ret = VG_(mk_SysRes_Error)( VKI_ENOSYS );
+ VG_(unimplemented)("sys_modify_ldt: func == 2");
+ /* god knows what this is about */
+ /* ret = read_default_ldt(ptr, bytecount); */
+ /*UNREACHED*/
+ break;
+ case 0x11:
+ ret = write_ldt(tid, ptr, bytecount, 0);
+ break;
+ }
}
return ret;
}
@@ -627,7 +634,7 @@
vg_assert(8 == sizeof(VexGuestX86SegDescr));
vg_assert(sizeof(HWord) == sizeof(VexGuestX86SegDescr*));
- if (info == NULL)
+ if (info == NULL || ! ML_(safe_to_deref)(info, sizeof(vki_modify_ldt_t)))
return VG_(mk_SysRes_Error)( VKI_EFAULT );
gdt = (VexGuestX86SegDescr*)VG_(threads)[tid].arch.vex.guest_GDT;
@@ -679,7 +686,7 @@
vg_assert(sizeof(HWord) == sizeof(VexGuestX86SegDescr*));
vg_assert(8 == sizeof(VexGuestX86SegDescr));
- if (info == NULL)
+ if (info == NULL || ! ML_(safe_to_deref)(info, sizeof(vki_modify_ldt_t)))
return VG_(mk_SysRes_Error)( VKI_EFAULT );
idx = info->entry_number;
|
|
From: <sv...@va...> - 2016-10-05 05:23:59
|
Author: sewardj
Date: Wed Oct 5 06:23:52 2016
New Revision: 16014
Log:
Merge from trunk:
r15989 Don't require the current working directory to exist. Bug #369209.
Added:
branches/VALGRIND_3_12_BRANCH/none/tests/nocwd.c
- copied unchanged from r15989, trunk/none/tests/nocwd.c
branches/VALGRIND_3_12_BRANCH/none/tests/nocwd.stderr.exp
- copied unchanged from r15989, trunk/none/tests/nocwd.stderr.exp
branches/VALGRIND_3_12_BRANCH/none/tests/nocwd.stdout.exp
- copied unchanged from r15989, trunk/none/tests/nocwd.stdout.exp
branches/VALGRIND_3_12_BRANCH/none/tests/nocwd.vgtest
- copied unchanged from r15989, trunk/none/tests/nocwd.vgtest
Modified:
branches/VALGRIND_3_12_BRANCH/ (props changed)
branches/VALGRIND_3_12_BRANCH/NEWS (contents, props changed)
branches/VALGRIND_3_12_BRANCH/coregrind/m_commandline.c
branches/VALGRIND_3_12_BRANCH/coregrind/m_libcfile.c
branches/VALGRIND_3_12_BRANCH/coregrind/m_main.c
branches/VALGRIND_3_12_BRANCH/coregrind/m_options.c
branches/VALGRIND_3_12_BRANCH/coregrind/pub_core_libcfile.h
branches/VALGRIND_3_12_BRANCH/drd/drd_error.c
branches/VALGRIND_3_12_BRANCH/include/pub_tool_libcfile.h
branches/VALGRIND_3_12_BRANCH/none/tests/Makefile.am
Modified: branches/VALGRIND_3_12_BRANCH/NEWS
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/NEWS (original)
+++ branches/VALGRIND_3_12_BRANCH/NEWS Wed Oct 5 06:23:52 2016
@@ -178,6 +178,7 @@
369000 AMD64 fma4 instructions unsupported.
361253 [s390x] ex_clone.c:42: undefined reference to `pthread_create'
369169 ppc64 fails jm_int_isa_2_07 test
+369209 valgrind loops and eats up all memory if cwd doesn't exist.
n-i-bz Fix incorrect (or infinite loop) unwind on RHEL7 x86 and amd64
n-i-bz massif --pages-as-heap=yes does not report peak caused by mmap+munmap
Modified: branches/VALGRIND_3_12_BRANCH/coregrind/m_commandline.c
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/coregrind/m_commandline.c (original)
+++ branches/VALGRIND_3_12_BRANCH/coregrind/m_commandline.c Wed Oct 5 06:23:52 2016
@@ -220,9 +220,10 @@
// Don't read ./.valgrindrc if "." is the same as "$HOME", else its
// contents will be applied twice. (bug #142488)
+ // Also don't try to read it if there is no cwd.
if (home) {
const HChar *cwd = VG_(get_startup_wd)();
- f2_clo = ( VG_STREQ(home, cwd)
+ f2_clo = ( (cwd == NULL || VG_STREQ(home, cwd))
? NULL : read_dot_valgrindrc(".") );
}
Modified: branches/VALGRIND_3_12_BRANCH/coregrind/m_libcfile.c
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/coregrind/m_libcfile.c (original)
+++ branches/VALGRIND_3_12_BRANCH/coregrind/m_libcfile.c Wed Oct 5 06:23:52 2016
@@ -548,16 +548,12 @@
Hence VG_(record_startup_wd) notes it (in a platform dependent way)
and VG_(get_startup_wd) produces the noted value. */
static HChar *startup_wd;
-static Bool startup_wd_acquired = False;
/* Record the process' working directory at startup. Is intended to
be called exactly once, at startup, before the working directory
- changes. Return True for success, False for failure, so that the
- caller can bomb out suitably without creating module cycles if
- there is a problem. */
-Bool VG_(record_startup_wd) ( void )
+ changes. */
+void VG_(record_startup_wd) ( void )
{
- vg_assert(!startup_wd_acquired);
# if defined(VGO_linux) || defined(VGO_solaris)
/* Simple: just ask the kernel */
SysRes res;
@@ -567,11 +563,15 @@
startup_wd = VG_(realloc)("startup_wd", startup_wd, szB);
VG_(memset)(startup_wd, 0, szB);
res = VG_(do_syscall2)(__NR_getcwd, (UWord)startup_wd, szB-1);
- } while (sr_isError(res));
+ } while (sr_isError(res) && sr_Err(res) == VKI_ERANGE);
+
+ if (sr_isError(res)) {
+ VG_(free)(startup_wd);
+ startup_wd = NULL;
+ return;
+ }
vg_assert(startup_wd[szB-1] == 0);
- startup_wd_acquired = True;
- return True;
# elif defined(VGO_darwin)
/* We can't ask the kernel, so instead rely on launcher-*.c to
@@ -585,23 +585,19 @@
(Int)VG_(getppid)());
wd = VG_(getenv)( envvar );
if (wd == NULL)
- return False;
+ return;
SizeT need = VG_(strlen)(wd) + 1;
startup_wd = VG_(malloc)("startup_wd", need);
VG_(strcpy)(startup_wd, wd);
- startup_wd_acquired = True;
- return True;
}
# else
# error Unknown OS
# endif
}
-/* Return the previously acquired startup_wd. */
+/* Return the previously acquired startup_wd or NULL. */
const HChar *VG_(get_startup_wd) ( void )
{
- vg_assert(startup_wd_acquired);
-
return startup_wd;
}
Modified: branches/VALGRIND_3_12_BRANCH/coregrind/m_main.c
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/coregrind/m_main.c (original)
+++ branches/VALGRIND_3_12_BRANCH/coregrind/m_main.c Wed Oct 5 06:23:52 2016
@@ -1853,12 +1853,9 @@
// Record the working directory at startup
// p: none
VG_(debugLog)(1, "main", "Getting the working directory at startup\n");
- { Bool ok = VG_(record_startup_wd)();
- if (!ok)
- VG_(err_config_error)( "Can't establish current working "
- "directory at startup\n");
- }
- VG_(debugLog)(1, "main", "... %s\n", VG_(get_startup_wd)() );
+ VG_(record_startup_wd)();
+ const HChar *wd = VG_(get_startup_wd)();
+ VG_(debugLog)(1, "main", "... %s\n", wd != NULL ? wd : "<NO CWD>" );
//============================================================
// Command line argument handling order:
Modified: branches/VALGRIND_3_12_BRANCH/coregrind/m_options.c
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/coregrind/m_options.c (original)
+++ branches/VALGRIND_3_12_BRANCH/coregrind/m_options.c Wed Oct 5 06:23:52 2016
@@ -273,6 +273,10 @@
// If 'out' is not an absolute path name, prefix it with the startup dir.
if (out[0] != '/') {
+ if (base_dir == NULL) {
+ message = "Current working dir doesn't exist, use absolute path\n";
+ goto bad;
+ }
len = VG_(strlen)(base_dir) + 1 + VG_(strlen)(out) + 1;
HChar *absout = VG_(malloc)("options.efn.4", len);
Modified: branches/VALGRIND_3_12_BRANCH/coregrind/pub_core_libcfile.h
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/coregrind/pub_core_libcfile.h (original)
+++ branches/VALGRIND_3_12_BRANCH/coregrind/pub_core_libcfile.h Wed Oct 5 06:23:52 2016
@@ -102,11 +102,10 @@
/* Record the process' working directory at startup. Is intended to
be called exactly once, at startup, before the working directory
- changes. Return True for success, False for failure, so that the
- caller can bomb out suitably without creating module cycles if
- there is a problem. The saved value can later be acquired by
- calling VG_(get_startup_wd) (in pub_tool_libcfile.h). */
-extern Bool VG_(record_startup_wd) ( void );
+ changes. The saved value can later be acquired by calling
+ VG_(get_startup_wd) (in pub_tool_libcfile.h). Note that might
+ return if the working directory couldn't be found. */
+extern void VG_(record_startup_wd) ( void );
#endif // __PUB_CORE_LIBCFILE_H
Modified: branches/VALGRIND_3_12_BRANCH/drd/drd_error.c
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/drd/drd_error.c (original)
+++ branches/VALGRIND_3_12_BRANCH/drd/drd_error.c Wed Oct 5 06:23:52 2016
@@ -32,7 +32,6 @@
#include "pub_tool_basics.h"
#include "pub_tool_libcassert.h" /* tl_assert() */
#include "pub_tool_libcbase.h" /* strlen() */
-#include "pub_tool_libcfile.h" /* VG_(get_startup_wd)() */
#include "pub_tool_libcprint.h" /* VG_(printf)() */
#include "pub_tool_machine.h"
#include "pub_tool_mallocfree.h" /* VG_(malloc), VG_(free) */
Modified: branches/VALGRIND_3_12_BRANCH/include/pub_tool_libcfile.h
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/include/pub_tool_libcfile.h (original)
+++ branches/VALGRIND_3_12_BRANCH/include/pub_tool_libcfile.h Wed Oct 5 06:23:52 2016
@@ -104,7 +104,8 @@
extern const HChar* VG_(tmpdir)(void);
/* Return the working directory at startup. The returned string is
- persistent. */
+ persistent. Might be NULL if the current working directory doesn't
+ exist. */
extern const HChar *VG_(get_startup_wd) ( void );
#endif // __PUB_TOOL_LIBCFILE_H
Modified: branches/VALGRIND_3_12_BRANCH/none/tests/Makefile.am
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/none/tests/Makefile.am (original)
+++ branches/VALGRIND_3_12_BRANCH/none/tests/Makefile.am Wed Oct 5 06:23:52 2016
@@ -140,6 +140,7 @@
mq.stderr.exp mq.vgtest \
munmap_exe.stderr.exp munmap_exe.vgtest \
nestedfns.stderr.exp nestedfns.stdout.exp nestedfns.vgtest \
+ nocwd.stdout.exp nocwd.stderr.exp nocwd.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 \
@@ -219,6 +220,7 @@
manythreads \
mmap_fcntl_bug \
munmap_exe map_unaligned map_unmap mq \
+ nocwd \
pending \
procfs-cmdline-exe \
pselect_alarm \
|
Author: sewardj
Date: Wed Oct 5 06:22:11 2016
New Revision: 16013
Log:
Merge from trunk:
r15988 Use AM_LDFLAGS instead of LDFLAGS in exp-bbv/tests Makefiles.
Modified:
branches/VALGRIND_3_12_BRANCH/ (props changed)
branches/VALGRIND_3_12_BRANCH/exp-bbv/tests/amd64-linux/Makefile.am
branches/VALGRIND_3_12_BRANCH/exp-bbv/tests/arm-linux/Makefile.am
branches/VALGRIND_3_12_BRANCH/exp-bbv/tests/ppc32-linux/Makefile.am
branches/VALGRIND_3_12_BRANCH/exp-bbv/tests/x86-linux/Makefile.am
branches/VALGRIND_3_12_BRANCH/exp-bbv/tests/x86/Makefile.am
Modified: branches/VALGRIND_3_12_BRANCH/exp-bbv/tests/amd64-linux/Makefile.am
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/exp-bbv/tests/amd64-linux/Makefile.am (original)
+++ branches/VALGRIND_3_12_BRANCH/exp-bbv/tests/amd64-linux/Makefile.am Wed Oct 5 06:22:11 2016
@@ -25,7 +25,7 @@
AM_CCASFLAGS += -ffreestanding
-LDFLAGS += -nostartfiles -nodefaultlibs
+AM_LDFLAGS = -nostartfiles -nodefaultlibs
clone_test_SOURCES = clone_test.S
complex_rep_SOURCES = complex_rep.S
Modified: branches/VALGRIND_3_12_BRANCH/exp-bbv/tests/arm-linux/Makefile.am
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/exp-bbv/tests/arm-linux/Makefile.am (original)
+++ branches/VALGRIND_3_12_BRANCH/exp-bbv/tests/arm-linux/Makefile.am Wed Oct 5 06:22:11 2016
@@ -16,7 +16,7 @@
AM_CCASFLAGS += -ffreestanding -Xassembler -I$(top_srcdir)/exp-bbv/tests
-LDFLAGS += -nostartfiles -nodefaultlibs
+AM_LDFLAGS = -nostartfiles -nodefaultlibs
ll_SOURCES = ll.S
million_SOURCES = million.S
Modified: branches/VALGRIND_3_12_BRANCH/exp-bbv/tests/ppc32-linux/Makefile.am
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/exp-bbv/tests/ppc32-linux/Makefile.am (original)
+++ branches/VALGRIND_3_12_BRANCH/exp-bbv/tests/ppc32-linux/Makefile.am Wed Oct 5 06:22:11 2016
@@ -16,7 +16,7 @@
AM_CCASFLAGS += -ffreestanding -m32 -Xassembler -I$(top_srcdir)/exp-bbv/tests
-LDFLAGS += -nostartfiles -nodefaultlibs -m32
+AM_LDFLAGS = -nostartfiles -nodefaultlibs -m32
ll_SOURCES = ll.S
million_SOURCES = million.S
Modified: branches/VALGRIND_3_12_BRANCH/exp-bbv/tests/x86-linux/Makefile.am
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/exp-bbv/tests/x86-linux/Makefile.am (original)
+++ branches/VALGRIND_3_12_BRANCH/exp-bbv/tests/x86-linux/Makefile.am Wed Oct 5 06:22:11 2016
@@ -16,7 +16,7 @@
AM_CCASFLAGS += -ffreestanding -Xassembler -I$(top_srcdir)/exp-bbv/tests
-LDFLAGS += @FLAG_M32@ -static -nostartfiles -nodefaultlibs
+AM_LDFLAGS = @FLAG_M32@ -static -nostartfiles -nodefaultlibs
clone_test_SOURCES = clone_test.S
ll_SOURCES = ll.S
Modified: branches/VALGRIND_3_12_BRANCH/exp-bbv/tests/x86/Makefile.am
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/exp-bbv/tests/x86/Makefile.am (original)
+++ branches/VALGRIND_3_12_BRANCH/exp-bbv/tests/x86/Makefile.am Wed Oct 5 06:22:11 2016
@@ -18,7 +18,7 @@
AM_CCASFLAGS += -ffreestanding
-LDFLAGS += @FLAG_M32@ -static -nostartfiles -nodefaultlibs
+AM_LDFLAGS = @FLAG_M32@ -static -nostartfiles -nodefaultlibs
complex_rep_SOURCES = complex_rep.S
fldcw_check_SOURCES = fldcw_check.S
|
|
From: <sv...@va...> - 2016-10-05 05:18:37
|
Author: sewardj
Date: Wed Oct 5 06:18:29 2016
New Revision: 16012
Log:
Merge, from trunk:
r15984 Added meta mempool support into memcheck Fixes BZ#367995
r15985 Fix test so that leaked bytes is the same in 32 and 64 bits
r15986 Add an optional 2nd arg to leak-autofreepool to test performance
r15987 mc-manual.xml: Fix some mismatched open/close tags.
Added:
branches/VALGRIND_3_12_BRANCH/memcheck/tests/filter_overlaperror
- copied unchanged from r15984, trunk/memcheck/tests/filter_overlaperror
branches/VALGRIND_3_12_BRANCH/memcheck/tests/leak-autofreepool-0.stderr.exp
- copied unchanged from r15984, trunk/memcheck/tests/leak-autofreepool-0.stderr.exp
branches/VALGRIND_3_12_BRANCH/memcheck/tests/leak-autofreepool-0.vgtest
- copied unchanged from r15984, trunk/memcheck/tests/leak-autofreepool-0.vgtest
branches/VALGRIND_3_12_BRANCH/memcheck/tests/leak-autofreepool-1.stderr.exp
- copied unchanged from r15984, trunk/memcheck/tests/leak-autofreepool-1.stderr.exp
branches/VALGRIND_3_12_BRANCH/memcheck/tests/leak-autofreepool-1.vgtest
- copied unchanged from r15984, trunk/memcheck/tests/leak-autofreepool-1.vgtest
branches/VALGRIND_3_12_BRANCH/memcheck/tests/leak-autofreepool-2.stderr.exp
- copied unchanged from r15984, trunk/memcheck/tests/leak-autofreepool-2.stderr.exp
branches/VALGRIND_3_12_BRANCH/memcheck/tests/leak-autofreepool-2.vgtest
- copied unchanged from r15984, trunk/memcheck/tests/leak-autofreepool-2.vgtest
branches/VALGRIND_3_12_BRANCH/memcheck/tests/leak-autofreepool-3.stderr.exp
- copied unchanged from r15984, trunk/memcheck/tests/leak-autofreepool-3.stderr.exp
branches/VALGRIND_3_12_BRANCH/memcheck/tests/leak-autofreepool-3.vgtest
- copied unchanged from r15984, trunk/memcheck/tests/leak-autofreepool-3.vgtest
branches/VALGRIND_3_12_BRANCH/memcheck/tests/leak-autofreepool-4.stderr.exp
- copied unchanged from r15984, trunk/memcheck/tests/leak-autofreepool-4.stderr.exp
branches/VALGRIND_3_12_BRANCH/memcheck/tests/leak-autofreepool-4.vgtest
- copied unchanged from r15984, trunk/memcheck/tests/leak-autofreepool-4.vgtest
branches/VALGRIND_3_12_BRANCH/memcheck/tests/leak-autofreepool-5.stderr.exp
- copied unchanged from r15984, trunk/memcheck/tests/leak-autofreepool-5.stderr.exp
branches/VALGRIND_3_12_BRANCH/memcheck/tests/leak-autofreepool-5.vgtest
- copied unchanged from r15984, trunk/memcheck/tests/leak-autofreepool-5.vgtest
branches/VALGRIND_3_12_BRANCH/memcheck/tests/leak-autofreepool.c
- copied, changed from r15984, trunk/memcheck/tests/leak-autofreepool.c
Modified:
branches/VALGRIND_3_12_BRANCH/ (props changed)
branches/VALGRIND_3_12_BRANCH/NEWS (contents, props changed)
branches/VALGRIND_3_12_BRANCH/include/valgrind.h
branches/VALGRIND_3_12_BRANCH/memcheck/docs/mc-manual.xml
branches/VALGRIND_3_12_BRANCH/memcheck/mc_errors.c
branches/VALGRIND_3_12_BRANCH/memcheck/mc_include.h
branches/VALGRIND_3_12_BRANCH/memcheck/mc_leakcheck.c
branches/VALGRIND_3_12_BRANCH/memcheck/mc_main.c
branches/VALGRIND_3_12_BRANCH/memcheck/mc_malloc_wrappers.c
branches/VALGRIND_3_12_BRANCH/memcheck/tests/ (props changed)
branches/VALGRIND_3_12_BRANCH/memcheck/tests/Makefile.am
Modified: branches/VALGRIND_3_12_BRANCH/NEWS
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/NEWS (original)
+++ branches/VALGRIND_3_12_BRANCH/NEWS Wed Oct 5 06:18:29 2016
@@ -8,6 +8,11 @@
* Memcheck:
+ - Added meta mempool support for describing a custom allocator which:
+ - Auto-frees all chunks assuming that destroying a pool destroys all
+ objects in the pool
+ - Uses itself to allocate other memory blocks
+
* Helgrind:
* Callgrind:
@@ -164,6 +169,7 @@
366138 Fix configure errors out when using Xcode 8 (clang 8.0.0)
366344 Multiple unhandled instruction for Aarch64
(0x0EE0E020, 0x1AC15800, 0x4E284801, 0x5E040023, 0x5E056060)
+367995 Integration of memcheck with custom memory allocator
368412 False positive result for altivec capability check
368461 mmapunmap test fails on ppc64
368416 Add tc06_two_races_xml.exp output for ppc64
Modified: branches/VALGRIND_3_12_BRANCH/include/valgrind.h
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/include/valgrind.h (original)
+++ branches/VALGRIND_3_12_BRANCH/include/valgrind.h Wed Oct 5 06:18:29 2016
@@ -7009,6 +7009,22 @@
VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__CREATE_MEMPOOL, \
pool, rzB, is_zeroed, 0, 0)
+/* Create a memory pool with special flags. When the VALGRIND_MEMPOOL_AUTO_FREE
+ is passed, a MEMPOOL_DELETE will auto-free all chunks (so not reported as
+ leaks) for allocators that assume that destroying a pool destroys all
+ objects in the pool. When VALGRIND_MEMPOOL_METAPOOL is passed, the custom
+ allocator uses the pool blocks as superblocks to dole out MALLOC_LIKE blocks.
+ The resulting behaviour would normally be classified as overlapping blocks,
+ and cause assert-errors in valgrind.
+ These 2 MEMPOOL flags can be OR-ed together into the "flags" argument.
+ When flags is zero, the behaviour is identical to VALGRIND_CREATE_MEMPOOL.
+*/
+#define VALGRIND_MEMPOOL_AUTO_FREE 1
+#define VALGRIND_MEMPOOL_METAPOOL 2
+#define VALGRIND_CREATE_META_MEMPOOL(pool, rzB, is_zeroed, flags) \
+ VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__CREATE_MEMPOOL, \
+ pool, rzB, is_zeroed, flags, 0)
+
/* Destroy a memory pool. */
#define VALGRIND_DESTROY_MEMPOOL(pool) \
VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__DESTROY_MEMPOOL, \
Modified: branches/VALGRIND_3_12_BRANCH/memcheck/docs/mc-manual.xml
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/memcheck/docs/mc-manual.xml (original)
+++ branches/VALGRIND_3_12_BRANCH/memcheck/docs/mc-manual.xml Wed Oct 5 06:18:29 2016
@@ -2320,6 +2320,40 @@
</listitem>
<listitem>
+ <para>
+ <varname>VALGRIND_CREATE_META_MEMPOOL(pool, rzB, is_zeroed, flags)</varname>:
+ This does the same as <varname>VALGRIND_CREATE_MEMPOOL</varname>,
+ but allows you to specify two seldom-used options for custom
+ allocators (or-ed together) in the <varname>flags</varname> argument:</para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <varname>VALGRIND_MEMPOOL_AUTO_FREE</varname>.
+ This indicates that items allocated from this
+ memory pool are automatically freed when
+ <varname>VALGRIND_MEMPOOL_FREE</varname>
+ is used on a block. This allows a custom allocator to delete
+ (part of) a memory pool without explicitly deleting all allocated
+ items. Without this option, such an action will report all items
+ in the pool as memory leaks.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <varname>VALGRIND_MEMPOOL_METAPOOL</varname>.
+ This indicates that memory that has been
+ marked as being allocated with
+ <varname>VALGRIND_MALLOCLIKE_BLOCK</varname> is used
+ by a custom allocator to pass out memory to an application (again
+ marked with <varname>VALGRIND_MALLOCLIKE_BLOCK</varname>).
+ Without this option, such overlapping memory blocks may trigger
+ a fatal error message in memcheck.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+
+ <listitem>
<para><varname>VALGRIND_DESTROY_MEMPOOL(pool)</varname>:
This request tells Memcheck that a pool is being torn down. Memcheck
then removes all records of chunks associated with the pool, as well
Modified: branches/VALGRIND_3_12_BRANCH/memcheck/mc_errors.c
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/memcheck/mc_errors.c (original)
+++ branches/VALGRIND_3_12_BRANCH/memcheck/mc_errors.c Wed Oct 5 06:18:29 2016
@@ -925,6 +925,30 @@
VG_(maybe_record_error)( tid, Err_User, a, /*s*/NULL, &extra );
}
+Bool MC_(is_mempool_block)(MC_Chunk* mc_search)
+{
+ MC_Mempool* mp;
+
+ if (!MC_(mempool_list))
+ return False;
+
+ // A chunk can only come from a mempool if a custom allocator
+ // is used. No search required for other kinds.
+ if (mc_search->allockind == MC_AllocCustom) {
+ VG_(HT_ResetIter)( MC_(mempool_list) );
+ while ( (mp = VG_(HT_Next)(MC_(mempool_list))) ) {
+ MC_Chunk* mc;
+ VG_(HT_ResetIter)(mp->chunks);
+ while ( (mc = VG_(HT_Next)(mp->chunks)) ) {
+ if (mc == mc_search)
+ return True;
+ }
+ }
+ }
+
+ return False;
+}
+
/*------------------------------------------------------------*/
/*--- Other error operations ---*/
/*------------------------------------------------------------*/
@@ -1016,7 +1040,8 @@
// Forward declarations
static Bool client_block_maybe_describe( Addr a, AddrInfo* ai );
-static Bool mempool_block_maybe_describe( Addr a, AddrInfo* ai );
+static Bool mempool_block_maybe_describe( Addr a, Bool is_metapool,
+ AddrInfo* ai );
/* Describe an address as best you can, for error messages,
@@ -1031,10 +1056,12 @@
if (client_block_maybe_describe( a, ai )) {
return;
}
- /* -- Perhaps it's in mempool block? -- */
- if (mempool_block_maybe_describe( a, ai )) {
+
+ /* -- Perhaps it's in mempool block (non-meta)? -- */
+ if (mempool_block_maybe_describe( a, /*is_metapool*/ False, ai)) {
return;
}
+
/* Blocks allocated by memcheck malloc functions are either
on the recently freed list or on the malloc-ed list.
Custom blocks can be on both : a recently freed block might
@@ -1046,7 +1073,8 @@
/* -- Search for a currently malloc'd block which might bracket it. -- */
VG_(HT_ResetIter)(MC_(malloc_list));
while ( (mc = VG_(HT_Next)(MC_(malloc_list))) ) {
- if (addr_is_in_MC_Chunk_default_REDZONE_SZB(mc, a)) {
+ if (!MC_(is_mempool_block)(mc) &&
+ addr_is_in_MC_Chunk_default_REDZONE_SZB(mc, a)) {
ai->tag = Addr_Block;
ai->Addr.Block.block_kind = Block_Mallocd;
if (MC_(get_freed_block_bracketting)( a ))
@@ -1063,7 +1091,7 @@
}
/* -- Search for a recently freed block which might bracket it. -- */
mc = MC_(get_freed_block_bracketting)( a );
- if (mc) {
+ if (mc && !MC_(is_mempool_block)(mc)) {
ai->tag = Addr_Block;
ai->Addr.Block.block_kind = Block_Freed;
ai->Addr.Block.block_desc = "block";
@@ -1075,6 +1103,16 @@
return;
}
+ /* -- Perhaps it's in a meta mempool block? -- */
+ /* This test is done last, because metapool blocks overlap with blocks
+ handed out to the application. That makes every heap address part of
+ a metapool block, so the interesting cases are handled first.
+ This final search is a last-ditch attempt. When found, it is probably
+ an error in the custom allocator itself. */
+ if (mempool_block_maybe_describe( a, /*is_metapool*/ True, ai )) {
+ return;
+ }
+
/* No block found. Search a non-heap block description. */
VG_(describe_addr) (a, ai);
}
@@ -1215,7 +1253,7 @@
}
-static Bool mempool_block_maybe_describe( Addr a,
+static Bool mempool_block_maybe_describe( Addr a, Bool is_metapool,
/*OUT*/AddrInfo* ai )
{
MC_Mempool* mp;
@@ -1223,7 +1261,7 @@
VG_(HT_ResetIter)( MC_(mempool_list) );
while ( (mp = VG_(HT_Next)(MC_(mempool_list))) ) {
- if (mp->chunks != NULL) {
+ if (mp->chunks != NULL && mp->metapool == is_metapool) {
MC_Chunk* mc;
VG_(HT_ResetIter)(mp->chunks);
while ( (mc = VG_(HT_Next)(mp->chunks)) ) {
Modified: branches/VALGRIND_3_12_BRANCH/memcheck/mc_include.h
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/memcheck/mc_include.h (original)
+++ branches/VALGRIND_3_12_BRANCH/memcheck/mc_include.h Wed Oct 5 06:18:29 2016
@@ -93,6 +93,9 @@
Addr pool; // pool identifier
SizeT rzB; // pool red-zone size
Bool is_zeroed; // allocations from this pool are zeroed
+ Bool auto_free; // De-alloc block frees all chunks in block
+ Bool metapool; // These chunks are VALGRIND_MALLOC_LIKE
+ // memory, and used as pool.
VgHashTable *chunks; // chunks associated with this pool
}
MC_Mempool;
@@ -105,7 +108,8 @@
void MC_(handle_free) ( ThreadId tid,
Addr p, UInt rzB, MC_AllocKind kind );
-void MC_(create_mempool) ( Addr pool, UInt rzB, Bool is_zeroed );
+void MC_(create_mempool) ( Addr pool, UInt rzB, Bool is_zeroed,
+ Bool auto_free, Bool metapool );
void MC_(destroy_mempool) ( Addr pool );
void MC_(mempool_alloc) ( ThreadId tid, Addr pool,
Addr addr, SizeT size );
@@ -114,6 +118,7 @@
void MC_(move_mempool) ( Addr poolA, Addr poolB );
void MC_(mempool_change) ( Addr pool, Addr addrA, Addr addrB, SizeT size );
Bool MC_(mempool_exists) ( Addr pool );
+Bool MC_(is_mempool_block)( MC_Chunk* mc_search );
/* Searches for a recently freed block which might bracket Addr a.
Return the MC_Chunk* for this block or NULL if no bracketting block
Modified: branches/VALGRIND_3_12_BRANCH/memcheck/mc_leakcheck.c
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/memcheck/mc_leakcheck.c (original)
+++ branches/VALGRIND_3_12_BRANCH/memcheck/mc_leakcheck.c Wed Oct 5 06:18:29 2016
@@ -1760,6 +1760,25 @@
VG_(free)(seg_starts);
}
+static MC_Mempool *find_mp_of_chunk (MC_Chunk* mc_search)
+{
+ MC_Mempool* mp;
+
+ tl_assert( MC_(mempool_list) );
+
+ VG_(HT_ResetIter)( MC_(mempool_list) );
+ while ( (mp = VG_(HT_Next)(MC_(mempool_list))) ) {
+ MC_Chunk* mc;
+ VG_(HT_ResetIter)(mp->chunks);
+ while ( (mc = VG_(HT_Next)(mp->chunks)) ) {
+ if (mc == mc_search)
+ return mp;
+ }
+ }
+
+ return NULL;
+}
+
/*------------------------------------------------------------*/
/*--- Top-level entry point. ---*/
/*------------------------------------------------------------*/
@@ -1816,7 +1835,7 @@
tl_assert( lc_chunks[i]->data <= lc_chunks[i+1]->data);
}
- // Sanity check -- make sure they don't overlap. The one exception is that
+ // Sanity check -- make sure they don't overlap. One exception is that
// we allow a MALLOCLIKE block to sit entirely within a malloc() block.
// This is for bug 100628. If this occurs, we ignore the malloc() block
// for leak-checking purposes. This is a hack and probably should be done
@@ -1825,6 +1844,9 @@
// for mempool chunks, but if custom-allocated blocks are put in a separate
// table from normal heap blocks it makes free-mismatch checking more
// difficult.
+ // Another exception: Metapool memory blocks overlap by definition. The meta-
+ // block is allocated (by a custom allocator), and chunks of that block are
+ // allocated again for use by the application: Not an error.
//
// If this check fails, it probably means that the application
// has done something stupid with VALGRIND_MALLOCLIKE_BLOCK client
@@ -1867,15 +1889,48 @@
lc_n_chunks--;
} else {
- VG_(umsg)("Block 0x%lx..0x%lx overlaps with block 0x%lx..0x%lx\n",
- start1, end1, start2, end2);
- VG_(umsg)("Blocks allocation contexts:\n"),
- VG_(pp_ExeContext)( MC_(allocated_at)(ch1));
- VG_(umsg)("\n"),
- VG_(pp_ExeContext)( MC_(allocated_at)(ch2));
- VG_(umsg)("This is usually caused by using VALGRIND_MALLOCLIKE_BLOCK");
- VG_(umsg)("in an inappropriate way.\n");
- tl_assert (0);
+ // Overlap is allowed ONLY when one of the two candicates is a block
+ // from a memory pool that has the metapool attribute set.
+ // All other mixtures trigger the error + assert.
+ MC_Mempool* mp;
+ Bool ch1_is_meta = False, ch2_is_meta = False;
+ Bool Inappropriate = False;
+
+ if (MC_(is_mempool_block)(ch1)) {
+ mp = find_mp_of_chunk(ch1);
+ if (mp && mp->metapool) {
+ ch1_is_meta = True;
+ }
+ }
+
+ if (MC_(is_mempool_block)(ch2)) {
+ mp = find_mp_of_chunk(ch2);
+ if (mp && mp->metapool) {
+ ch2_is_meta = True;
+ }
+ }
+
+ // If one of the blocks is a meta block, the other must be entirely
+ // within that meta block, or something is really wrong with the custom
+ // allocator.
+ if (ch1_is_meta != ch2_is_meta) {
+ if ( (ch1_is_meta && (start2 < start1 || end2 > end1)) ||
+ (ch2_is_meta && (start1 < start2 || end1 > end2)) ) {
+ Inappropriate = True;
+ }
+ }
+
+ if (ch1_is_meta == ch2_is_meta || Inappropriate) {
+ VG_(umsg)("Block 0x%lx..0x%lx overlaps with block 0x%lx..0x%lx\n",
+ start1, end1, start2, end2);
+ VG_(umsg)("Blocks allocation contexts:\n"),
+ VG_(pp_ExeContext)( MC_(allocated_at)(ch1));
+ VG_(umsg)("\n"),
+ VG_(pp_ExeContext)( MC_(allocated_at)(ch2));
+ VG_(umsg)("This is usually caused by using ");
+ VG_(umsg)("VALGRIND_MALLOCLIKE_BLOCK in an inappropriate way.\n");
+ tl_assert (0);
+ }
}
}
Modified: branches/VALGRIND_3_12_BRANCH/memcheck/mc_main.c
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/memcheck/mc_main.c (original)
+++ branches/VALGRIND_3_12_BRANCH/memcheck/mc_main.c Wed Oct 5 06:18:29 2016
@@ -7032,8 +7032,13 @@
Addr pool = (Addr)arg[1];
UInt rzB = arg[2];
Bool is_zeroed = (Bool)arg[3];
+ UInt flags = arg[4];
- MC_(create_mempool) ( pool, rzB, is_zeroed );
+ // The create_mempool function does not know these mempool flags,
+ // pass as booleans.
+ MC_(create_mempool) ( pool, rzB, is_zeroed,
+ (flags & VALGRIND_MEMPOOL_AUTO_FREE),
+ (flags & VALGRIND_MEMPOOL_METAPOOL) );
return True;
}
Modified: branches/VALGRIND_3_12_BRANCH/memcheck/mc_malloc_wrappers.c
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/memcheck/mc_malloc_wrappers.c (original)
+++ branches/VALGRIND_3_12_BRANCH/memcheck/mc_malloc_wrappers.c Wed Oct 5 06:18:29 2016
@@ -338,7 +338,8 @@
/* Allocate memory and note change in memory available */
void* MC_(new_block) ( ThreadId tid,
Addr p, SizeT szB, SizeT alignB,
- Bool is_zeroed, MC_AllocKind kind, VgHashTable *table)
+ Bool is_zeroed, MC_AllocKind kind,
+ VgHashTable *table)
{
MC_Chunk* mc;
@@ -674,14 +675,52 @@
static void check_mempool_sane(MC_Mempool* mp); /*forward*/
+static void free_mallocs_in_mempool_block (MC_Mempool* mp,
+ Addr StartAddr,
+ Addr EndAddr)
+{
+ MC_Chunk *mc;
+ ThreadId tid;
+ Bool found;
-void MC_(create_mempool)(Addr pool, UInt rzB, Bool is_zeroed)
+ tl_assert(mp->auto_free);
+
+ if (VG_(clo_verbosity) > 2) {
+ VG_(message)(Vg_UserMsg,
+ "free_mallocs_in_mempool_block: Start 0x%lx size %lu\n",
+ StartAddr, (SizeT) (EndAddr - StartAddr));
+ }
+
+ tid = VG_(get_running_tid)();
+
+ do {
+ found = False;
+
+ VG_(HT_ResetIter)(MC_(malloc_list));
+ while (!found && (mc = VG_(HT_Next)(MC_(malloc_list))) ) {
+ if (mc->data >= StartAddr && mc->data + mc->szB < EndAddr) {
+ if (VG_(clo_verbosity) > 2) {
+ VG_(message)(Vg_UserMsg, "Auto-free of 0x%lx size=%lu\n",
+ mc->data, (mc->szB + 0UL));
+ }
+
+ mc = VG_(HT_remove) ( MC_(malloc_list), (UWord) mc->data);
+ die_and_free_mem(tid, mc, mp->rzB);
+ found = True;
+ }
+ }
+ } while (found);
+}
+
+void MC_(create_mempool)(Addr pool, UInt rzB, Bool is_zeroed,
+ Bool auto_free, Bool metapool)
{
MC_Mempool* mp;
if (VG_(clo_verbosity) > 2) {
- VG_(message)(Vg_UserMsg, "create_mempool(0x%lx, %u, %d)\n",
- pool, rzB, is_zeroed);
+ VG_(message)(Vg_UserMsg,
+ "create_mempool(0x%lx, rzB=%u, zeroed=%d, autofree=%d, metapool=%d)\n",
+ pool, rzB, is_zeroed, auto_free, metapool);
VG_(get_and_pp_StackTrace)
(VG_(get_running_tid)(), MEMPOOL_DEBUG_STACKTRACE_DEPTH);
}
@@ -695,6 +734,8 @@
mp->pool = pool;
mp->rzB = rzB;
mp->is_zeroed = is_zeroed;
+ mp->auto_free = auto_free;
+ mp->metapool = metapool;
mp->chunks = VG_(HT_construct)( "MC_(create_mempool)" );
check_mempool_sane(mp);
@@ -882,10 +923,14 @@
return;
}
+ if (mp->auto_free) {
+ free_mallocs_in_mempool_block(mp, mc->data, mc->data + (mc->szB + 0UL));
+ }
+
if (VG_(clo_verbosity) > 2) {
VG_(message)(Vg_UserMsg,
- "mempool_free(0x%lx, 0x%lx) freed chunk of %lu bytes\n",
- pool, addr, mc->szB + 0UL);
+ "mempool_free(0x%lx, 0x%lx) freed chunk of %lu bytes\n",
+ pool, addr, mc->szB + 0UL);
}
die_and_free_mem ( tid, mc, mp->rzB );
Modified: branches/VALGRIND_3_12_BRANCH/memcheck/tests/Makefile.am
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/memcheck/tests/Makefile.am (original)
+++ branches/VALGRIND_3_12_BRANCH/memcheck/tests/Makefile.am Wed Oct 5 06:18:29 2016
@@ -61,7 +61,8 @@
filter_stderr filter_xml \
filter_strchr \
filter_varinfo3 \
- filter_memcheck
+ filter_memcheck \
+ filter_overlaperror
noinst_HEADERS = leak.h
@@ -155,6 +156,12 @@
leak-pool-3.vgtest leak-pool-3.stderr.exp \
leak-pool-4.vgtest leak-pool-4.stderr.exp \
leak-pool-5.vgtest leak-pool-5.stderr.exp \
+ leak-autofreepool-0.vgtest leak-autofreepool-0.stderr.exp \
+ leak-autofreepool-1.vgtest leak-autofreepool-1.stderr.exp \
+ leak-autofreepool-2.vgtest leak-autofreepool-2.stderr.exp \
+ leak-autofreepool-3.vgtest leak-autofreepool-3.stderr.exp \
+ leak-autofreepool-4.vgtest leak-autofreepool-4.stderr.exp \
+ leak-autofreepool-5.vgtest leak-autofreepool-5.stderr.exp \
leak-tree.vgtest leak-tree.stderr.exp \
leak-segv-jmp.vgtest leak-segv-jmp.stderr.exp \
lks.vgtest lks.stdout.exp lks.supp lks.stderr.exp \
@@ -347,6 +354,7 @@
leak-cycle \
leak-delta \
leak-pool \
+ leak-autofreepool \
leak-tree \
leak-segv-jmp \
long-supps \
Copied: branches/VALGRIND_3_12_BRANCH/memcheck/tests/leak-autofreepool.c (from r15984, trunk/memcheck/tests/leak-autofreepool.c)
==============================================================================
--- trunk/memcheck/tests/leak-autofreepool.c (original)
+++ branches/VALGRIND_3_12_BRANCH/memcheck/tests/leak-autofreepool.c Wed Oct 5 06:18:29 2016
@@ -1,4 +1,4 @@
-
+#include <time.h>
#include <stdlib.h>
#include <stdint.h>
#include <assert.h>
@@ -35,7 +35,7 @@
struct cell
{
struct cell *next;
- int x;
+ char x[16 - sizeof(void*)];
};
static struct pool _PlainPool, *PlainPool = &_PlainPool;
@@ -182,7 +182,7 @@
int arg;
size_t i;
- assert(argc == 2);
+ assert(argc == 2 || argc == 3);
assert(argv[1]);
assert(strlen(argv[1]) == 1);
assert(argv[1][0] >= '0' && argv[1][0] <= '9');
@@ -222,5 +222,62 @@
// Cleanup.
VALGRIND_DESTROY_MEMPOOL(PlainPool);
+ // Perf test
+ if (argc == 3) {
+ struct pool perf_plain_pool;
+ void *perf_plain_block;
+ struct pool perf_meta_pool;
+ void *perf_meta_block;
+ size_t pool_block_size;
+ int n;
+ int nr_elts = atoi( argv[2] );
+ time_t dnow;
+#define tprintf(...) (dnow = time(NULL), \
+ printf(__VA_ARGS__), \
+ printf(" %s", ctime(&dnow)))
+
+ pool_block_size = nr_elts * sizeof(struct cell) + sizeof(uint8_t) + 1;
+
+ // Create perf meta pool
+ VALGRIND_CREATE_META_MEMPOOL
+ (&perf_meta_pool, 0, 0,
+ VALGRIND_MEMPOOL_AUTO_FREE | VALGRIND_MEMPOOL_METAPOOL);
+ perf_meta_block = malloc(pool_block_size);
+
+ VALGRIND_MEMPOOL_ALLOC(&perf_meta_pool, perf_meta_block,
+ pool_block_size);
+
+ perf_meta_pool.buf = (uint8_t *) perf_meta_block;
+ perf_meta_pool.allocated = pool_block_size;
+ perf_meta_pool.used = 0;
+
+
+ perf_meta_pool.buf += sizeof(uint8_t);
+ perf_meta_pool.used += sizeof(uint8_t);
+
+ // Create perf plain pool
+ VALGRIND_CREATE_MEMPOOL(&perf_plain_pool, 0, 0);
+ perf_plain_block = malloc(pool_block_size);
+
+ perf_plain_pool.buf = (uint8_t *) perf_plain_block;
+ perf_plain_pool.allocated = pool_block_size;;
+ perf_plain_pool.used = 0;
+
+ perf_plain_pool.buf += sizeof(uint8_t);
+ perf_plain_pool.used += sizeof(uint8_t);
+
+ tprintf("allocating %d elts", nr_elts);
+ for (n = 0; n < nr_elts; n++) {
+ (void) allocate_meta_style (&perf_meta_pool, sizeof(struct cell));
+ (void) allocate_plain_style (&perf_plain_pool, sizeof(struct cell));
+ }
+
+ tprintf("freeing mempool");
+ VALGRIND_MEMPOOL_FREE(&perf_meta_pool, perf_meta_block);
+ tprintf("destroying mempool");
+ VALGRIND_DESTROY_MEMPOOL(&perf_meta_pool);
+ tprintf("done");
+
+ }
return 0;
}
|
|
From: <sv...@va...> - 2016-10-05 05:11:30
|
Author: sewardj
Date: Wed Oct 5 06:11:23 2016
New Revision: 16011
Log:
Merge, from trunk:
r15982 Fix #361615 - Inconsistent termination for multithreaded process
terminated by signal
r15983 Fix warning introduced by revision 15982
Added:
branches/VALGRIND_3_12_BRANCH/none/tests/pth_term_signal.c
- copied unchanged from r15982, trunk/none/tests/pth_term_signal.c
branches/VALGRIND_3_12_BRANCH/none/tests/pth_term_signal.stderr.exp
- copied unchanged from r15982, trunk/none/tests/pth_term_signal.stderr.exp
branches/VALGRIND_3_12_BRANCH/none/tests/pth_term_signal.vgtest
- copied unchanged from r15982, trunk/none/tests/pth_term_signal.vgtest
Modified:
branches/VALGRIND_3_12_BRANCH/ (props changed)
branches/VALGRIND_3_12_BRANCH/NEWS (contents, props changed)
branches/VALGRIND_3_12_BRANCH/coregrind/m_main.c
branches/VALGRIND_3_12_BRANCH/coregrind/m_scheduler/scheduler.c
branches/VALGRIND_3_12_BRANCH/coregrind/m_signals.c
branches/VALGRIND_3_12_BRANCH/coregrind/pub_core_scheduler.h
branches/VALGRIND_3_12_BRANCH/none/tests/Makefile.am
Modified: branches/VALGRIND_3_12_BRANCH/NEWS
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/NEWS (original)
+++ branches/VALGRIND_3_12_BRANCH/NEWS Wed Oct 5 06:11:23 2016
@@ -138,6 +138,7 @@
361207 Valgrind does not support the IBM POWER ISA 3.0 instructions, part 2
361226 s390x: risbgn (EC59) not implemented
361354 ppc64[le]: wire up separate socketcalls system calls
+361615 Inconsistent termination for multithreaded process terminated by signal
361926 Unhandled Solaris syscall: sysfs(84)
362009 Valgrind dumps core on unimplemented functionality before threads are created
362329 Valgrind does not support the IBM POWER ISA 3.0 instructions, part 3
Modified: branches/VALGRIND_3_12_BRANCH/coregrind/m_main.c
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/coregrind/m_main.c (original)
+++ branches/VALGRIND_3_12_BRANCH/coregrind/m_main.c Wed Oct 5 06:11:23 2016
@@ -2705,7 +2705,11 @@
sys_exit, do likewise; if the (last) thread stopped due to a fatal
signal, terminate the entire system with that same fatal signal. */
VG_(debugLog)(1, "core_os",
- "VG_(terminate_NORETURN)(tid=%u)\n", tid);
+ "VG_(terminate_NORETURN)(tid=%u) schedretcode %s"
+ " os_state.exit_code %ld fatalsig %d\n",
+ tid, VG_(name_of_VgSchedReturnCode)(tids_schedretcode),
+ VG_(threads)[tid].os_state.exitcode,
+ VG_(threads)[tid].os_state.fatalsig);
switch (tids_schedretcode) {
case VgSrc_ExitThread: /* the normal way out (Linux, Solaris) */
Modified: branches/VALGRIND_3_12_BRANCH/coregrind/m_scheduler/scheduler.c
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/coregrind/m_scheduler/scheduler.c (original)
+++ branches/VALGRIND_3_12_BRANCH/coregrind/m_scheduler/scheduler.c Wed Oct 5 06:11:23 2016
@@ -1653,11 +1653,6 @@
}
-/*
- This causes all threads to forceably exit. They aren't actually
- dead by the time this returns; you need to call
- VG_(reap_threads)() to wait for them.
- */
void VG_(nuke_all_threads_except) ( ThreadId me, VgSchedReturnCode src )
{
ThreadId tid;
Modified: branches/VALGRIND_3_12_BRANCH/coregrind/m_signals.c
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/coregrind/m_signals.c (original)
+++ branches/VALGRIND_3_12_BRANCH/coregrind/m_signals.c Wed Oct 5 06:11:23 2016
@@ -1654,8 +1654,8 @@
/*
Perform the default action of a signal. If the signal is fatal, it
- marks all threads as needing to exit, but it doesn't actually kill
- the process or thread.
+ terminates all other threads, but it doesn't actually kill
+ the process and calling thread.
If we're not being quiet, then print out some more detail about
fatal signals (esp. core dumping signals).
@@ -1933,12 +1933,13 @@
VG_(setrlimit)(VKI_RLIMIT_CORE, &zero);
}
- /* stash fatal signal in main thread */
// what's this for?
//VG_(threads)[VG_(master_tid)].os_state.fatalsig = sigNo;
- /* everyone dies */
+ /* everyone but tid dies */
VG_(nuke_all_threads_except)(tid, VgSrc_FatalSig);
+ VG_(reap_threads)(tid);
+ /* stash fatal signal in this thread */
VG_(threads)[tid].exitreason = VgSrc_FatalSig;
VG_(threads)[tid].os_state.fatalsig = sigNo;
}
Modified: branches/VALGRIND_3_12_BRANCH/coregrind/pub_core_scheduler.h
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/coregrind/pub_core_scheduler.h (original)
+++ branches/VALGRIND_3_12_BRANCH/coregrind/pub_core_scheduler.h Wed Oct 5 06:11:23 2016
@@ -51,7 +51,9 @@
If it isn't blocked in a syscall, has no effect on the thread. */
extern void VG_(get_thread_out_of_syscall)(ThreadId tid);
-/* Nuke all threads except tid. */
+/* This causes all threads except tid to forceably exit. They aren't actually
+ dead by the time this returns; you need to call
+ VG_(reap_threads)() to wait for them. */
extern void VG_(nuke_all_threads_except) ( ThreadId me,
VgSchedReturnCode reason );
Modified: branches/VALGRIND_3_12_BRANCH/none/tests/Makefile.am
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/none/tests/Makefile.am (original)
+++ branches/VALGRIND_3_12_BRANCH/none/tests/Makefile.am Wed Oct 5 06:11:23 2016
@@ -167,6 +167,7 @@
pth_rwlock.stderr.exp pth_rwlock.vgtest \
pth_stackalign.stderr.exp \
pth_stackalign.stdout.exp pth_stackalign.vgtest \
+ pth_term_signal.stderr.exp pth_term_signal.vgtest \
rcrl.stderr.exp rcrl.stdout.exp rcrl.vgtest \
readline1.stderr.exp readline1.stdout.exp \
readline1.vgtest \
@@ -224,7 +225,7 @@
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 \
+ pth_stackalign pth_term_signal\
rcrl readline1 \
require-text-symbol \
res_search resolv \
@@ -315,6 +316,7 @@
pth_rwlock_CFLAGS += --std=c99
endif
pth_stackalign_LDADD = -lpthread
+pth_term_signal_LDADD = -lpthread
res_search_LDADD = -lresolv -lpthread
resolv_CFLAGS = $(AM_CFLAGS)
resolv_LDADD = -lresolv -lpthread
|
Author: sewardj
Date: Wed Oct 5 06:06:58 2016
New Revision: 16010
Log:
Merge from trunk, r15979 (Fix expected error output of drd/tests/bar_bad* on Solaris.)
Added:
branches/VALGRIND_3_12_BRANCH/drd/tests/bar_bad.stderr.exp-solaris
- copied unchanged from r15979, trunk/drd/tests/bar_bad.stderr.exp-solaris
branches/VALGRIND_3_12_BRANCH/drd/tests/bar_bad_xml.stderr.exp-solaris
- copied unchanged from r15979, trunk/drd/tests/bar_bad_xml.stderr.exp-solaris
Modified:
branches/VALGRIND_3_12_BRANCH/ (props changed)
branches/VALGRIND_3_12_BRANCH/drd/tests/Makefile.am
Modified: branches/VALGRIND_3_12_BRANCH/drd/tests/Makefile.am
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/drd/tests/Makefile.am (original)
+++ branches/VALGRIND_3_12_BRANCH/drd/tests/Makefile.am Wed Oct 5 06:06:58 2016
@@ -82,9 +82,11 @@
atomic_var.vgtest \
bar_bad.stderr.exp \
bar_bad.stderr.exp-nohang \
+ bar_bad.stderr.exp-solaris \
bar_bad.vgtest \
bar_bad_xml.stderr.exp \
bar_bad_xml.stderr.exp-nohang \
+ bar_bad_xml.stderr.exp-solaris \
bar_bad_xml.vgtest \
bar_trivial.stderr.exp \
bar_trivial.stdout.exp \
|
|
From: <sv...@va...> - 2016-10-05 05:03:59
|
Author: sewardj
Date: Wed Oct 5 06:03:51 2016
New Revision: 16009
Log:
Merge, from trunk:
r15978 Use proper compiler flags on Solaris for fma4 test.
r15980 Fix none/tests/amd64/Makefile.am typo s/AM_CFKAGS/AM_CFLAGS/
Modified:
branches/VALGRIND_3_12_BRANCH/ (props changed)
branches/VALGRIND_3_12_BRANCH/none/tests/amd64/Makefile.am
Modified: branches/VALGRIND_3_12_BRANCH/none/tests/amd64/Makefile.am
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/none/tests/amd64/Makefile.am (original)
+++ branches/VALGRIND_3_12_BRANCH/none/tests/amd64/Makefile.am Wed Oct 5 06:03:51 2016
@@ -189,7 +189,10 @@
insn_fpu_LDADD = -lm
insn_pclmulqdq_SOURCES = insn_pclmulqdq.def
fxtract_LDADD = -lm
-fma4_CFLAGS = $(AM_CFKAGS) -std=c99
+fma4_CFLAGS = $(AM_CFLAGS) -std=c99
+if VGCONF_OS_IS_SOLARIS
+fma4_CFLAGS += -D__EXTENSIONS__
+endif
fma4_LDADD = -lm
.def.c: $(srcdir)/gen_insn_test.pl
|
|
From: <sv...@va...> - 2016-10-05 04:57:34
|
Author: sewardj
Date: Wed Oct 5 05:57:27 2016
New Revision: 16008
Log:
Merge from trunk, r15977 (ppcBE, fix the expected output file for
none/tests/ppc64/jm_int_isa_2_07.stdout.exp)
Modified:
branches/VALGRIND_3_12_BRANCH/ (props changed)
branches/VALGRIND_3_12_BRANCH/NEWS (contents, props changed)
branches/VALGRIND_3_12_BRANCH/none/tests/ppc64/jm_int_isa_2_07.stdout.exp
Modified: branches/VALGRIND_3_12_BRANCH/NEWS
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/NEWS (original)
+++ branches/VALGRIND_3_12_BRANCH/NEWS Wed Oct 5 05:57:27 2016
@@ -170,6 +170,7 @@
368461 mmapunmap test fails on ppc64
369000 AMD64 fma4 instructions unsupported.
361253 [s390x] ex_clone.c:42: undefined reference to `pthread_create'
+369169 ppc64 fails jm_int_isa_2_07 test
n-i-bz Fix incorrect (or infinite loop) unwind on RHEL7 x86 and amd64
n-i-bz massif --pages-as-heap=yes does not report peak caused by mmap+munmap
Modified: branches/VALGRIND_3_12_BRANCH/none/tests/ppc64/jm_int_isa_2_07.stdout.exp
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/none/tests/ppc64/jm_int_isa_2_07.stdout.exp (original)
+++ branches/VALGRIND_3_12_BRANCH/none/tests/ppc64/jm_int_isa_2_07.stdout.exp Wed Oct 5 05:57:27 2016
@@ -1,17 +1,17 @@
-stq abcdef0123456789,1133557722446688, 0 => 1133557722446688,abcdef0123456789)
+stq abcdef0123456789,1133557722446688, 0 => abcdef0123456789,1133557722446688)
-lq (0xaaccee0011335577, 0xabcdef0123456789) => (reg_pair = 0xabcdef0123456789, 0xaaccee0011335577)
+lq (0xaaccee0011335577, 0xabcdef0123456789) => (reg_pair = 0xaaccee0011335577, 0xabcdef0123456789)
-lbarx (0xaaccee0011335577, 0xabcdef0123456789) => (reg_pair = 0x0000000000000077, 0x0000000000000000)
+lbarx (0xaaccee0011335577, 0xabcdef0123456789) => (reg_pair = 0x00000000000000aa, 0x0000000000000000)
-lharx (0xaaccee0011335577, 0xabcdef0123456789) => (reg_pair = 0x0000000000005577, 0x0000000000000000)
+lharx (0xaaccee0011335577, 0xabcdef0123456789) => (reg_pair = 0x000000000000aacc, 0x0000000000000000)
-lqarx (0xaaccee0011335577, 0xabcdef0123456789) => (reg_pair = 0xabcdef0123456789, 0xaaccee0011335577)
+lqarx (0xaaccee0011335577, 0xabcdef0123456789) => (reg_pair = 0xaaccee0011335577, 0xabcdef0123456789)
-stbcx. abefcd0145236789,1155337744226688 => 0000000000000089,0000000000000001; CR=20000000
+stbcx. abefcd0145236789,1155337744226688 => 8900000000000000,0000000000000001; CR=20000000
-sthcx. abefcd0145236789,1155337744226688 => 0000000000006789,0000000000000001; CR=20000000
+sthcx. abefcd0145236789,1155337744226688 => 6789000000000000,0000000000000001; CR=20000000
-stqcx. abefcd0145236789,1155337744226688 => 1155337744226688,abefcd0145236789; CR=20000000
+stqcx. abefcd0145236789,1155337744226688 => abefcd0145236789,1155337744226688; CR=20000000
All done. Tested 8 different instructions
|
|
From: <sv...@va...> - 2016-10-05 04:44:54
|
Author: sewardj
Date: Wed Oct 5 05:44:47 2016
New Revision: 16007
Log:
Merge from trunk, r15975 (Avoid unused variable warning.)
Modified:
branches/VALGRIND_3_12_BRANCH/ (props changed)
branches/VALGRIND_3_12_BRANCH/helgrind/tests/bar_bad.c
Modified: branches/VALGRIND_3_12_BRANCH/helgrind/tests/bar_bad.c
==============================================================================
--- branches/VALGRIND_3_12_BRANCH/helgrind/tests/bar_bad.c (original)
+++ branches/VALGRIND_3_12_BRANCH/helgrind/tests/bar_bad.c Wed Oct 5 05:44:47 2016
@@ -34,7 +34,7 @@
int main ( void )
{
pthread_barrier_t *bar1, *bar2, *bar3, *bar4, *bar5;
- int r;
+ /* int r; unused since pthread_cancel are commented out */
pthread_t thr1, thr2, slp1, slp2, ext1;
/* initialise a barrier with a zero count */
|
|
From: <sv...@va...> - 2016-10-05 04:32:54
|
Author: sewardj
Date: Wed Oct 5 05:32:44 2016
New Revision: 16006
Log:
DHAT currently has "max-bytes-live", "max-blocks-live", and
"tot-bytes-allocd" orderings. This adds "tot-blocks-allocd", which
completes the 2x2 matrix and is useful too. n-i-bz.
>From n.n...@gm....
Modified:
trunk/exp-dhat/dh_main.c
trunk/exp-dhat/docs/dh-manual.xml
Modified: trunk/exp-dhat/dh_main.c
==============================================================================
--- trunk/exp-dhat/dh_main.c (original)
+++ trunk/exp-dhat/dh_main.c Wed Oct 5 05:32:44 2016
@@ -1065,8 +1065,9 @@
" sort the allocation points by the metric\n"
" defined by <string>, thusly:\n"
" max-bytes-live maximum live bytes [default]\n"
-" tot-bytes-allocd total allocation (turnover)\n"
+" tot-bytes-allocd bytes allocated in total (turnover)\n"
" max-blocks-live maximum live blocks\n"
+" tot-blocks-allocd blocks allocated in total (turnover)\n"
);
}
@@ -1175,6 +1176,9 @@
static ULong get_metric__max_blocks_live ( APInfo* api ) {
return api->max_blocks_live;
}
+static ULong get_metric__tot_blocks ( APInfo* api ) {
+ return api->tot_blocks;
+}
/* Given a string, return the metric-access function and also a Bool
indicating whether we want increasing or decreasing values of the
@@ -1200,6 +1204,11 @@
*increasingP = False;
return True;
}
+ if (0 == VG_(strcmp)(metric_name, "tot-blocks-allocd")) {
+ *get_metricP = get_metric__tot_blocks;
+ *increasingP = False;
+ return True;
+ }
return False;
}
Modified: trunk/exp-dhat/docs/dh-manual.xml
==============================================================================
--- trunk/exp-dhat/docs/dh-manual.xml (original)
+++ trunk/exp-dhat/docs/dh-manual.xml Wed Oct 5 05:32:44 2016
@@ -372,16 +372,17 @@
allocation points according to some metric, and shows the
highest scoring entries. <varname>--sort-by</varname>
selects the metric used for sorting:</para>
- <para><varname>max-bytes-live </varname> maximum live bytes [default]</para>
- <para><varname>tot-bytes-allocd </varname> total allocation (turnover)</para>
- <para><varname>max-blocks-live </varname> maximum live blocks</para>
+ <para><varname>max-bytes-live </varname> maximum live bytes [default]</para>
+ <para><varname>tot-bytes-allocd </varname> bytes allocates in total (turnover)</para>
+ <para><varname>max-blocks-live </varname> maximum live blocks</para>
+ <para><varname>tot-blocks-allocd </varname> blocks allocated in total (turnover)</para>
<para>This controls the order in which allocation points are
displayed. You can choose to look at allocation points with
- the highest maximum liveness, or the highest total turnover, or
- by the highest number of live blocks. These give usefully
- different pictures of program behaviour. For example, sorting
- by maximum live blocks tends to show up allocation points
- creating large numbers of small objects.</para>
+ the highest number of live bytes, or the highest total byte turnover, or
+ by the highest number of live blocks, or the highest total block
+ turnover. These give usefully different pictures of program behaviour.
+ For example, sorting by maximum live blocks tends to show up allocation
+ points creating large numbers of small objects.</para>
</listitem>
</varlistentry>
|