Commit Graph

743 Commits

Author SHA1 Message Date
Philippe Waroquiers
be2da24d6c Fix incorrect (or infinite loop) unwind on RHEL7 amd64 64 bits.
Same kind of problems as explained and fixed in revision 15720:
In some cases, unwinding always retrieves the same pc/sp/bp.

Fix for 64 bits is similar: stop unwinding if the previous sp is >= new sp



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15794
2016-02-17 22:41:14 +00:00
Mark Wielaard
ccd541e916 Bug 359201 futex syscall skips argument 5 if op is FUTEX_WAIT_BITSET
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15793
2016-02-17 20:53:34 +00:00
Florian Krohm
a696c9e44a s390: Fix BZ #359289, adding support for popcnt insn.
Companion patch is VEX r3210.
Patch by Andreas Arnez (arnez@linux.vnet.ibm.com).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15792
2016-02-17 20:00:59 +00:00
Philippe Waroquiers
f6f39d4dbe Fix Bug 359133 - m_deduppoolalloc.c:258 (vgPlain_allocEltDedupPA): Assertion 'eltSzB <= ddpa->poolSzB' failed.
When the elt to allocate is bigger than the pool size, allocate
a specific pool only for this element.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15787
2016-02-14 22:14:19 +00:00
Philippe Waroquiers
861333b084 Some more fixes for Bug 348345 - Assertion fails for negative lineno
* Complain instead of asserting when negative line nr in inline info
* use a macro to factorise the complain once logic about lineno limits



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15780
2016-02-03 22:12:56 +00:00
Tom Hughes
5465229553 Add tests for FCOM/FCOMP instructions. BZ#212352.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15779
2016-02-03 10:15:56 +00:00
Philippe Waroquiers
9c66c9607b Implement support for 'catch syscall' in gdbserver.
Note that catch syscall implies to use the soon to be released
gdb 7.11 version.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15770
2016-01-22 21:06:23 +00:00
Mark Wielaard
6072a5a3ac Bug #357833 Setting RLIMIT_DATA to zero breaks with linux 4.5+
We used to set the process datasize rlimit to zero to prevent
any internal use of brk() from having any effect. But later
linux kernels redefine RLIMIT_DATA as the size of any data
areas, including some dynamic mmap memory allocations.

See bug #357833 for the commit that went into linux 4.5
changing the definition of RLIMIT_DATA. So don't mess with
RLIMIT_DATA anymore. Just remember it for use in the syscall
wrappers.

This also cleans up some hacks around the execv and spawn wrappers.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15766
2016-01-21 11:37:43 +00:00
Mark Wielaard
68a1308014 Bug #358030 Support direct socket calls on x86 32bit (new in linux 4.3)
Patch by ronald.wahl@raritan.com.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15764
2016-01-20 22:24:43 +00:00
Florian Krohm
d6156d8f84 Avoid an MSVC compiler warning about an unused function parameter.
Fixes BZ #356817


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15762
2016-01-17 16:20:14 +00:00
Philippe Waroquiers
647642d093 fix n-i-bz false positive leaks due to aspacemgr merging non heap segments with heap segments.
aspace mgr provides VG_(am_mmap_client_heap) that mmaps memory and
marks it as being client heap memory. Marking superblock segments used
for malloc/free as heap is critical for correct leak search: segments
mmap-ed for malloc/free cannot be considered as part of the root set.
On the other hand, other mmap-ed segments cannot be marked as client
heap, otherwise these segments will not be part of the root set, and
will not be scanned.

aspacemgr merges adjacent segments when they have the same characteristics
e.g. kind, RWX and isCH (is client heap) must be the same (see function
maybe_merge_nsegments).

However, VG_(am_mmap_client_heap) has a bug:
  * it first mmaps a normal segment (not marked as heap) using
     VG_(am_mmap_anon_float_client)
  * it then searches the segment that contains the just mmap-ed address and
    marks it as heap.
    
