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
|
2
(1) |
3
(25) |
4
(4) |
5
|
6
(3) |
7
|
|
8
(2) |
9
(3) |
10
|
11
|
12
|
13
(2) |
14
|
|
15
(1) |
16
(3) |
17
(1) |
18
(7) |
19
(4) |
20
(1) |
21
(2) |
|
22
(1) |
23
(3) |
24
(8) |
25
(1) |
26
(6) |
27
(2) |
28
|
|
29
(3) |
30
|
|
|
|
|
|
|
From: <sv...@va...> - 2015-11-21 00:37:42
|
Author: rhyskidd
Date: Sat Nov 21 00:37:33 2015
New Revision: 15733
Log:
Resolve build error on OS X, from r15728. n-i-bz.
Modified:
trunk/include/pub_tool_redir.h
Modified: trunk/include/pub_tool_redir.h
==============================================================================
--- trunk/include/pub_tool_redir.h (original)
+++ trunk/include/pub_tool_redir.h Sat Nov 21 00:37:33 2015
@@ -32,6 +32,7 @@
#define __PUB_TOOL_REDIR_H
#include "config.h" /* DARWIN_VERS */
+#include "pub_tool_basics.h" // Bool and HChar
/* The following macros facilitate function replacement and wrapping.
|
|
From: Michael D. <mda...@qn...> - 2015-11-19 17:07:26
|
Hello, It seems newer versions of libgcc[0] have started using assembly like this: strd ip, lr, [sp, #-16]! Since VEX only checks for #-8, this is causing lots of complaints about invalid writes below the stack pointer. Attached is a patch to remove the check all together, allowing any negative immediates without generating a lot of noise. [0] https://github.com/gcc-mirror/gcc/blob/7aea4e7cdcd40d7bd47c64e76325a62191887d1b/libgcc/config/arm/bpabi.S#L151 Thanks, Mike --------------------------------------------------------------------- This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful. |
|
From: Michael D. <mda...@qn...> - 2015-11-19 16:52:02
|
Hello, The inline assembly in do_cmpxchg8b() clobbers rbx, but it is not in the clobber list (likely just a spelling mistake, as rdx is in there twice). This was causing problems for me when running this test on our platform. Simple patch attached. Thanks, Mike --------------------------------------------------------------------- This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful. |
|
From: Michael D. <mda...@qn...> - 2015-11-19 16:52:02
|
Hello, When using GCC 5.2 I am seeing this assembly generated in some cases: add.w reg, sp, reg, lsl #4 The current limit is 3 though, so it was causing it to be caught as an unhandled instruction. Patch attached to bump the number from 3 to 4. Thanks, Mike --------------------------------------------------------------------- This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful. |
|
From: <sv...@va...> - 2015-11-19 09:34:37
|
Author: iraisr
Date: Thu Nov 19 09:34:29 2015
New Revision: 15732
Log:
Solaris syscall: Fix pset(getloadavg).
The buffer holds integers, not doubles.
n-i-bz
Modified:
trunk/coregrind/m_syswrap/syswrap-solaris.c
trunk/memcheck/tests/solaris/scalar.stderr.exp
Modified: trunk/coregrind/m_syswrap/syswrap-solaris.c
==============================================================================
--- trunk/coregrind/m_syswrap/syswrap-solaris.c (original)
+++ trunk/coregrind/m_syswrap/syswrap-solaris.c Thu Nov 19 09:34:29 2015
@@ -9246,9 +9246,9 @@
int nelem); */
PRINT("sys_pset ( %ld, %ld, %#lx, %ld )", SARG1, SARG2, ARG3, SARG4);
PRE_REG_READ4(long, SC2("pset", "getloadavg"), int, subcode,
- vki_psetid_t, pset, double, loadavg[], int, nelem);
+ vki_psetid_t, pset, int *, buf, int, nelem);
if (ARG3 != 0)
- PRE_MEM_WRITE("pset(loadavg)", ARG3, SARG4 * sizeof(double));
+ PRE_MEM_WRITE("pset(buf)", ARG3, SARG4 * sizeof(int));
break;
case VKI_PSET_LIST:
/* Libc: int pset_list(psetid_t *psetlist, uint_t *numpsets); */
@@ -9341,7 +9341,7 @@
break;
case VKI_PSET_GETLOADAVG:
if (ARG3 != 0)
- POST_MEM_WRITE(ARG3, MIN(SARG4, VKI_LOADAVG_NSTATS) * sizeof(double));
+ POST_MEM_WRITE(ARG3, MIN(SARG4, VKI_LOADAVG_NSTATS) * sizeof(int));
break;
case VKI_PSET_LIST:
if (ARG3 != 0)
Modified: trunk/memcheck/tests/solaris/scalar.stderr.exp
==============================================================================
--- trunk/memcheck/tests/solaris/scalar.stderr.exp (original)
+++ trunk/memcheck/tests/solaris/scalar.stderr.exp Thu Nov 19 09:34:29 2015
@@ -4338,13 +4338,13 @@
Syscall param pset_getloadavg(pset) contains uninitialised byte(s)
...
-Syscall param pset_getloadavg(loadavg[]) contains uninitialised byte(s)
+Syscall param pset_getloadavg(buf) contains uninitialised byte(s)
...
Syscall param pset_getloadavg(nelem) contains uninitialised byte(s)
...
-Syscall param pset(loadavg) points to unaddressable byte(s)
+Syscall param pset(buf) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
|
|
From: <sv...@va...> - 2015-11-18 23:07:34
|
Author: philippe
Date: Wed Nov 18 23:07:27 2015
New Revision: 15731
Log:
Fix a bug in the debug code of find_chunk_for.
find_chunk_for has a special case for zero size block.
The special case was missing in the find_chunk_for_OLD.
So, when enabling the leak check debug, the following assert
is raised with ./vg-in-place ./memcheck/tests/leak-0
if you comment the lines (in find_chunk_for_OLD)
if (a_lo == a_hi)
a_hi++; // Special case for szB 0. See find_chunk_for.
and define VG_DEBUG_FIND_CHUNK
Memcheck: mc_leakcheck.c:327 (find_chunk_for): Assertion 'retVal == find_chunk_for_OLD ( ptr, chunks, n_chunks )' failed.
host stacktrace:
==7868== at 0x38031535: show_sched_status_wrk (m_libcassert.c:343)
==7868== by 0x38031641: report_and_quit (m_libcassert.c:415)
==7868== by 0x38031723: vgPlain_assert_fail (m_libcassert.c:481)
==7868== by 0x38004AA6: find_chunk_for (mc_leakcheck.c:327)
==7868== by 0x38005236: lc_is_a_chunk_ptr (mc_leakcheck.c:538)
==7868== by 0x3800556D: lc_push_without_clique_if_a_chunk_ptr (mc_leakcheck.c:893)
==7868== by 0x38035234: apply_to_GPs_of_tid (m_machine.c:199)
==7868== by 0x38035234: vgPlain_apply_to_GP_regs (m_machine.c:425)
==7868== by 0x38006406: vgMemCheck_detect_memory_leaks (mc_leakcheck.c:1913)
==7868== by 0x38015872: mc_handle_client_request (mc_main.c:6628)
==7868== by 0x38047AB8: wrap_tool_handle_client_request (m_tooliface.c:280)
==7868== by 0x3807C5C4: do_client_request (scheduler.c:2101)
==7868== by 0x3807C5C4: vgPlain_scheduler (scheduler.c:1425)
==7868== by 0x38089973: thread_wrapper (syswrap-linux.c:102)
==7868== by 0x38089973: run_a_thread_NORETURN (syswrap-linux.c:155)
Modified:
trunk/memcheck/mc_leakcheck.c
Modified: trunk/memcheck/mc_leakcheck.c
==============================================================================
--- trunk/memcheck/mc_leakcheck.c (original)
+++ trunk/memcheck/mc_leakcheck.c Wed Nov 18 23:07:27 2015
@@ -237,6 +237,7 @@
// Define to debug the memory-leak-detector.
+#define VG_DEBUG_FIND_CHUNK 0
#define VG_DEBUG_LEAKCHECK 0
#define VG_DEBUG_CLIQUE 0
@@ -255,7 +256,7 @@
return 0;
}
-#if VG_DEBUG_LEAKCHECK
+#if VG_DEBUG_FIND_CHUNK
// Used to sanity-check the fast binary-search mechanism.
static
Int find_chunk_for_OLD ( Addr ptr,
@@ -270,6 +271,8 @@
PROF_EVENT(MCPE_FIND_CHUNK_FOR_OLD_LOOP);
a_lo = chunks[i]->data;
a_hi = ((Addr)chunks[i]->data) + chunks[i]->szB;
+ if (a_lo == a_hi)
+ a_hi++; // Special case for szB 0. See find_chunk_for.
if (a_lo <= ptr && ptr < a_hi)
return i;
}
@@ -320,7 +323,7 @@
break;
}
-# if VG_DEBUG_LEAKCHECK
+# if VG_DEBUG_FIND_CHUNK
tl_assert(retVal == find_chunk_for_OLD ( ptr, chunks, n_chunks ));
# endif
// VG_(printf)("%d\n", retVal);
|
|
From: <sv...@va...> - 2015-11-18 20:59:41
|
Author: philippe
Date: Wed Nov 18 20:59:34 2015
New Revision: 15730
Log:
Announce fix for (not in bugzilla) unwind problems on RHEL7 32 bits
Modified:
trunk/NEWS
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Wed Nov 18 20:59:34 2015
@@ -55,6 +55,7 @@
355455 expected stderr of test cases wrapmalloc and wrapmallocstatic overconstrained
355454 do not intercept malloc related symbols from the runtime linker
+n-i-bz Fix incorrect (or infinite loop) unwind on RHEL7 x86 32 bits
Release 3.11.0 (22 September 2015)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
From: <sv...@va...> - 2015-11-18 20:57:02
|
Author: philippe
Date: Wed Nov 18 20:56:55 2015
New Revision: 15729
Log:
Fix incorrect (or infinite loop) unwind on RHEL7 x86 32 bits.
On RHEL7 x86 32 bits, Valgrind unwinder cannot properly unwind
the stack just after a thread creation : the unwinder always retrieves
the same pc/sp/bp.
See below for an example.
This has as consequences that some stack traces are bigger than
needed (i.e. they always fill up the ips array). If
--merge-recursive-frames is given, then the unwinder enters in an
infinite loop (as identical frames will be merged, and the ips array
will never be filled in).
Thi patch adds an additional exit condition : after unwinding
a frame, if the previous sp is >= new sp, then unwinding stops.
Patch has been tested on debian 8/x86, RHEL7/x86.
0x0417db67 <+55>: mov 0x18(%esp),%ebx
0x0417db6b <+59>: mov 0x28(%esp),%edi
0x0417db6f <+63>: mov $0x78,%eax
0x0417db74 <+68>: mov %ebx,(%ecx)
0x0417db76 <+70>: int $0x80
=> 0x0417db78 <+72>: pop %edi
0x0417db79 <+73>: pop %esi
0x0417db7a <+74>: pop %ebx
0x0417db7b <+75>: test %eax,%eax
Valgrind stacktrace gives:
==21261== at 0x417DB78: clone (clone.S:110)
==21261== by 0x424702F: ???
==21261== by 0x424702F: ???
==21261== by 0x424702F: ???
==21261== by 0x424702F: ???
==21261== by 0x424702F: ???
==21261== by 0x424702F: ???
==21261== by 0x424702F: ???
...
(till the array of ips is full)
while gdb stacktrace gives:
(gdb) bt
#0 clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:110
#1 0x00000000 in ?? ()
(gdb) p $pc
$2 = (void (*)()) 0x417db78 <clone+72>
(gdb)
With the fix, valgrind gives:
==21261== at 0x417DB78: clone (clone.S:110)
==21261== by 0x424702F: ???
which looks more reasonable.
Modified:
trunk/coregrind/m_stacktrace.c
Modified: trunk/coregrind/m_stacktrace.c
==============================================================================
--- trunk/coregrind/m_stacktrace.c (original)
+++ trunk/coregrind/m_stacktrace.c Wed Nov 18 20:56:55 2015
@@ -350,6 +350,8 @@
uregs.xbp <= fp_max - 1 * sizeof(UWord)/*see comment below*/ &&
VG_IS_4_ALIGNED(uregs.xbp))
{
+ Addr old_xsp;
+
/* fp looks sane, so use it. */
uregs.xip = (((UWord*)uregs.xbp)[1]);
// We stop if we hit a zero (the traditional end-of-stack
@@ -382,6 +384,7 @@
}
}
+ old_xsp = uregs.xsp;
uregs.xsp = uregs.xbp + sizeof(Addr) /*saved %ebp*/
+ sizeof(Addr) /*ra*/;
uregs.xbp = (((UWord*)uregs.xbp)[0]);
@@ -393,6 +396,12 @@
if (debug) VG_(printf)(" cache FPUNWIND >2\n");
if (debug) unwind_case = "FO";
if (do_stats) stats.FO++;
+ if (old_xsp >= uregs.xsp) {
+ if (debug)
+ VG_(printf) (" FO end of stack old_xsp %p >= xsp %p\n",
+ (void*)old_xsp, (void*)uregs.xsp);
+ break;
+ }
} else {
fp_CF_verif_cache [hash] = xip_verified ^ CFUNWIND;
if (debug) VG_(printf)(" cache CFUNWIND >2\n");
@@ -406,6 +415,12 @@
} else {
if (debug) unwind_case = "FF";
if (do_stats) stats.FF++;
+ if (old_xsp >= uregs.xsp) {
+ if (debug)
+ VG_(printf) (" FF end of stack old_xsp %p >= xsp %p\n",
+ (void*)old_xsp, (void*)uregs.xsp);
+ break;
+ }
}
goto unwind_done;
} else {
|
|
From: <sv...@va...> - 2015-11-18 20:38:46
|
Author: iraisr
Date: Wed Nov 18 20:38:37 2015
New Revision: 15728
Log:
When searching for global public symbols (like for the somalloc
synonym symbols), exclude the dynamic (runtime) linker as it is very
special.
Fixes BZ#355454
Modified:
trunk/NEWS
trunk/coregrind/m_redir.c
trunk/docs/xml/manual-core.xml
trunk/helgrind/hg_main.c
trunk/include/pub_tool_redir.h
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Wed Nov 18 20:38:37 2015
@@ -20,7 +20,8 @@
* Replacement/wrapping of malloc/new related functions is now done not just
for system libraries by default, but for any globally defined malloc/new
related function (both in shared libraries and staticly linked alternative
- malloc implementations). To only intercept malloc/new related functions in
+ malloc implementations). Dynamic (runtime) linker is excluded, though.
+ To only intercept malloc/new related functions in
system libraries use --soname-synonyms=somalloc=nouserintercepts (where
"nouserintercepts" can be any non-existing library name).
This new functionality is not implemented for darwin/macosx.
@@ -52,6 +53,7 @@
354933 Fix documentation of --kernel-variant=android-no-hw-tls option
355188 valgrind should intercept all malloc related global functions
355455 expected stderr of test cases wrapmalloc and wrapmallocstatic overconstrained
+355454 do not intercept malloc related symbols from the runtime linker
Release 3.11.0 (22 September 2015)
Modified: trunk/coregrind/m_redir.c
==============================================================================
--- trunk/coregrind/m_redir.c (original)
+++ trunk/coregrind/m_redir.c Wed Nov 18 20:38:37 2015
@@ -809,8 +809,19 @@
anyMark = False;
for (sp = specs; sp; sp = sp->next) {
sp->done = False;
- sp->mark = VG_(string_match)( sp->from_sopatt,
- VG_(DebugInfo_get_soname)(di) );
+ const HChar *soname = VG_(DebugInfo_get_soname)(di);
+
+ /* When searching for global public symbols (like for the somalloc
+ synonym symbols), exclude the dynamic (runtime) linker as it is very
+ special. See https://bugs.kde.org/show_bug.cgi?id=355454 */
+ if ((VG_(strcmp)(sp->from_sopatt, "*") == 0) &&
+ (sp->isGlobal == True) &&
+ VG_(is_soname_ld_so)(soname)) {
+ sp->mark = False;
+ continue;
+ }
+
+ sp->mark = VG_(string_match)( sp->from_sopatt, soname );
anyMark = anyMark || sp->mark;
}
@@ -1179,6 +1190,29 @@
return r->to_addr;
}
+/* Does the soname represent a dynamic (runtime) linker?
+ Considers various VG_U_LD* entries from pub_tool_redir.h. */
+Bool VG_(is_soname_ld_so) (const HChar *soname)
+{
+# if defined(VGO_linux)
+ if (VG_STREQ(soname, VG_U_LD_LINUX_SO_3)) return True;
+ if (VG_STREQ(soname, VG_U_LD_LINUX_SO_2)) return True;
+ if (VG_STREQ(soname, VG_U_LD_LINUX_X86_64_SO_2)) return True;
+ if (VG_STREQ(soname, VG_U_LD64_SO_1)) return True;
+ if (VG_STREQ(soname, VG_U_LD64_SO_2)) return True;
+ if (VG_STREQ(soname, VG_U_LD_SO_1)) return True;
+ if (VG_STREQ(soname, VG_U_LD_LINUX_AARCH64_SO_1)) return True;
+ if (VG_STREQ(soname, VG_U_LD_LINUX_ARMHF_SO_3)) return True;
+# elif defined(VGO_darwin)
+ if (VG_STREQ(soname, VG_U_DYLD)) return True;
+# elif defined(VGO_solaris)
+ if (VG_STREQ(soname, VG_U_LD_SO_1)) return True;
+# else
+# error "Unsupported OS"
+# endif
+
+ return False;
+}
/*------------------------------------------------------------*/
/*--- INITIALISATION ---*/
Modified: trunk/docs/xml/manual-core.xml
==============================================================================
--- trunk/docs/xml/manual-core.xml (original)
+++ trunk/docs/xml/manual-core.xml Wed Nov 18 20:38:37 2015
@@ -2322,7 +2322,7 @@
own versions. Such replacements are normally done only in shared
libraries whose soname matches a predefined soname pattern (e.g.
<varname>libc.so*</varname> on linux). By default, no
- replacement is done for a statically linked library or for
+ replacement is done for a statically linked binary or for
alternative libraries, except for the allocation functions
(malloc, free, calloc, memalign, realloc, operator new, operator
delete, etc.) Such allocation functions are intercepted by
@@ -2392,6 +2392,13 @@
</para>
</listitem>
+ <listitem>
+ <para>Shared library of the dynamic (runtime) linker is excluded from
+ searching for global public symbols, such as those for the malloc
+ related functions (identified by <varname>somalloc</varname> synonym).
+ </para>
+ </listitem>
+
</itemizedlist>
</listitem>
</varlistentry>
Modified: trunk/helgrind/hg_main.c
==============================================================================
--- trunk/helgrind/hg_main.c (original)
+++ trunk/helgrind/hg_main.c Wed Nov 18 20:38:37 2015
@@ -4589,7 +4589,6 @@
{
DebugInfo* dinfo;
const HChar* soname;
- if (0) return False;
dinfo = VG_(find_DebugInfo)( ga );
if (!dinfo) return False;
@@ -4598,23 +4597,7 @@
tl_assert(soname);
if (0) VG_(printf)("%s\n", soname);
-# if defined(VGO_linux)
- if (VG_STREQ(soname, VG_U_LD_LINUX_SO_3)) return True;
- if (VG_STREQ(soname, VG_U_LD_LINUX_SO_2)) return True;
- if (VG_STREQ(soname, VG_U_LD_LINUX_X86_64_SO_2)) return True;
- if (VG_STREQ(soname, VG_U_LD64_SO_1)) return True;
- if (VG_STREQ(soname, VG_U_LD64_SO_2)) return True;
- if (VG_STREQ(soname, VG_U_LD_SO_1)) return True;
- if (VG_STREQ(soname, VG_U_LD_LINUX_AARCH64_SO_1)) return True;
- if (VG_STREQ(soname, VG_U_LD_LINUX_ARMHF_SO_3)) return True;
-# elif defined(VGO_darwin)
- if (VG_STREQ(soname, VG_U_DYLD)) return True;
-# elif defined(VGO_solaris)
- if (VG_STREQ(soname, VG_U_LD_SO_1)) return True;
-# else
-# error "Unsupported OS"
-# endif
- return False;
+ return VG_(is_soname_ld_so)(soname);
}
static
Modified: trunk/include/pub_tool_redir.h
==============================================================================
--- trunk/include/pub_tool_redir.h (original)
+++ trunk/include/pub_tool_redir.h Wed Nov 18 20:38:37 2015
@@ -351,6 +351,8 @@
#define SO_SYN_MALLOC VG_SO_SYN(somalloc)
#define SO_SYN_MALLOC_NAME "VgSoSynsomalloc"
+Bool VG_(is_soname_ld_so) (const HChar *soname);
+
#endif // __PUB_TOOL_REDIR_H
/*--------------------------------------------------------------------*/
|
|
From: Mark W. <mj...@re...> - 2015-11-18 10:00:24
|
On Wed, 2015-11-18 at 06:21 +0100, Ivo Raisr wrote: > Please find another patch under https://bugs.kde.org/show_bug.cgi?id=355454 > which targets all platforms. This looks good to me. Thanks, Mark |
|
From: Ivo R. <iv...@iv...> - 2015-11-18 05:21:15
|
2015-11-17 10:41 GMT+01:00 Mark Wielaard <mj...@re...>: > > > 355454 do not intercept malloc related symbols from the runtime linker > > https://bugs.kde.org/show_bug.cgi?id=355454 > > Yes, that looks like the right way to fix this. > I would expand the comment a bit to make sure people looking at it later > know what it really refers to. Maybe start with "When searching for > global public symbols (like for the somalloc synonym symbols), > exclude...". > Comment reworded. Also documentation amended. > Independent from this fix we might want to introduce a new redir > function Bool VG_(is_soname_ld_so) (const HChar* soname) that a tool can > use to test whether the so they are looking at is the dynamic loader. > This is a necessary refactoring for this fix. Please find another patch under https://bugs.kde.org/show_bug.cgi?id=355454 which targets all platforms. I. |
Author: iraisr
Date: Wed Nov 18 04:13:12 2015
New Revision: 15727
Log:
Expected stderr of test cases wrapmalloc and wrapmallocstatic are overconstrained.
Fixes BZ#355455.
Modified:
trunk/NEWS
trunk/memcheck/tests/ (props changed)
trunk/memcheck/tests/wrapmalloc.stderr.exp
trunk/memcheck/tests/wrapmalloc.vgtest
trunk/memcheck/tests/wrapmallocstatic.stderr.exp
trunk/memcheck/tests/wrapmallocstatic.vgtest
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Wed Nov 18 04:13:12 2015
@@ -51,6 +51,7 @@
354797 Added vbit tester support for PPC 64 isa 2.07 iops
354933 Fix documentation of --kernel-variant=android-no-hw-tls option
355188 valgrind should intercept all malloc related global functions
+355455 expected stderr of test cases wrapmalloc and wrapmallocstatic overconstrained
Release 3.11.0 (22 September 2015)
Modified: trunk/memcheck/tests/wrapmalloc.stderr.exp
==============================================================================
--- trunk/memcheck/tests/wrapmalloc.stderr.exp (original)
+++ trunk/memcheck/tests/wrapmalloc.stderr.exp Wed Nov 18 04:13:12 2015
@@ -1,10 +0,0 @@
-
-
-HEAP SUMMARY:
- in use at exit: 0 bytes in 0 blocks
- total heap usage: 1 allocs, 1 frees, 1,024 bytes allocated
-
-For a detailed leak analysis, rerun with: --leak-check=full
-
-For counts of detected and suppressed errors, rerun with: -v
-ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Modified: trunk/memcheck/tests/wrapmalloc.vgtest
==============================================================================
--- trunk/memcheck/tests/wrapmalloc.vgtest (original)
+++ trunk/memcheck/tests/wrapmalloc.vgtest Wed Nov 18 04:13:12 2015
@@ -1,2 +1,2 @@
prog: wrapmalloc
-
+vgopts: -q
Modified: trunk/memcheck/tests/wrapmallocstatic.stderr.exp
==============================================================================
--- trunk/memcheck/tests/wrapmallocstatic.stderr.exp (original)
+++ trunk/memcheck/tests/wrapmallocstatic.stderr.exp Wed Nov 18 04:13:12 2015
@@ -1,10 +0,0 @@
-
-
-HEAP SUMMARY:
- in use at exit: 0 bytes in 0 blocks
- total heap usage: 1 allocs, 1 frees, 1,024 bytes allocated
-
-For a detailed leak analysis, rerun with: --leak-check=full
-
-For counts of detected and suppressed errors, rerun with: -v
-ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Modified: trunk/memcheck/tests/wrapmallocstatic.vgtest
==============================================================================
--- trunk/memcheck/tests/wrapmallocstatic.vgtest (original)
+++ trunk/memcheck/tests/wrapmallocstatic.vgtest Wed Nov 18 04:13:12 2015
@@ -1,2 +1,2 @@
prog: wrapmallocstatic
-
+vgopts: -q
|
|
From: Mark W. <mj...@re...> - 2015-11-17 09:41:50
|
On Mon, 2015-11-16 at 21:35 +0100, Ivo Raisr wrote: > Thank you a lot for an explanation and guidance. > Please have a look at the patch attached to bug: > 355454 do not intercept malloc related symbols from the runtime linker > https://bugs.kde.org/show_bug.cgi?id=355454 Yes, that looks like the right way to fix this. I would expand the comment a bit to make sure people looking at it later know what it really refers to. Maybe start with "When searching for global public symbols (like for the somalloc synonym symbols), exclude...". > Currently it filters out only Solaris runtime linker. Linux runtime linkers > could > be filtered out as well but I am not sure which ones are relevant. There > are just > too many in pub_tool_redir.h... Yeah, it seems that is a bit of a mess :{ Every platform/arch combination seems to invent their own name for the dynamic linker. I don't believe there is an easy way to catch them all. Independent from this fix we might want to introduce a new redir function Bool VG_(is_soname_ld_so) (const HChar* soname) that a tool can use to test whether the so they are looking at is the dynamic loader. See helgrind/hg_main.c (is_in_dynamic_linker_shared_object) for another use. Thanks, Mark |
|
From: Ivo R. <iv...@iv...> - 2015-11-16 20:35:37
|
2015-11-16 13:55 GMT+01:00 Mark Wielaard <mj...@re...>: > > I need to exclude runtime linker on Solaris from this equation. More > > precisely, > > I think instead of "*" I need something like: "*" except VG_Z_LD_SO_1 > > library > > as listed in pub_tool_redir.h. I did not figure how this can > accomplished, > > yet. > > Please could you shed some light in how to do this? > > The spec matcher uses string_match, which calls generic_match, to do a > pattern match on a sequence. See include/pub_tool_seqmatch.h for a > description. It seems very flexible, but I don't believe that does > negative matching though. So you might just have to explicitly filter > out the solaris ld.so when Spec from_sopatt equals "*" and isGlobal == > True. That seems a reasonable thing to do in general, the dynamic linker > is special and we probably never want to match generic global symbols in > it, so maybe do it for any ld.so (I don't immediately see how to get the > ld.so name for the binary/platform though). You will want to tweak the > start of generate_and_add_actives in m_redir.c where it sets the > sp->mark using string_match. > Hi Mark, Thank you a lot for an explanation and guidance. Please have a look at the patch attached to bug: 355454 do not intercept malloc related symbols from the runtime linker https://bugs.kde.org/show_bug.cgi?id=355454 Currently it filters out only Solaris runtime linker. Linux runtime linkers could be filtered out as well but I am not sure which ones are relevant. There are just too many in pub_tool_redir.h... Cheers, I. |
|
From: Mark W. <mj...@re...> - 2015-11-16 12:55:40
|
Hi Ivo,
On Mon, 2015-11-16 at 13:29 +0100, Ivo Raisr wrote:
> Please could you help me with the necessary changes to unbreak the Solaris
> build.
> My understanding is that the following piece of code in m_redir.c is
> crucial:
>
> // If the user didn't set it then somalloc is special. We
> // want to match public/global symbols that match the
> // fnpatt everywhere.
> if (replaced_sopatt == NULL
> && VG_(strcmp) ( demangled_sopatt, SO_SYN_MALLOC_NAME ) == 0)
> {
> replaced_sopatt = VG_(strdup)("m_redir.rnnD.1", "*");
> demangled_sopatt = replaced_sopatt;
> isGlobal = True;
> }
>
> So I read it that if the user did not set any --soname-synonyms then the
> current functionality
> instructs the redirection module to intercept all public somalloc functions
> in all libraries/binaries.
Yes, indeed.
> I need to exclude runtime linker on Solaris from this equation. More
> precisely,
> I think instead of "*" I need something like: "*" except VG_Z_LD_SO_1
> library
> as listed in pub_tool_redir.h. I did not figure how this can accomplished,
> yet.
> Please could you shed some light in how to do this?
The spec matcher uses string_match, which calls generic_match, to do a
pattern match on a sequence. See include/pub_tool_seqmatch.h for a
description. It seems very flexible, but I don't believe that does
negative matching though. So you might just have to explicitly filter
out the solaris ld.so when Spec from_sopatt equals "*" and isGlobal ==
True. That seems a reasonable thing to do in general, the dynamic linker
is special and we probably never want to match generic global symbols in
it, so maybe do it for any ld.so (I don't immediately see how to get the
ld.so name for the binary/platform though). You will want to tweak the
start of generate_and_add_actives in m_redir.c where it sets the
sp->mark using string_match.
> The reason why to
> exclude
> Solaris runtime linker is because the library has public functions called
> malloc/free/... but with different semantics and different behaviour than
> the standard ones from libc and friends.
If it does then it really shouldn't make those public global symbols.
Maybe you can tweak ld.so to make those functions static/private? That
of course doesn't help with older systems, but might help in the future
not having to special case the Solaris ld.so.
Cheers,
Mark
|
|
From: Ivo R. <iv...@iv...> - 2015-11-16 12:31:04
|
Hi Mark,
Please could you help me with the necessary changes to unbreak the Solaris
build.
My understanding is that the following piece of code in m_redir.c is
crucial:
// If the user didn't set it then somalloc is special. We
// want to match public/global symbols that match the
// fnpatt everywhere.
if (replaced_sopatt == NULL
&& VG_(strcmp) ( demangled_sopatt, SO_SYN_MALLOC_NAME ) == 0)
{
replaced_sopatt = VG_(strdup)("m_redir.rnnD.1", "*");
demangled_sopatt = replaced_sopatt;
isGlobal = True;
}
So I read it that if the user did not set any --soname-synonyms then the
current functionality
instructs the redirection module to intercept all public somalloc functions
in all libraries/binaries.
I need to exclude runtime linker on Solaris from this equation. More
precisely,
I think instead of "*" I need something like: "*" except VG_Z_LD_SO_1
library
as listed in pub_tool_redir.h. I did not figure how this can accomplished,
yet.
Please could you shed some light in how to do this? The reason why to
exclude
Solaris runtime linker is because the library has public functions called
malloc/free/... but with different semantics and different behaviour than
the standard ones from libc and friends.
Kind regards,
I.
2015-11-15 17:50 GMT+01:00 <sv...@va...>:
> Author: mjw
> Date: Sun Nov 15 16:50:43 2015
> New Revision: 15726
>
> Log:
> BZ#355188 valgrind should intercept all malloc related global functions.
>
> This implements the interception of all globally public allocation
> functions by default. It works by adding a flag to the spec to say the
> interception only applies to global functions. Which is set for the
> somalloc spec. The librarypath to match is set to "*" unless the user
> overrides it. Then each DiSym keeps track of whether the symbol is local
> or global. For a spec which has isGlobal set only isGlobal symbols will
> match.
>
> Note that because of padding to keep the addresses in DiSym aligned the
> addition of the extra bool isGlobal doesn't actually grow the struct.
> The comments explain how the struct could be made more compact on 32bit
> systems, but this isn't as easy on 64bit systems. So I didn't try to do
> that in this patch.
>
> For ELF symbols keeping track of which are global is trivial. For pdb I
> had to guess and made only the "Public" symbols global. I don't know
> how/if macho keeps track of global symbols or not. For now I just mark
> all of them local (which just means things work as previously on platforms
> that use machos, no non-system symbols are matches by default for somalloc
> unless the user explicitly tells which library name to match).
>
> Included are two testcases for shared libraries (wrapmalloc) and staticly
> linked (wrapmallocstatic) malloc/free overrides that depend on the new
> default. One existing testcase (new_override) was adjusted to explicitly
> not use the new somalloc default because it depends on a user defined
> new implementation that has side-effects and should explicitly not be
> intercepted.
>
> Added:
> trunk/memcheck/tests/wrapmalloc.c
> trunk/memcheck/tests/wrapmalloc.stderr.exp
> trunk/memcheck/tests/wrapmalloc.stdout.exp
> trunk/memcheck/tests/wrapmalloc.vgtest
> trunk/memcheck/tests/wrapmallocso.c
> trunk/memcheck/tests/wrapmallocstatic.c
> trunk/memcheck/tests/wrapmallocstatic.stderr.exp
> trunk/memcheck/tests/wrapmallocstatic.stdout.exp
> trunk/memcheck/tests/wrapmallocstatic.vgtest
> Modified:
> trunk/NEWS
> trunk/coregrind/m_debuginfo/debuginfo.c
> trunk/coregrind/m_debuginfo/priv_storage.h
> trunk/coregrind/m_debuginfo/readelf.c
> trunk/coregrind/m_debuginfo/readmacho.c
> trunk/coregrind/m_debuginfo/readpdb.c
> trunk/coregrind/m_debuginfo/storage.c
> trunk/coregrind/m_redir.c
> trunk/coregrind/m_replacemalloc/vg_replace_malloc.c
> trunk/coregrind/pub_core_debuginfo.h
> trunk/docs/xml/manual-core.xml
> trunk/include/pub_tool_redir.h
> trunk/memcheck/tests/Makefile.am
> trunk/memcheck/tests/new_override.vgtest
>
> Modified: trunk/NEWS
>
> ==============================================================================
> --- trunk/NEWS (original)
> +++ trunk/NEWS Sun Nov 15 16:50:43 2015
> @@ -17,6 +17,14 @@
>
> * ==================== OTHER CHANGES ====================
>
> +* Replacement/wrapping of malloc/new related functions is now done not
> just
> + for system libraries by default, but for any globally defined malloc/new
> + related function (both in shared libraries and staticly linked
> alternative
> + malloc implementations). To only intercept malloc/new related functions
> in
> + system libraries use --soname-synonyms=somalloc=nouserintercepts (where
> + "nouserintercepts" can be any non-existing library name).
> + This new functionality is not implemented for darwin/macosx.
> +
> * ==================== FIXED BUGS ====================
>
> The following bugs have been fixed or resolved. Note that "n-i-bz"
> @@ -42,6 +50,7 @@
> 354392 unhandled amd64-solaris syscall: 171
> 354797 Added vbit tester support for PPC 64 isa 2.07 iops
> 354933 Fix documentation of --kernel-variant=android-no-hw-tls option
> +355188 valgrind should intercept all malloc related global functions
>
|
|
From: <sv...@va...> - 2015-11-15 16:50:54
|
Author: mjw
Date: Sun Nov 15 16:50:43 2015
New Revision: 15726
Log:
BZ#355188 valgrind should intercept all malloc related global functions.
This implements the interception of all globally public allocation
functions by default. It works by adding a flag to the spec to say the
interception only applies to global functions. Which is set for the
somalloc spec. The librarypath to match is set to "*" unless the user
overrides it. Then each DiSym keeps track of whether the symbol is local
or global. For a spec which has isGlobal set only isGlobal symbols will
match.
Note that because of padding to keep the addresses in DiSym aligned the
addition of the extra bool isGlobal doesn't actually grow the struct.
The comments explain how the struct could be made more compact on 32bit
systems, but this isn't as easy on 64bit systems. So I didn't try to do
that in this patch.
For ELF symbols keeping track of which are global is trivial. For pdb I
had to guess and made only the "Public" symbols global. I don't know
how/if macho keeps track of global symbols or not. For now I just mark
all of them local (which just means things work as previously on platforms
that use machos, no non-system symbols are matches by default for somalloc
unless the user explicitly tells which library name to match).
Included are two testcases for shared libraries (wrapmalloc) and staticly
linked (wrapmallocstatic) malloc/free overrides that depend on the new
default. One existing testcase (new_override) was adjusted to explicitly
not use the new somalloc default because it depends on a user defined
new implementation that has side-effects and should explicitly not be
intercepted.
Added:
trunk/memcheck/tests/wrapmalloc.c
trunk/memcheck/tests/wrapmalloc.stderr.exp
trunk/memcheck/tests/wrapmalloc.stdout.exp
trunk/memcheck/tests/wrapmalloc.vgtest
trunk/memcheck/tests/wrapmallocso.c
trunk/memcheck/tests/wrapmallocstatic.c
trunk/memcheck/tests/wrapmallocstatic.stderr.exp
trunk/memcheck/tests/wrapmallocstatic.stdout.exp
trunk/memcheck/tests/wrapmallocstatic.vgtest
Modified:
trunk/NEWS
trunk/coregrind/m_debuginfo/debuginfo.c
trunk/coregrind/m_debuginfo/priv_storage.h
trunk/coregrind/m_debuginfo/readelf.c
trunk/coregrind/m_debuginfo/readmacho.c
trunk/coregrind/m_debuginfo/readpdb.c
trunk/coregrind/m_debuginfo/storage.c
trunk/coregrind/m_redir.c
trunk/coregrind/m_replacemalloc/vg_replace_malloc.c
trunk/coregrind/pub_core_debuginfo.h
trunk/docs/xml/manual-core.xml
trunk/include/pub_tool_redir.h
trunk/memcheck/tests/Makefile.am
trunk/memcheck/tests/new_override.vgtest
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Sun Nov 15 16:50:43 2015
@@ -17,6 +17,14 @@
* ==================== OTHER CHANGES ====================
+* Replacement/wrapping of malloc/new related functions is now done not just
+ for system libraries by default, but for any globally defined malloc/new
+ related function (both in shared libraries and staticly linked alternative
+ malloc implementations). To only intercept malloc/new related functions in
+ system libraries use --soname-synonyms=somalloc=nouserintercepts (where
+ "nouserintercepts" can be any non-existing library name).
+ This new functionality is not implemented for darwin/macosx.
+
* ==================== FIXED BUGS ====================
The following bugs have been fixed or resolved. Note that "n-i-bz"
@@ -42,6 +50,7 @@
354392 unhandled amd64-solaris syscall: 171
354797 Added vbit tester support for PPC 64 isa 2.07 iops
354933 Fix documentation of --kernel-variant=android-no-hw-tls option
+355188 valgrind should intercept all malloc related global functions
Release 3.11.0 (22 September 2015)
Modified: trunk/coregrind/m_debuginfo/debuginfo.c
==============================================================================
--- trunk/coregrind/m_debuginfo/debuginfo.c (original)
+++ trunk/coregrind/m_debuginfo/debuginfo.c Sun Nov 15 16:50:43 2015
@@ -4306,7 +4306,8 @@
/*OUT*/const HChar** pri_name,
/*OUT*/const HChar*** sec_names,
/*OUT*/Bool* isText,
- /*OUT*/Bool* isIFunc )
+ /*OUT*/Bool* isIFunc,
+ /*OUT*/Bool* isGlobal )
{
vg_assert(idx >= 0 && idx < si->symtab_used);
if (avmas) *avmas = si->symtab[idx].avmas;
@@ -4315,6 +4316,7 @@
if (sec_names) *sec_names = si->symtab[idx].sec_names;
if (isText) *isText = si->symtab[idx].isText;
if (isIFunc) *isIFunc = si->symtab[idx].isIFunc;
+ if (isGlobal) *isGlobal = si->symtab[idx].isGlobal;
}
Modified: trunk/coregrind/m_debuginfo/priv_storage.h
==============================================================================
--- trunk/coregrind/m_debuginfo/priv_storage.h (original)
+++ trunk/coregrind/m_debuginfo/priv_storage.h Sun Nov 15 16:50:43 2015
@@ -75,14 +75,18 @@
the macros defined in pub_core_debuginfo.h */
const HChar* pri_name; /* primary name, never NULL */
const HChar** sec_names; /* NULL, or a NULL term'd array of other names */
- // XXX: this could be shrunk (on 32-bit platforms) by using 30
- // bits for the size and 1 bit each for isText and isIFunc. If you
- // do this, make sure that all assignments to the latter two use
- // 0 or 1 (or True or False), and that a positive number larger
- // than 1 is never used to represent True.
+ // XXX: DiSym could be shrunk (on 32-bit platforms to exactly 16
+ // bytes, on 64-bit platforms the first 3 pointers already add
+ // up to 24 bytes, so size plus bits will extend to 32 bytes
+ // anyway) by using 29 bits for the size and 1 bit each for
+ // isText, isIFunc and isGlobal. If you do this, make sure that
+ // all assignments to the latter two use 0 or 1 (or True or
+ // False), and that a positive number larger than 1 is never
+ // used to represent True.
UInt size; /* size in bytes */
Bool isText;
Bool isIFunc; /* symbol is an indirect function? */
+ Bool isGlobal; /* Is this symbol globally visible? */
}
DiSym;
Modified: trunk/coregrind/m_debuginfo/readelf.c
==============================================================================
--- trunk/coregrind/m_debuginfo/readelf.c (original)
+++ trunk/coregrind/m_debuginfo/readelf.c Sun Nov 15 16:50:43 2015
@@ -241,7 +241,8 @@
Bool* from_opd_out, /* ppc64be-linux only: did we deref an
.opd entry? */
Bool* is_text_out, /* is this a text symbol? */
- Bool* is_ifunc /* is this a STT_GNU_IFUNC function ?*/
+ Bool* is_ifunc_out, /* is this a STT_GNU_IFUNC function ?*/
+ Bool* is_global_out /* is this a global symbol ?*/
)
{
Bool plausible;
@@ -259,7 +260,8 @@
SET_TOCPTR_AVMA(*sym_avmas_out, 0); /* default to unknown/inapplicable */
SET_LOCAL_EP_AVMA(*sym_avmas_out, 0); /* default to unknown/inapplicable */
*from_opd_out = False;
- *is_ifunc = False;
+ *is_ifunc_out = False;
+ *is_global_out = False;
/* Get the symbol size, but restrict it to fit in a signed 32 bit
int. Also, deal with the stupid case of negative size by making
@@ -373,10 +375,14 @@
/* Check for indirect functions. */
if (*is_text_out
&& ELFXX_ST_TYPE(sym->st_info) == STT_GNU_IFUNC) {
- *is_ifunc = True;
+ *is_ifunc_out = True;
}
# endif
+ if (ELFXX_ST_BIND(sym->st_info) == STB_GLOBAL) {
+ *is_global_out = True;
+ }
+
# if defined(VGP_ppc64be_linux)
/* Allow STT_NOTYPE in the very special case where we're running on
ppc64be-linux and the symbol is one which the .opd-chasing hack
@@ -777,6 +783,7 @@
SymAVMAs sym_avmas_really;
Int sym_size = 0;
Bool from_opd = False, is_text = False, is_ifunc = False;
+ Bool is_global = False;
DiOffT sym_name_really = DiOffT_INVALID;
sym_avmas_really.main = 0;
SET_TOCPTR_AVMA(sym_avmas_really, 0);
@@ -787,7 +794,7 @@
&sym_name_really,
&sym_avmas_really,
&sym_size,
- &from_opd, &is_text, &is_ifunc)) {
+ &from_opd, &is_text, &is_ifunc, &is_global)) {
DiSym disym;
VG_(memset)(&disym, 0, sizeof(disym));
@@ -799,6 +806,7 @@
disym.size = sym_size;
disym.isText = is_text;
disym.isIFunc = is_ifunc;
+ disym.isGlobal = is_global;
if (cstr) { ML_(dinfo_free)(cstr); cstr = NULL; }
vg_assert(disym.pri_name);
vg_assert(GET_TOCPTR_AVMA(disym.avmas) == 0);
@@ -847,6 +855,7 @@
Bool from_opd;
Bool is_text;
Bool is_ifunc;
+ Bool is_global;
}
TempSym;
@@ -911,6 +920,7 @@
SymAVMAs sym_avmas_really;
Int sym_size = 0;
Bool from_opd = False, is_text = False, is_ifunc = False;
+ Bool is_global = False;
DiOffT sym_name_really = DiOffT_INVALID;
DiSym disym;
VG_(memset)(&disym, 0, sizeof(disym));
@@ -923,7 +933,7 @@
&sym_name_really,
&sym_avmas_really,
&sym_size,
- &from_opd, &is_text, &is_ifunc)) {
+ &from_opd, &is_text, &is_ifunc, &is_global)) {
/* Check if we've seen this (name,addr) key before. */
key.addr = sym_avmas_really.main;
@@ -996,6 +1006,7 @@
elem->from_opd = from_opd;
elem->is_text = is_text;
elem->is_ifunc = is_ifunc;
+ elem->is_global = is_global;
VG_(OSetGen_Insert)(oset, elem);
if (di->trace_symtab) {
HChar* str = ML_(img_strdup)(escn_strtab->img, "di.respl.2",
@@ -1034,14 +1045,17 @@
disym.size = elem->size;
disym.isText = elem->is_text;
disym.isIFunc = elem->is_ifunc;
+ disym.isGlobal = elem->is_global;
if (cstr) { ML_(dinfo_free)(cstr); cstr = NULL; }
vg_assert(disym.pri_name != NULL);
ML_(addSym) ( di, &disym );
if (di->trace_symtab) {
- VG_(printf)(" rec(%c) [%4ld]: "
+ VG_(printf)(" rec(%c%c%c) [%4ld]: "
" val %#010lx, toc %#010lx, sz %4d %s\n",
disym.isText ? 't' : 'd',
+ disym.isIFunc ? 'i' : '-',
+ disym.isGlobal ? 'g' : 'l',
i,
disym.avmas.main,
GET_TOCPTR_AVMA(disym.avmas),
Modified: trunk/coregrind/m_debuginfo/readmacho.c
==============================================================================
--- trunk/coregrind/m_debuginfo/readmacho.c (original)
+++ trunk/coregrind/m_debuginfo/readmacho.c Sun Nov 15 16:50:43 2015
@@ -365,6 +365,7 @@
di->text_avma+di->text_size - sym_addr;
disym.isText = True;
disym.isIFunc = False;
+ disym.isGlobal = False;
// Lots of user function names get prepended with an underscore. Eg. the
// function 'f' becomes the symbol '_f'. And the "below main"
// function is called "start". So we skip the leading underscore, and
Modified: trunk/coregrind/m_debuginfo/readpdb.c
==============================================================================
--- trunk/coregrind/m_debuginfo/readpdb.c (original)
+++ trunk/coregrind/m_debuginfo/readpdb.c Sun Nov 15 16:50:43 2015
@@ -1272,6 +1272,7 @@
// FIXME: .namelen is sizeof(.data) including .name[]
vsym.isText = (sym->generic.id == S_PUB_V1);
vsym.isIFunc = False;
+ vsym.isGlobal = True;
ML_(addSym)( di, &vsym );
n_syms_read++;
}
@@ -1299,6 +1300,7 @@
vsym.isText = !!(IMAGE_SCN_CNT_CODE
& sectp[sym->data_v2.segment-1].Characteristics);
vsym.isIFunc = False;
+ vsym.isGlobal = True;
ML_(addSym)( di, &vsym );
n_syms_read++;
}
@@ -1332,6 +1334,7 @@
vsym.isText = !!(IMAGE_SCN_CNT_CODE
& sectp[sym->data_v2.segment-1].Characteristics);
vsym.isIFunc = False;
+ vsym.isGlobal = True;
ML_(addSym)( di, &vsym );
n_syms_read++;
}
@@ -1365,6 +1368,7 @@
vsym.size = sym->proc_v1.proc_len;
vsym.isText = True;
vsym.isIFunc = False;
+ vsym.isGlobal = sym->generic.id == S_GPROC_V1;
if (debug)
VG_(umsg)(" Adding function %s addr=%#lx length=%u\n",
symname, vsym.avmas.main, vsym.size );
@@ -1386,6 +1390,7 @@
vsym.size = sym->proc_v2.proc_len;
vsym.isText = True;
vsym.isIFunc = False;
+ vsym.isGlobal = sym->generic.id == S_GPROC_V2;
if (debug)
VG_(umsg)(" Adding function %s addr=%#lx length=%u\n",
symname, vsym.avmas.main, vsym.size );
@@ -1408,6 +1413,7 @@
vsym.size = sym->proc_v3.proc_len;
vsym.isText = 1;
vsym.isIFunc = False;
+ vsym.isGlobal = sym->generic.id == S_GPROC_V3;
ML_(addSym)( di, &vsym );
n_syms_read++;
}
Modified: trunk/coregrind/m_debuginfo/storage.c
==============================================================================
--- trunk/coregrind/m_debuginfo/storage.c (original)
+++ trunk/coregrind/m_debuginfo/storage.c Sun Nov 15 16:50:43 2015
@@ -98,10 +98,11 @@
vg_assert(sym->pri_name);
if (sec_names)
vg_assert(sec_names);
- VG_(printf)( "%5d: %c%c %#8lx .. %#8lx (%u) %s%s",
+ VG_(printf)( "%5d: %c%c%c %#8lx .. %#8lx (%u) %s%s",
idx,
sym->isText ? 'T' : '-',
sym->isIFunc ? 'I' : '-',
+ sym->isGlobal ? 'G' : '-',
sym->avmas.main,
sym->avmas.main + sym->size - 1, sym->size,
sym->pri_name, sec_names ? " " : "" );
@@ -1646,7 +1647,7 @@
Word i, j, n_truncated;
Addr sta1, sta2, end1, end2, toc1, toc2;
const HChar *pri1, *pri2, **sec1, **sec2;
- Bool ist1, ist2, isf1, isf2;
+ Bool ist1, ist2, isf1, isf2, isg1, isg2;
# define SWAP(ty,aa,bb) \
do { ty tt = (aa); (aa) = (bb); (bb) = tt; } while (0)
@@ -1693,6 +1694,8 @@
}
/* mark w as an IFunc if either w or r are */
di->symtab[w].isIFunc = di->symtab[w].isIFunc || di->symtab[r].isIFunc;
+ /* likewise for global symbols */
+ di->symtab[w].isGlobal = di->symtab[w].isGlobal || di->symtab[r].isGlobal;
/* and use ::pri_names to indicate this slot is no longer in use */
di->symtab[r].pri_name = NULL;
if (di->symtab[r].sec_names) {
@@ -1796,6 +1799,7 @@
sec1 = di->symtab[i].sec_names;
ist1 = di->symtab[i].isText;
isf1 = di->symtab[i].isIFunc;
+ isg1 = di->symtab[i].isGlobal;
sta2 = di->symtab[i+1].avmas.main;
end2 = sta2 + di->symtab[i+1].size - 1;
@@ -1805,6 +1809,7 @@
sec2 = di->symtab[i+1].sec_names;
ist2 = di->symtab[i+1].isText;
isf2 = di->symtab[i+1].isIFunc;
+ isg2 = di->symtab[i+1].isGlobal;
if (sta1 < sta2) {
end1 = sta2 - 1;
@@ -1814,7 +1819,7 @@
sta1 = end2 + 1;
SWAP(Addr,sta1,sta2); SWAP(Addr,end1,end2); SWAP(Addr,toc1,toc2);
SWAP(const HChar*,pri1,pri2); SWAP(const HChar**,sec1,sec2);
- SWAP(Bool,ist1,ist2); SWAP(Bool,isf1,isf2);
+ SWAP(Bool,ist1,ist2); SWAP(Bool,isf1,isf2); SWAP(Bool, isg1, isg2);
} else
if (end1 < end2) {
sta2 = end1 + 1;
@@ -1831,6 +1836,7 @@
di->symtab[i].sec_names = sec1;
di->symtab[i].isText = ist1;
di->symtab[i].isIFunc = isf1;
+ di->symtab[i].isGlobal = isg1;
di->symtab[i+1].avmas.main = sta2;
di->symtab[i+1].size = end2 - sta2 + 1;
@@ -1840,6 +1846,7 @@
di->symtab[i+1].sec_names = sec2;
di->symtab[i+1].isText = ist2;
di->symtab[i+1].isIFunc = isf2;
+ di->symtab[i+1].isGlobal = isg2;
vg_assert(sta1 <= sta2);
vg_assert(di->symtab[i].size > 0);
Modified: trunk/coregrind/m_redir.c
==============================================================================
--- trunk/coregrind/m_redir.c (original)
+++ trunk/coregrind/m_redir.c Sun Nov 15 16:50:43 2015
@@ -233,6 +233,7 @@
HChar* from_fnpatt; /* from fnname pattern */
Addr to_addr; /* where redirecting to */
Bool isWrap; /* wrap or replacement? */
+ Bool isGlobal; /* must the symbol to replace be global? */
Int becTag; /* 0 through 9999. Behavioural equivalance class tag.
If two wrappers have the same (non-zero) tag, they
are promising that they behave identically. */
@@ -388,7 +389,7 @@
void VG_(redir_notify_new_DebugInfo)( const DebugInfo* newdi )
{
- Bool ok, isWrap;
+ Bool ok, isWrap, isGlobal;
Int i, nsyms, becTag, becPrio;
Spec* specList;
Spec* spec;
@@ -518,13 +519,14 @@
for (i = 0; i < nsyms; i++) {
VG_(DebugInfo_syms_getidx)( newdi, i, &sym_avmas,
NULL, &sym_name_pri, &sym_names_sec,
- &isText, NULL );
+ &isText, NULL, NULL );
/* Set up to conveniently iterate over all names for this symbol. */
const HChar* twoslots[2];
const HChar** names_init =
alloc_symname_array(sym_name_pri, sym_names_sec, &twoslots[0]);
const HChar** names;
for (names = names_init; *names; names++) {
+ isGlobal = False;
ok = VG_(maybe_Z_demangle)( *names,
&demangled_sopatt,
&demangled_fnpatt,
@@ -579,15 +581,12 @@
have a matching lib synonym, then replace the sopatt.
Otherwise, just ignore this redirection spec. */
- if (!VG_(clo_soname_synonyms))
- continue; // No synonyms => skip the redir.
-
/* Search for a matching synonym=newname*/
SizeT const sopatt_syn_len
= VG_(strlen)(demangled_sopatt+VG_SO_SYN_PREFIX_LEN);
HChar const* last = VG_(clo_soname_synonyms);
- while (*last) {
+ while (last != NULL && *last) {
HChar const* first = last;
last = advance_to_equal(first);
@@ -611,6 +610,17 @@
last++;
}
+ // If the user didn't set it then somalloc is special. We
+ // want to match public/global symbols that match the
+ // fnpatt everywhere.
+ if (replaced_sopatt == NULL
+ && VG_(strcmp) ( demangled_sopatt, SO_SYN_MALLOC_NAME ) == 0)
+ {
+ replaced_sopatt = VG_(strdup)("m_redir.rnnD.1", "*");
+ demangled_sopatt = replaced_sopatt;
+ isGlobal = True;
+ }
+
// If we have not replaced the sopatt, then skip the redir.
if (replaced_sopatt == NULL)
continue;
@@ -621,6 +631,7 @@
spec->from_fnpatt = dinfo_strdup("redir.rnnD.3", demangled_fnpatt);
spec->to_addr = sym_avmas.main;
spec->isWrap = isWrap;
+ spec->isGlobal = isGlobal;
spec->becTag = becTag;
spec->becPrio = becPrio;
/* check we're not adding manifestly stupid destinations */
@@ -653,7 +664,7 @@
for (i = 0; i < nsyms; i++) {
VG_(DebugInfo_syms_getidx)( newdi, i, &sym_avmas,
NULL, &sym_name_pri, &sym_names_sec,
- &isText, NULL );
+ &isText, NULL, NULL );
const HChar* twoslots[2];
const HChar** names_init =
alloc_symname_array(sym_name_pri, sym_names_sec, &twoslots[0]);
@@ -785,7 +796,7 @@
)
{
Spec* sp;
- Bool anyMark, isText, isIFunc;
+ Bool anyMark, isText, isIFunc, isGlobal;
Active act;
Int nsyms, i;
SymAVMAs sym_avmas;
@@ -813,7 +824,7 @@
for (i = 0; i < nsyms; i++) {
VG_(DebugInfo_syms_getidx)( di, i, &sym_avmas,
NULL, &sym_name_pri, &sym_names_sec,
- &isText, &isIFunc );
+ &isText, &isIFunc, &isGlobal );
const HChar* twoslots[2];
const HChar** names_init =
alloc_symname_array(sym_name_pri, sym_names_sec, &twoslots[0]);
@@ -827,7 +838,8 @@
for (sp = specs; sp; sp = sp->next) {
if (!sp->mark)
continue; /* soname doesn't match */
- if (VG_(string_match)( sp->from_fnpatt, *names )) {
+ if (VG_(string_match)( sp->from_fnpatt, *names )
+ && (sp->isGlobal == False || isGlobal == True)) {
/* got a new binding. Add to collection. */
act.from_addr = sym_avmas.main;
act.to_addr = sp->to_addr;
@@ -1220,6 +1232,7 @@
spec->from_fnpatt = CONST_CAST(HChar *,fnpatt);
spec->to_addr = to_addr;
spec->isWrap = False;
+ spec->isGlobal = False;
spec->mandatory = mandatory;
/* VARIABLE PARTS */
spec->mark = False; /* not significant */
@@ -1719,7 +1732,7 @@
const HChar** sym_names_sec = NULL;
VG_(DebugInfo_syms_getidx)( di, j, NULL,
NULL, &sym_name_pri, &sym_names_sec,
- &isText, NULL );
+ &isText, NULL, NULL );
const HChar* twoslots[2];
const HChar** names_init =
alloc_symname_array(sym_name_pri, sym_names_sec, &twoslots[0]);
@@ -1773,10 +1786,11 @@
static void show_spec ( const HChar* left, const Spec* spec )
{
VG_(message)( Vg_DebugMsg,
- "%s%-25s %-30s %s-> (%04d.%d) 0x%08lx\n",
+ "%s%-25s %-30s %s%s-> (%04d.%d) 0x%08lx\n",
left,
spec->from_sopatt, spec->from_fnpatt,
spec->isWrap ? "W" : "R",
+ spec->isGlobal ? "G" : "L",
spec->becTag, spec->becPrio,
spec->to_addr );
}
Modified: trunk/coregrind/m_replacemalloc/vg_replace_malloc.c
==============================================================================
--- trunk/coregrind/m_replacemalloc/vg_replace_malloc.c (original)
+++ trunk/coregrind/m_replacemalloc/vg_replace_malloc.c Sun Nov 15 16:50:43 2015
@@ -291,7 +291,6 @@
// For some lines, we will also define a replacement function
// whose only purpose is to be a soname synonym place holder
// that can be replaced using --soname-synonyms.
-#define SO_SYN_MALLOC VG_SO_SYN(somalloc)
// malloc
#if defined(VGO_linux)
Modified: trunk/coregrind/pub_core_debuginfo.h
==============================================================================
--- trunk/coregrind/pub_core_debuginfo.h (original)
+++ trunk/coregrind/pub_core_debuginfo.h Sun Nov 15 16:50:43 2015
@@ -216,7 +216,8 @@
/*OUT*/const HChar** pri_name,
/*OUT*/const HChar*** sec_names,
/*OUT*/Bool* isText,
- /*OUT*/Bool* isIFunc );
+ /*OUT*/Bool* isIFunc,
+ /*OUT*/Bool* isGlobal );
/* ppc64-linux only: find the TOC pointer (R2 value) that should be in
force at the entry point address of the function containing
guest_code_addr. Returns 0 if not known. */
Modified: trunk/docs/xml/manual-core.xml
==============================================================================
--- trunk/docs/xml/manual-core.xml (original)
+++ trunk/docs/xml/manual-core.xml Sun Nov 15 16:50:43 2015
@@ -2315,18 +2315,26 @@
<option><![CDATA[--soname-synonyms=syn1=pattern1,syn2=pattern2,...]]></option>
</term>
<listitem>
- <para>When a shared library is loaded, Valgrind checks for
- functions in the library that must be replaced or wrapped.
- For example, Memcheck replaces all malloc related
- functions (malloc, free, calloc, ...) with its own versions.
- Such replacements are done by default only in shared libraries whose
- soname matches a predefined soname pattern (e.g.
- <varname>libc.so*</varname> on linux).
- By default, no replacement is done for a statically linked
- library or for alternative libraries such as tcmalloc.
+ <para>When a shared library is loaded, Valgrind checks for
+ functions in the library that must be replaced or wrapped. For
+ example, Memcheck replaces some string and memory functions
+ (strchr, strlen, strcpy, memchr, memcpy, memmove, etc.) with its
+ own versions. Such replacements are normally done only in shared
+ libraries whose soname matches a predefined soname pattern (e.g.
+ <varname>libc.so*</varname> on linux). By default, no
+ replacement is done for a statically linked library or for
+ alternative libraries, except for the allocation functions
+ (malloc, free, calloc, memalign, realloc, operator new, operator
+ delete, etc.) Such allocation functions are intercepted by
+ default in any shared library or in the executable if they are
+ exported as global symbols. This means that if a replacement
+ allocation library such as tcmalloc is found, its functions are
+ also intercepted by default.
+
In some cases, the replacements allow
<option>--soname-synonyms</option> to specify one additional
- synonym pattern, giving flexibility in the replacement. </para>
+ synonym pattern, giving flexibility in the replacement. Or to
+ prevent interception of all public allocation symbols.</para>
<para>Currently, this flexibility is only allowed for the
malloc related functions, using the
@@ -2339,27 +2347,31 @@
<listitem>
<para>Alternate malloc library: to replace the malloc
- related functions in an alternate library with
- soname <varname>mymalloclib.so</varname>, give the
+ related functions in a specific alternate library with
+ soname <varname>mymalloclib.so</varname> (and not in any
+ others), give the
option <option>--soname-synonyms=somalloc=mymalloclib.so</option>.
A pattern can be used to match multiple libraries sonames.
For
example, <option>--soname-synonyms=somalloc=*tcmalloc*</option>
- will match the soname of all variants of the tcmalloc library
- (native, debug, profiled, ... tcmalloc variants). </para>
+ will match the soname of all variants of the tcmalloc
+ library (native, debug, profiled, ... tcmalloc
+ variants). </para>
<para>Note: the soname of a elf shared library can be
retrieved using the readelf utility. </para>
</listitem>
<listitem>
- <para>Replacements in a statically linked library are done by
- using the <varname>NONE</varname> pattern. For example, if
- you link with <varname>libtcmalloc.a</varname>, memcheck
- will properly work when you give the
- option <option>--soname-synonyms=somalloc=NONE</option>. Note
- that a NONE pattern will match the main executable and any
- shared library having no soname. </para>
+ <para>Replacements in a statically linked library are done
+ by using the <varname>NONE</varname> pattern. For example,
+ if you link with <varname>libtcmalloc.a</varname>, and only
+ want to intercept the malloc related functions in the
+ executable (and standard libraries) themselves, but not any
+ other shared libraries, you can give the
+ option <option>--soname-synonyms=somalloc=NONE</option>.
+ Note that a NONE pattern will match the main executable and
+ any shared library having no soname. </para>
</listitem>
<listitem>
@@ -2369,6 +2381,17 @@
</para>
</listitem>
+ <listitem>
+ <para>To only intercept allocation symbols in the default
+ system libraries, but not in any other shared library or the
+ executable defining public malloc or operator new related
+ functions use a non-existing library name
+ like <option>--soname-synonyms=somalloc=nouserintercepts</option>
+ (where <varname>nouserintercepts</varname> can be any
+ non-existing library name).
+ </para>
+ </listitem>
+
</itemizedlist>
</listitem>
</varlistentry>
Modified: trunk/include/pub_tool_redir.h
==============================================================================
--- trunk/include/pub_tool_redir.h (original)
+++ trunk/include/pub_tool_redir.h Sun Nov 15 16:50:43 2015
@@ -345,6 +345,12 @@
#define VG_SO_SYN_PREFIX "VgSoSyn"
#define VG_SO_SYN_PREFIX_LEN 7
+// Special soname synonym place holder for the malloc symbols that can
+// be replaced using --soname-synonyms. Otherwise will match all
+// public symbols in any shared library/executable.
+#define SO_SYN_MALLOC VG_SO_SYN(somalloc)
+#define SO_SYN_MALLOC_NAME "VgSoSynsomalloc"
+
#endif // __PUB_TOOL_REDIR_H
/*--------------------------------------------------------------------*/
Modified: trunk/memcheck/tests/Makefile.am
==============================================================================
--- trunk/memcheck/tests/Makefile.am (original)
+++ trunk/memcheck/tests/Makefile.am Sun Nov 15 16:50:43 2015
@@ -291,6 +291,9 @@
wrap7.vgtest wrap7.stdout.exp wrap7.stderr.exp \
wrap8.vgtest wrap8.stdout.exp wrap8.stderr.exp \
wrap8.stdout.exp-ppc64 wrap8.stderr.exp-ppc64 \
+ wrapmalloc.vgtest wrapmalloc.stdout.exp wrapmalloc.stderr.exp \
+ wrapmallocstatic.vgtest wrapmallocstatic.stdout.exp \
+ wrapmallocstatic.stderr.exp \
writev1.stderr.exp writev1.stderr.exp-solaris writev1.vgtest \
xml1.stderr.exp xml1.stdout.exp xml1.vgtest xml1.stderr.exp-s390x-mvc \
threadname.vgtest threadname.stderr.exp \
@@ -375,6 +378,7 @@
wcs \
xml1 \
wrap1 wrap2 wrap3 wrap4 wrap5 wrap6 wrap7 wrap7so.so wrap8 \
+ wrapmalloc wrapmallocso.so wrapmallocstatic \
writev1
if !SOLARIS_SUN_STUDIO_AS
@@ -570,4 +574,26 @@
-Wl,-soname -Wl,wrap7so.so
endif
+# Build shared object for wrapmalloc
+wrapmalloc_SOURCES = wrapmalloc.c
+wrapmalloc_DEPENDENCIES = wrapmallocso.so
+if VGCONF_OS_IS_DARWIN
+ wrapmalloc_LDADD = `pwd`/wrapmallocso.so
+ wrapmalloc_LDFLAGS = $(AM_FLAG_M3264_PRI)
+else
+ wrapmalloc_LDADD = wrapmallocso.so
+ wrapmalloc_LDFLAGS = $(AM_FLAG_M3264_PRI) \
+ -Wl,-rpath,$(top_builddir)/memcheck/tests
+endif
+
+wrapmallocso_so_SOURCES = wrapmallocso.c
+wrapmallocso_so_CFLAGS = $(AM_CFLAGS) -fpic
+if VGCONF_OS_IS_DARWIN
+ wrapmallocso_so_LDFLAGS = -fpic $(AM_FLAG_M3264_PRI) -dynamic \
+ -dynamiclib -all_load
+else
+ wrapmallocso_so_LDFLAGS = -fpic $(AM_FLAG_M3264_PRI) -shared \
+ -Wl,-soname -Wl,wrapmallocso.so
+endif
+
xml1_CFLAGS = $(AM_CFLAGS) -D_GNU_SOURCE
Modified: trunk/memcheck/tests/new_override.vgtest
==============================================================================
--- trunk/memcheck/tests/new_override.vgtest (original)
+++ trunk/memcheck/tests/new_override.vgtest Sun Nov 15 16:50:43 2015
@@ -1,2 +1,6 @@
prog: new_override
+# Don't override the user defined somalloc functions in this test.
+# The test depends on some side effects and initializing memory done by
+# the user overidden operator new.
+vgopts: --soname-synonyms=somalloc=nouseroverride
stderr_filter: filter_allocs
Added: trunk/memcheck/tests/wrapmalloc.c
==============================================================================
--- trunk/memcheck/tests/wrapmalloc.c (added)
+++ trunk/memcheck/tests/wrapmalloc.c Sun Nov 15 16:50:43 2015
@@ -0,0 +1,14 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+/* Test that a program that has malloc/free interposed in a shared
+ library is also intercepted. */
+
+int main ( void )
+{
+ printf ("start\n");
+ void *p = malloc (1024);
+ free (p);
+ printf ("done\n");
+ return 0;
+}
Added: trunk/memcheck/tests/wrapmalloc.stderr.exp
==============================================================================
--- trunk/memcheck/tests/wrapmalloc.stderr.exp (added)
+++ trunk/memcheck/tests/wrapmalloc.stderr.exp Sun Nov 15 16:50:43 2015
@@ -0,0 +1,10 @@
+
+
+HEAP SUMMARY:
+ in use at exit: 0 bytes in 0 blocks
+ total heap usage: 1 allocs, 1 frees, 1,024 bytes allocated
+
+For a detailed leak analysis, rerun with: --leak-check=full
+
+For counts of detected and suppressed errors, rerun with: -v
+ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Added: trunk/memcheck/tests/wrapmalloc.stdout.exp
==============================================================================
--- trunk/memcheck/tests/wrapmalloc.stdout.exp (added)
+++ trunk/memcheck/tests/wrapmalloc.stdout.exp Sun Nov 15 16:50:43 2015
@@ -0,0 +1,2 @@
+start
+done
Added: trunk/memcheck/tests/wrapmalloc.vgtest
==============================================================================
--- trunk/memcheck/tests/wrapmalloc.vgtest (added)
+++ trunk/memcheck/tests/wrapmalloc.vgtest Sun Nov 15 16:50:43 2015
@@ -0,0 +1,2 @@
+prog: wrapmalloc
+
Added: trunk/memcheck/tests/wrapmallocso.c
==============================================================================
--- trunk/memcheck/tests/wrapmallocso.c (added)
+++ trunk/memcheck/tests/wrapmallocso.c Sun Nov 15 16:50:43 2015
@@ -0,0 +1,17 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+/* Fake malloc/free functions that just print something. When run
+ under memcheck these functions will be intercepted and not print
+ anything. */
+
+void *malloc ( size_t size )
+{
+ printf ("malloc\n");
+ return NULL;
+}
+
+void free (void *ptr)
+{
+ printf ("free\n");
+}
Added: trunk/memcheck/tests/wrapmallocstatic.c
==============================================================================
--- trunk/memcheck/tests/wrapmallocstatic.c (added)
+++ trunk/memcheck/tests/wrapmallocstatic.c Sun Nov 15 16:50:43 2015
@@ -0,0 +1,29 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+/* Test that a program that has malloc/free interposed in the
+ executable is also intercepted. */
+
+int main ( void )
+{
+ printf ("start\n");
+ void *p = malloc (1024);
+ free (p);
+ printf ("done\n");
+ return 0;
+}
+
+/* Fake malloc/free functions that just print something. When run
+ under memcheck these functions will be intercepted and not print
+ anything. */
+
+void *malloc ( size_t size )
+{
+ printf ("malloc\n");
+ return NULL;
+}
+
+void free (void *ptr)
+{
+ printf ("free\n");
+}
Added: trunk/memcheck/tests/wrapmallocstatic.stderr.exp
==============================================================================
--- trunk/memcheck/tests/wrapmallocstatic.stderr.exp (added)
+++ trunk/memcheck/tests/wrapmallocstatic.stderr.exp Sun Nov 15 16:50:43 2015
@@ -0,0 +1,10 @@
+
+
+HEAP SUMMARY:
+ in use at exit: 0 bytes in 0 blocks
+ total heap usage: 1 allocs, 1 frees, 1,024 bytes allocated
+
+For a detailed leak analysis, rerun with: --leak-check=full
+
+For counts of detected and suppressed errors, rerun with: -v
+ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Added: trunk/memcheck/tests/wrapmallocstatic.stdout.exp
==============================================================================
--- trunk/memcheck/tests/wrapmallocstatic.stdout.exp (added)
+++ trunk/memcheck/tests/wrapmallocstatic.stdout.exp Sun Nov 15 16:50:43 2015
@@ -0,0 +1,2 @@
+start
+done
Added: trunk/memcheck/tests/wrapmallocstatic.vgtest
==============================================================================
--- trunk/memcheck/tests/wrapmallocstatic.vgtest (added)
+++ trunk/memcheck/tests/wrapmallocstatic.vgtest Sun Nov 15 16:50:43 2015
@@ -0,0 +1,2 @@
+prog: wrapmallocstatic
+
|
|
From: Petar J. <mip...@gm...> - 2015-11-13 15:49:36
|
Fixed in VEX r3203. Thanks for the report. Regards, Petar On Tue, Nov 3, 2015 at 6:46 AM, Rhys Kidd <rhy...@gm...> wrote: > Amend vassert() checking of the hwcaps_host variable to correctly handle > all cases. > > Reported by Coverity #1308873 Logical vs. bitwise operator. > > Index: priv/host_mips_isel.c > =================================================================== > --- priv/host_mips_isel.c (revision 3201) > +++ priv/host_mips_isel.c (working copy) > @@ -4173,7 +4173,7 @@ > vassert(arch_host == VexArchMIPS32 || arch_host == VexArchMIPS64); > vassert(VEX_PRID_COMP_MIPS == hwcaps_host > || VEX_PRID_COMP_BROADCOM == hwcaps_host > - || VEX_PRID_COMP_NETLOGIC); > + || VEX_PRID_COMP_NETLOGIC == hwcaps_host); > > /* Check that the host's endianness is as expected. */ > vassert(archinfo_host->endness == VexEndnessLE > > > ------------------------------------------------------------------------------ > > _______________________________________________ > Valgrind-developers mailing list > Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-developers > > |
|
From: <sv...@va...> - 2015-11-13 15:45:48
|
Author: petarj
Date: Fri Nov 13 15:45:38 2015
New Revision: 3203
Log:
mips: fix incorrect assert for hwcaps_host
Fix incorrect and incomplete assert condition for hwcaps_host in
iselSB_MIPS().
Spotted by Coverity and reported by Rhys Kidd.
Modified:
trunk/priv/host_mips_isel.c
Modified: trunk/priv/host_mips_isel.c
==============================================================================
--- trunk/priv/host_mips_isel.c (original)
+++ trunk/priv/host_mips_isel.c Fri Nov 13 15:45:38 2015
@@ -4171,9 +4171,10 @@
/* sanity ... */
vassert(arch_host == VexArchMIPS32 || arch_host == VexArchMIPS64);
- vassert(VEX_PRID_COMP_MIPS == hwcaps_host
- || VEX_PRID_COMP_BROADCOM == hwcaps_host
- || VEX_PRID_COMP_NETLOGIC);
+ vassert(VEX_PRID_COMP_MIPS == VEX_MIPS_COMP_ID(hwcaps_host)
+ || VEX_PRID_COMP_BROADCOM == VEX_MIPS_COMP_ID(hwcaps_host)
+ || VEX_PRID_COMP_NETLOGIC == VEX_MIPS_COMP_ID(hwcaps_host)
+ || VEX_PRID_COMP_CAVIUM == VEX_MIPS_COMP_ID(hwcaps_host));
/* Check that the host's endianness is as expected. */
vassert(archinfo_host->endness == VexEndnessLE
|
|
From: <sv...@va...> - 2015-11-09 20:58:08
|
Author: sewardj
Date: Mon Nov 9 20:58:01 2015
New Revision: 15725
Log:
Initial add of new bugs since 3.11.0.
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 Mon Nov 9 20:58:01 2015
@@ -73,3 +73,84 @@
========================================================================
========================================================================
+351140 arm64 syscalls setuid (146) and setresgid (149) not implemented
+351282 valgrind 3.10.1 MIPS softfloat build broken with GCC 4.9.3 /
+ binutils 2.25.1
+351386 Cannot run ld.so.1 under Valgrind
+351391 Some blog CSS does not render properly under Firefox or Safari
+351474 coregrind/m_libcsignal.c:134: bad test ?
+351491 Unrecognised instruction in library compiled with -mavx -ffast-math -O3
+351531 Typo in /include/vki/vki-xen-physdev.h header guard
+351536 Valgrind should track map areas of unloaded libraries
+351632 UNKNOWN fcntl 97 on OS X 10.11
+351692 Dumps created by valgrind are not readable by gdb
+351726 vex amd64->IR: 0xC5 0xF3 0xC2 0x15 0xEB 0x7C 0x2 0x0
+351742 jump to illegal address without stack backtrace
+351756 Spurious errors on OS X 10.10.5 using Valgrind 3.11 SVN
+351792 vgdb doesn't support remote file transfers
+351804 Crash on generating suppressions for `printf`
+ call on OS X 10.10 / Valgrind 3.11 SVN
+351848 Option for showing addresses of memory leaks?
+351855 Possible false positive on OS X with setlocale
+351857 confusing error message about valid command line option
+351858 ldsoexec support on Solaris
+351873 Newer gcc doesn't allow __builtin_tabortdc[i] in ppc32 mode
+352021 Signals are ignored in OS X 10.10
+352059 Fix unhandled sysarch cmd 132 (AMD64_GET_XFPUSTATE) on FreeBSD/amd64
+352130 helgrind reports false races for printfs using mempcpy
+ manipulating FILE* state
+352183 s390x: none/tests/s390x/fpext is failing
+352197 mips: mmap2() not wrapped correctly for page size > 4096
+352284 s390 Conditional jump or move depends on uninitialised value(s)
+ in vfprintf
+352320 arm64 crash on none/tests/nestedfs
+352364 ppc64: --expensive-definedness-checks=yes is not quite working here
+352384 mmap-FIXED failed in UME (load_segment2)
+352395 Please provide SVN revision info in --version
+352549 Valgrind (whether with memchek or callgrind) crashes with
+ "unhandled instruction bytes"
+352567 Assertion tres.status == VexTransOK failed in m_translate.c
+ vgPlain_translate
+352586 Missing emulation of the PowerPC "mbar" instruction
+352630 valgrind: Unrecognised instruction at address 0x4fc4d33.
+352742 Custom allocator using sbrk() fails after about 800MB when running
+ under memcheck
+352765 Vbit test fails on Power 6
+352767 Wine/valgrind: Warning: noted but unhandled ioctl 0x5307 with
+ no size/direction hints. (CDROMSTOP)
+352768 The mbar instruction is missing from the Power PC support
+352769 Power PC program priority register (PPR) is not supported
+353083 arm64 doesn't implement various xattr system calls
+353084 arm64 doesn't support sigpending system call
+353137 www: update info for Supported Platforms
+353138 www: update "The Valgrind Developers" page
+353192 Debug info/data section not detected on AMD64
+353282 False uninitialised memory after bittwiddling
+353346 WARNING: unhandled amd64-darwin syscall: unix:330
+353370 amd64->IR: 0x48 0xF 0xC7 0xF0 0x72 0x4 0xFF 0xC9
+353384 unhandled instruction bytes: 0x66 0xF 0x3A 0x62 0xD1 0x62 0x41 0x3B
+ __intel_sse4_strpbrk
+353470 memcheck/tests/execve2 fails on OS X 10.11
+353471 memcheck/tests/x86/xor-undef-x86 fails on OS X 10.11
+353660 XML in auxwhat tag not escaping ampersand properly
+353680 s390x: Crash with certain glibc versions due to non-implemented TBEGIN
+353727 unhandled instruction bytes: 0x66 0xF 0x3A 0x62 0xD1 0x72 0x45 0x3B
+ __intel_sse4_strspn
+353802 ELF debug info reader confused with multiple .rodata sections
+353891 testcase memcheck/tests/leak-segv-jmp: Memcheck: mc_leakcheck.c:1045
+ (lc_scan_memory): Assertion 'bad_scanned_addr < VG_ROUNDDN(start+len,
+ sizeof(Addr))' failed.
+353920 unhandled amd64-solaris syscall: 170
+354274 arm: unhandled instruction: 0xEBAD 0x0AC1 (sub.w sl, sp, r1, lsl #3)
+354392 unhandled amd64-solaris syscall: 171
+354428 Bad report memory leak in OS X 10.11
+354797 Vbit test does not include Iops for Power 8 instruction support
+354809 Error message for unsupported platform is unhelpful
+354882 Valgrind 3.11.0 (and 3.12.0-SVN) fails to build on OSX 10.11 El Capitan
+354883 Assertion failure with valgrind-3.11.0 on OSX 10.11
+354909 strlen() provokes false positives on icc -O2 (Linux)
+354931 Analyze of qt app results in incompatible processor message
+354933 Android READMEs talk of --kernel-variant=android-emulator-no-hw-tls,
+ which doesn't exist
+
+Mon 9 Nov 21:57:00 CET 2015
|
|
From: <sv...@va...> - 2015-11-09 20:35:59
|
Author: sewardj
Date: Mon Nov 9 20:35:51 2015
New Revision: 15724
Log:
Create 3_11_BUGSTATUS.txt.
Added:
trunk/docs/internals/3_11_BUGSTATUS.txt
Modified:
trunk/docs/Makefile.am
Modified: trunk/docs/Makefile.am
==============================================================================
--- trunk/docs/Makefile.am (original)
+++ trunk/docs/Makefile.am Mon Nov 9 20:35:51 2015
@@ -29,6 +29,7 @@
internals/3_8_BUGSTATUS.txt \
internals/3_9_BUGSTATUS.txt \
internals/3_10_BUGSTATUS.txt \
+ internals/3_11_BUGSTATUS.txt \
internals/MERGE_3_10_1.txt \
internals/arm_thumb_notes_gdbserver.txt \
internals/avx-notes.txt \
Added: trunk/docs/internals/3_11_BUGSTATUS.txt
==============================================================================
--- trunk/docs/internals/3_11_BUGSTATUS.txt (added)
+++ trunk/docs/internals/3_11_BUGSTATUS.txt Mon Nov 9 20:35:51 2015
@@ -0,0 +1,75 @@
+
+Created Mon 9 Nov 21:30:57 CET 2015. All new bugs after the release
+of 3.11.0 go in here. Bugs that didn't get fixed in 3.11.0 remain in
+3_10_BUGSTATUS.txt.
+
+=== VEX/amd64 ==========================================================
+
+=== VEX/arm ============================================================
+
+=== VEX/arm64 ==========================================================
+
+=== VEX/x86 ============================================================
+
+=== VEX/mips ===========================================================
+
+=== VEX/ppc ============================================================
+
+=== VEX/s390x ==========================================================
+
+=== VEX general ========================================================
+
+=== Syscalls/ioctls ====================================================
+
+=== Debuginfo reader ===================================================
+
+=== Tools/Memcheck =====================================================
+
+=== Tools/DRD ==========================================================
+
+=== Tools/Helgrind =====================================================
+
+=== Tools/SGCheck ======================================================
+
+=== Tools/Massif =======================================================
+
+=== Tools/Cachegrind ===================================================
+
+=== Tools/Lackey =======================================================
+
+=== other/mips =========================================================
+
+=== other/ppc ==========================================================
+
+=== other/arm ==========================================================
+
+=== other/s390 =========================================================
+
+=== other/tilegx =======================================================
+
+=== other/Android ======================================================
+
+=== other/OS X ========================================================
+
+=== other/Win32 =======================================================
+
+=== GDB server =========================================================
+
+=== Output =============================================================
+
+=== MPI ================================================================
+
+=== Documentation ======================================================
+
+=== Uncategorised/run ==================================================
+
+=== Uncategorised/build=================================================
+
+========================================================================
+========================================================================
+========================================================================
+
+========================================================================
+========================================================================
+========================================================================
+
|
|
From: Yan <ya...@ya...> - 2015-11-09 00:07:53
|
Hi William, In every direct jump that I've seen, the target address ends up coming from an IRConst, usually being passed through a temp or two on the way. On top of this, the indirect jump is always the default exit of a basic block (the conditional Exit IRStmt only supports an IRConst destination). The way that we deal with identifying indirect jumps in PyVEX is by iterating through the statements, from the end of the basic block, in reverse, looking for the WrTmp that had written the exit. If it's a direct jump, the IRExpr that it writes should be a Const. If it's something else, from what we've seen empirically, the jump is indirect. The relevant piece of PyVEX is https://github.com/angr/pyvex/blob/master/pyvex/__init__.py#L225, if you're interested. You'll have to translate that to C, of course :-) - Yan On Sun, Nov 8, 2015 at 9:49 AM, William Good <app...@li...> wrote: > I would like to instrument on indirect function calls in my tool. I have > obtained the VEX corresponding to the indirect function call: > > > 0x400B87: call* %rax > > ------ IMark(0x400B87, 2, 0) ------ > t7 = 64to32(GET:I64(16)) > t8 = GET:I64(16) > t9 = Sub64(GET:I64(48),0x8:I64) > PUT(48) = t9 > STle(t9) = 0x400B89:I64 > ====== AbiHint(Sub64(t9,0x80:I64), 128, t8) ====== > PUT(184) = t8 > PUT(184) = GET:I64(184); exit-Call > > In the original assembly, the address of the indirect function is in %rax > (which is offset 16 in libvex_guest_amd64.h). Is there a pattern/strategy > for detecting indirect function calls? > > > > > ------------------------------------------------------------------------------ > > _______________________________________________ > Valgrind-developers mailing list > Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-developers > > |
|
From: William G. <app...@li...> - 2015-11-08 17:50:02
|
I would like to instrument on indirect function calls in my tool. I have obtained the VEX corresponding to the indirect function call:
0x400B87: call* %rax
------ IMark(0x400B87, 2, 0) ------
t7 = 64to32(GET:I64(16))
t8 = GET:I64(16)
t9 = Sub64(GET:I64(48),0x8:I64)
PUT(48) = t9
STle(t9) = 0x400B89:I64
====== AbiHint(Sub64(t9,0x80:I64), 128, t8) ======
PUT(184) = t8
PUT(184) = GET:I64(184); exit-Call
In the original assembly, the address of the indirect function is in %rax (which is offset 16 in libvex_guest_amd64.h). Is there a pattern/strategy for detecting indirect function calls?
|
|
From: <sv...@va...> - 2015-11-08 10:42:14
|
Author: philippe
Date: Sun Nov 8 10:42:06 2015
New Revision: 15723
Log:
If --history-level=full was not provided at startup, report an error in
helgrind accesshistory monitor command
As accesshistory will never show anything unless this option is given.
Modified:
trunk/helgrind/hg_main.c
Modified: trunk/helgrind/hg_main.c
==============================================================================
--- trunk/helgrind/hg_main.c (original)
+++ trunk/helgrind/hg_main.c Sun Nov 8 10:42:06 2015
@@ -4988,6 +4988,12 @@
{
Addr address;
SizeT szB = 1;
+ if (HG_(clo_history_level) < 2) {
+ VG_(gdb_printf)
+ ("helgrind must be started with --history-level=full"
+ " to use accesshistory\n");
+ return True;
+ }
if (VG_(strtok_get_address_and_size) (&address, &szB, &ssaveptr)) {
if (szB >= 1)
libhb_event_map_access_history (address, szB, HG_(print_access));
|
|
From: <sv...@va...> - 2015-11-06 22:10:11
|
Author: florian
Date: Fri Nov 6 22:10:05 2015
New Revision: 511
Log:
Fix documentation of command line flag. BZ #354933
Modified:
trunk/docs/manual/dist.readme-android.html
Modified: trunk/docs/manual/dist.readme-android.html
==============================================================================
--- trunk/docs/manual/dist.readme-android.html (original)
+++ trunk/docs/manual/dist.readme-android.html Fri Nov 6 22:10:05 2015
@@ -197,7 +197,7 @@
# at startup. This is because the emulator (for ARM) may not be<br>
# simulating a hardware TLS register. To get around this, run<br>
# Valgrind with:<br>
-# --kernel-variant=android-emulator-no-hw-tls<br>
+# --kernel-variant=android-no-hw-tls<br>
# <br>
# (2) if you are running a real device, you need to tell Valgrind<br>
# what GPU it has, so Valgrind knows how to handle custom GPU<br>
|