The problem is that VG_(am_mmap_anon_float_client) has already
possibly merged the new segment with a neighbour segment, without
taking the to be marked isCH into account, as the newly allocated memory
has not yet been marked as Client Heap.  So, this results in some memory being
marked as client heap, while it in fact is not client heap. This
memory will then not be scanned by the leak search.

The fix consists in having VG_(am_mmap_anon_float_client) and
VG_(am_mmap_client_heap) calling a new function
am_mmap_anon_float_client, which will mark (or not) the new segment as
client heap *before* trying to merge it with neighbouring segments.
Then the new (heap) segment will only be merged with neighbours that are also
client heap segments.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15759
2016-01-14 20:23:11 +00:00
Ivo Raisr
da7db302c1 Fix expected output of helgrind/tests/tc20_verifywrap on Solaris.
n-i-bz


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15758
2016-01-13 05:37:36 +00:00
Ivo Raisr
fd75106fb5 Announce properly fix of:
357871 - pthread_spin_destroy not properly wrapped


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15757
2016-01-12 20:32:31 +00:00
Florian Krohm
5abaa97db8 VG_(fclose) ought to close the file, you silly. Fixes BZ #357887.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15755
2016-01-12 14:32:05 +00:00
Philippe Waroquiers
10876a2dbe Fix 353660 XML in auxwhat tag not escaping reserved symbols properly
Changed a few %s or %pS into %ps in m_addrinfo.c
(based on code reading matching the pattern given in the bug report,
as there was no reproducer).



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15753
2015-12-28 22:02:18 +00:00
Philippe Waroquiers
7a0b7b8b55 Fix the bug description in NEWS
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15748
2015-12-13 16:54:34 +00:00
Philippe Waroquiers
21ec256b95 Fix 191069 Exiting due to signal not reported in XML output
Patch from  Matthias Schwarzott (slightly modified)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15747
2015-12-13 16:53:46 +00:00
Philippe Waroquiers
58ba63b7df Fix massif --pages-as-heap=yes does not report peak caused by mmap+munmap
ms_unrecord_page_mem was wrongly taking the (possible) peak snapshot
when unrecording the last block.
But the peak snapshot will be detected when unrecording the first block
of an munmap, not when unrecording the last block.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15745
2015-12-10 22:37:59 +00:00
Ivo Raisr
f1fceb1e3a Dwarf line info reader now correctly interprets 'is_stmt' register
Line numbers should correctly reflect all instructions belonging to a source line,
regardless of is_stmt value. Previously only instructions covered by
'is_stmt = 1' were attributed to a source line.

Fixes BZ#356044


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15741
2015-12-04 13:14:10 +00:00
Philippe Waroquiers
2a8421f74c Announce fix for (not in bugzilla) unwind problems on RHEL7 32 bits
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15730
2015-11-18 20:59:34 +00:00
Ivo Raisr
0d30686d21 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


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15728
2015-11-18 20:38:37 +00:00
Ivo Raisr
68c788c973 Expected stderr of test cases wrapmalloc and wrapmallocstatic are overconstrained.
Fixes BZ#355455.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15727
2015-11-18 04:13:12 +00:00
Mark Wielaard
8b4dd5c47c 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.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15726
2015-11-15 16:50:43 +00:00
Florian Krohm
75ddfb026a Fix documentation of command line flag
BZ #354933 


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15722
2015-11-06 22:08:46 +00:00
Carl Love
bf17dceca0 Add ISA 2.07 vbit test support
Updated the NEWS file for this fix in VEX commit 3202 and valgrind commit
15720.

Bugzilla 354797 was created for this issue.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15721
2015-11-03 17:52:08 +00:00
Ivo Raisr
e7be5069c3 Solaris syscall: Add support for lwp_cond_signal(171).
Fixes BZ#354392.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15718
2015-10-26 16:13:05 +00:00
Philippe Waroquiers
6b5a479bda Fix 353891 Assert 'bad_scanned_addr < VG_ROUNDDN(start+len, sizeof(Addr))' failed
All memory dereferences during leak search are checked either with
aspacemgr or using the VA-bits.
So, in theory, no memory fault should occur.
However, the leak search is done so as to resist to e.g.
- desynchronisation between the real pages mapped and the aspacemgr state.
- client pages mprotected against reading
- any other reason why dereferencing a client address would fail.

So, the function lc_scan_memory installs a fault catcher that
is called if a memory fault signal is raised during memory scan.
However, memory dereference is also done in the function heuristic_reachedness.
So, this function must also resist to memory fault.

This patch also installs a fault catcher for the function heuristic_reachedness.

More in details, the following changes are done:
* pub_tool_signal.h and m_signals.c :
  VG_(set_fault_catcher) now returns the previously set fault catcher.
  This is needed so that heuristic_reachedness/lc_scan_memory can save
  and restore the previous fault catcher.

* mc_leakcheck.c:
  Addition of leak_search_fault_catcher that contains the common
  code for the (currently 2) fault catchers used during leak search.

* Modification of heuristic_reachedness and lc_scan_memory:
  Add 2 (small) specific fault catcher that are calling the common
  leak_search_fault_catcher.

* The way sigprocmask is handled has been changed:
  Before this patch, lc_scan_memory was saving/restoring the procsigmask
  for each scanned block (and was restoring it when the fault catcher
  was longjmp-ing back to lc_scan_memory in case of SEGV or BUS.
  This was causing 2 system calls for each block scanned.

  Now, lc_scan_memory and  heuristic_reachedness are not saving/restoring
  the procmask: the work to reset the sigprocmask is only done
  in leak_search_fault_catcher. This is more efficient as no syscall
  anymore is done during leak search, except for (normally) unfrequent
  SIGSEGV/BUS. It is also simpler as signal handling is now done at
  a single place.
  
  It is ok to reset the procmask (in fact, just remove the caught signal
  from the process sigmask) as during leak search, no other activity than
  the leak search is on-going, and so no other SEGV/BUS can be received
  while the handler runs.

This gives moderate speed improvements for applications allocating a lot of
blocks (about 10% improvement when leak searching in 1 million small blocks).

Test case (slightly modified) by Matthias Schwarzott.
  
  
  



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15716
2015-10-22 19:14:30 +00:00
Ivo Raisr
b6aeb1c9e6 Solaris syscall: Add support for lwp_cond_wait(170).
Provide scalar test as well.
Fixes BZ #353920.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15708
2015-10-16 12:20:20 +00:00
Ivo Raisr
9aaa41b23d Solaris syscall: Enable fchdir(120) - generic.
Provide scalar tests as well.
Fixes BZ #353917.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15707
2015-10-15 09:37:14 +00:00
Florian Krohm
91a29a676c On a zEC12 or z13, a glibc with lock elision enabled infers from HWCAP
that the prerequisites for lock elision are met.  Then it may use TBEGIN
and other transactional-execution instructions which are not implemented
by Valgrind.  Likewise, the upcoming glibc 2.23 will exploit vector
instructions if they are advertised by HWCAP; and those are currently
not implemented by Valgrind either.  In general, the increased use of
ifunc may lead to more such cases in the future.

This patch suppresses the advertising of those hardware features via
HWCAP which are either not known to Valgrind or currently unsupported.

Patch by Andreas Arnez (arnez@linux.vnet.ibm.com).
Fixes BZ #353680.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15702
2015-10-12 20:35:56 +00:00
Ivo Raisr
6ef7c1085f Solaris syscall: Add support for pset family (207).
Provide scalar tests as well.
Fixes BZ #353398.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15700
2015-10-12 19:10:42 +00:00
Mark Wielaard
26cbea8712 Bug #278744 cvtps2pd with redundant RexW.
Add testcase for VEX svn r3198.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15699
2015-10-12 14:32:03 +00:00
Mark Wielaard
8327786b08 Don't advertise RDRAND in cpuid for Core-i7-4910-like avx2 machine.
Announce fix for bug #353370 (VEX svn r3197) in NEWS.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15695
2015-10-01 12:35:16 +00:00
Bart Van Assche
0c3280baa5 NEWS: Update
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15688
2015-09-29 05:40:43 +00:00
Julian Seward
0a8d1755ec Merge, from branches/VALGRIND_3_11_BRANCH, NEWS and docs/xml/vg-entities.xml.
Bump version to 3.12.0.SVN.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15679
2015-09-23 13:35:36 +00:00
Mark Wielaard
3d7da7a718 Bug 353084 arm64 doesn't support sigpending system call.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15676
2015-09-23 12:15:36 +00:00
Mark Wielaard
3d33343cb7 Bug 353083 arm64 doesn't implement various xattr system calls.
This enables setxattr, lsetxattr, fsetxattr, fgetxattr, removexattr,
lremovexattr, fremovexattr, listxattr, llistxattr and flistxattr on
arm64-linux.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15675
2015-09-23 11:51:47 +00:00
Florian Krohm
e45be516ed Pick up 'egrep' and 'strings' from $PATH instead of using
hardwired absolute path names. People can always arrange $PATH
such that these tools are found.
Fixes BZ #294065. Patch by Austin English <austinenglish@gmail.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15652
2015-09-16 08:59:03 +00:00
Florian Krohm
b911481ec4 Announce fix for BZ #352284. See VEX r3186
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15642
2015-09-08 06:27:50 +00:00
Julian Seward
944183cb69 Update.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15640
2015-09-07 20:00:05 +00:00
Florian Krohm
93504b89c4 Changes related to new IROp Iop_RoundF128toInt. See VEX r3183.
s390: Add testcase for fixbr.
Patch by Andreas Arnez <arnez@linux.vnet.ibm.com>.
Part of fixing BZ #350290.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15629
2015-09-05 20:39:27 +00:00
Mark Wielaard
758fab675c Fix bug #339636 Use fxsave64 and fxrstor64 mnemonics again.
Just add a configure check to see if the assembler understands
fxsave64/fxrstor64 and fall back to the old-school rex64 prefix
otherwise.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15625
2015-09-04 21:52:52 +00:00
Mark Wielaard
cc9d412d2d Bug #352130 helgrind reports false races for printfs using mempcpy
Add a new Race suppression.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15622
2015-09-04 10:52:01 +00:00
Rhys Kidd
b1631e4c8e Fix UNKNOWN fcntl 97 on OS X 10.11
bz#351632

On OS X 10.11 (DP8)

Before:

== 595 tests, 575 stderr failures, 10 stdout failures, 0 stderrB failures, 0 stdoutB failures, 30 post failures ==

After:

== 595 tests, 219 stderr failures, 9 stdout failures, 0 stderrB failures, 0 stdoutB failures, 30 post failures ==

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15619
2015-09-03 11:31:58 +00:00
Philippe Waroquiers
c5dd149b60 - The default value for --leak-check-heuristics has been changed from
"none" to "all". This helps to reduce the number of possibly
  lost blocks, in particular for C++ applications.
 


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15618
2015-09-02 21:57:53 +00:00
Philippe Waroquiers
0307c6dcaa Enhance block_list memcheck gdbserver monitor command
Due to the (still to be done) default activation of --leak-check-heuristics=all,
improve the block_list monitor command for easier display of blocks
found reachable via heuristics.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15617
2015-09-02 21:26:34 +00:00
Mark Wielaard
b4d7d70d2a Bug 351873 Newer gcc doesn't allow __builtin_tabortdc[i] in ppc32 mode.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15615
2015-09-02 15:43:31 +00:00
Julian Seward
ade6e87e05 Remove redundant bit of text introduced in r15604.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15612
2015-09-01 08:50:12 +00:00
Julian Seward
b18e81a7af Rename the new option --expensive-definedness-check introduced in
r15594 to --expensive-definedness-checks.  (Pluralised it, iow.)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15611
2015-09-01 08:48:04 +00:00
Philippe Waroquiers
2b72e87dcb Small additional change in NEWS for block_list
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15609
2015-08-31 22:15:40 +00:00