486 Commits

Author SHA1 Message Date
Mark Wielaard
a93b787140 Bug 338703 helgrind on arm-linux gets false positives in dynamic loader.
There are a couple of issues with helgrind on arm-linux with glibc:

- Thread creation stack traces cannot unwind through clone
  (cfi ends right after syscall)
- ld.so has a special "hard float" name that isn't recognized as special
  (ld-linux-armhf.so.3)
- Races are found when manipulating GOT sections.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14407
2014-09-01 15:29:55 +00:00
Florian Krohm
be54c05513 Deprecate --db-attach Fixes BZ #337871
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14401
2014-09-01 06:37:07 +00:00
Mark Wielaard
8d4524f6a1 Bug 338681 Enable clone backtrace hack for i386-linux in helgrind.
glibc doesn't provide CFI unwind information right after the clone call
(because it would be invalid in the child). Enable the same workaround
for i386-linux that is already used for amd64-linux (subtract 3 from ip).

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14398
2014-08-30 20:37:40 +00:00
Julian Seward
917e8e40f8 Initial triage pass for all remaining newly opened bugs.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14395
2014-08-30 10:09:30 +00:00
Philippe Waroquiers
23ced45c48 document in NEWS the fact that stack registration start/end boundaries
are the lowest/highest addressable bytes


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14393
2014-08-29 23:24:20 +00:00
Julian Seward
db85fec898 Update.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14387
2014-08-29 19:34:45 +00:00
Mark Wielaard
a3a0be70ab Bug 338615 suppress glibc 2.20 optimized strcmp implementation for ARMv7.
Add an add_hardwired_spec for strcmp in VG_(redir_initialise) for
ld-linux.so.3 and ld-linux-armhf.so.3 to use a simple strcmp
implementation in m_trampoline.S (compiled from the trivial .c code
to asm with gcc like the other implementations in that file).

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14374
2014-08-28 14:59:04 +00:00
Philippe Waroquiers
59990c4f9d 338499 --sim-hints parsing broken due to wrong order in tokens (after introduction of no-nptl-pthread-stackcache)
Fix the token order in m_main.c

Somewhat retested by running the regression tests
(testing no-nptl-pthread-stackcache) and testing in an outer/inner setup
(testing enable-outer,no-inner-prefix).
It seems there is no regtest for the 2 other flags (lax-ioctls,fuse-compatible)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14349
2014-08-24 11:24:10 +00:00
Julian Seward
7566a219b0 Memcheck: add a new flag, --show-mismatched-frees=no|yes [yes], to
optionally disable allocator/deallocator mismatch checking.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14336
2014-08-22 19:26:23 +00:00
Mark Wielaard
4c64a05422 NEWS 330319 vex amd64->IR: unhandled instruction bytes: 0xF 0x1 0xD5 (xend)
VEX svn r2931

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14328
2014-08-21 17:46:48 +00:00
Mark Wielaard
262ce8ca11 Bug 338445 amd64 vbit-test fails with unknown opcodes used by arm64 VEX.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14327
2014-08-21 14:44:48 +00:00
Philippe Waroquiers
bbf15483ab Update in NEWS the gcc release needed to better support Ada tasks termination
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14322
2014-08-20 20:53:07 +00:00
Mark Wielaard
b4ebc0e151 configure should check for warning flags supported to disable them (#338205).
Configure would check whether gcc supported -Wno... flags. But gcc always
does. It is happy to just not warn about anything. So flip all configure
checks to test for the warning and only when gcc accepts the warning flag
use -Wno-...

Introduces two helper functions to make it easier to add new flag checks.
AC_GCC_WARNING_COND and AC_GCC_WARNING_SUBST_NO.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14319
2014-08-20 16:11:53 +00:00
Philippe Waroquiers
d06e43ba80 Announce in NEWS the change of behaviour (i.e. validity checking)
for the clo options --kernel-variant and --sim-hints



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14302
2014-08-17 20:07:36 +00:00
Philippe Waroquiers
bc353dfe97 fix 338160: Implement QGetTlsAddr query so that GDB+V gdbsrv can print __thread variables.
To implement QGetTlsAddr, gdbsrv has to know how to get the glibc dtv
address and the module id from the link_map.
These 2 things are dependent on the internals of glibc.
The dependency is mostly isolated in a few lines of arch dependent
code or in an external utility that used a hack + -ldl lib to find
the offset of the modid in the link_map structure.

Tested on x86/amd64/ppc64/s390x. Somewhat tested on ppc32 and arm64.
Untested/a few #ifdef-ed lines not compiled on arm/mips32/mips64
and darwin.

For more background info about thread local storage handling, see
'ELF Handling For Thread-Local Storage' http://www.akkadia.org/drepper/tls.pdf

Changes:
* auxprogs/getoff.c new auxilliary program to get platform specific offsets
  (currently only the offset for the module id in struct link_map).
* configure.ac : check for dlinfo(RTLD_DI_TLS_MODID) needed for getoff.c
* new gdbserver_tests/hgtls, testing various types of __thread variables
* various m_gdbserver files:
  - implement decoding of the QGetTlsAddr query
  - for each platform: platform specific code to get the dtv
  - call to external program getoff-<platform> the first time an
    __thread variable is printed.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14283
2014-08-15 10:27:52 +00:00
Bart Van Assche
8701c89a36 drd: Clear conflict set after fork (#338115)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14244
2014-08-08 16:27:30 +00:00
Philippe Waroquiers
24e0fbf92a fix 338024 inlined functions are not shown if DW_AT_ranges is used
Based on investigation and patch by Matthias Schwarzott.
(no small test found that reproduced the problem,
but the equivalent patch given in bug 338024 fixed the inlined stack
trace  in a big shared lib).
Would be nice however to have a small test case ...



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14236
2014-08-05 19:34:35 +00:00
Christian Borntraeger
00a31dd3d1 add support for VKI_BLKDISCARDZEROES
this is used in some newer QEMU versions and other tools


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14235
2014-08-05 15:14:52 +00:00
Bart Van Assche
67b975eb93 NEWS: Add #331829 (Unexpected ioctl opcode sign extension)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14234
2014-08-05 12:03:51 +00:00
Julian Seward
fdfada9f35 Add support for stack unwinding using the ARM32 specific EXIDX format.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14217
2014-07-31 14:25:29 +00:00
Philippe Waroquiers
eb2b193943 Fix dangling ref in m_errormgr.c + report all uninit fields in a syscall param
Some syscall verification code is allocating memory to generate 
the string used to build an error, e.g. syswrap-generic.c verifying fields of
e.g socket addresses (pre_mem_read_sockaddr) or sendmsg/recvmsg args 
(msghdr_foreachfield)

The allocated pointer was copied in the error created by VG_(maybe_record_error).

This was wrong for 2 reasons:
1. If the error is a new error, it is stored in a list of errors,
   but the string memory was freed by pre_mem_read_sockaddr, msghdr_foreachfield, ...
   This causes a dangling reference. Was at least visible when giving -v, which
   re-prints all errors at the end of execution.
   Probably this could have some consequences during run while generating new errors,
   and comparing for equality with a recorded error having a dangling reference.
2. the same allocated string is re-used for each piece/field of the verified struct.
   The code in mc_errors.c that checks that 2 errors are identical was then wrongly
   considereing that 2 successive errors for 2 different fields for the same syscall
   arg are identical, just because the error string happened to be produced at
   the same address.
(it is believed that initially, the error string was assumed to be a static
string, which is not the case anymore, causing the above 2 problems).

Changes:
* The fix consists in duplicating in m_errormgr.c the given error string when
  the error is recorded. In other words, the error string is now duplicated similarly
  to the (optional) extra component of the error.

* memcheck/tests/linux/rfcomm.c test modified as now an error is reported
  for each uninit field.

* socketaddr unknown family is also better reported (using sa_data field name,
  rather than an empty field name.

* minor reformatting in m_errormgr.c, to be below 80 characters.

Some notes:
1. the string is only duplicated if the error is recorded
   (ie. printed or the first time an error matches a suppression).
   The string is not duplicated for duplicated errors or following errors
   matching the first (suppressed) error.
   The string is also not duplicated for 'unique errors' (that are printed
   and then not recorded).
2. duplicating the string for each recorded error is not deemed to
   use a lot of memory:
     * error strings are usually NULL or short (often 10 bytes or so).
     * we expect no program has a huge number of errors
   If ever this string duplicate would be significant, having a DedupPoolAlloc
   in m_errormgr.c for these strings would reduce this memory (as we expect to
   have very few different strings, even with millions of errors).



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14214
2014-07-30 22:20:29 +00:00
Philippe Waroquiers
b63e95c189 Announce now in NEWS that now all locks are announced.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14205
2014-07-29 20:19:04 +00:00
Philippe Waroquiers
682b5ddd63 Describe the lock address in a lock announcement message.
(note that some error messages are not announcing the lock,
which is not that nice).
At least the lock order violation message do not announce locks.
That should be improved/fixed



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14188
2014-07-24 21:00:24 +00:00
Tom Hughes
ea9b0ccd7d Document fix of BZ#315199.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14182
2014-07-23 07:54:41 +00:00
Philippe Waroquiers
6629c56543 Add a new heuristic 'length64' to detect interior pointers
pointing at offset 64bit of a block, when the first 8 bytes contains
the block size - 8. This is e.g. used by sqlite3MemMalloc.

Patch by Matthias Schwarzott (with small modif)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14179
2014-07-21 19:55:11 +00:00
Philippe Waroquiers
ef4e827246 Patch adding (or showing the proper/not confusing) helgrind thread nr for block
and stack address description.

* A race condition on an allocated block shows the stacktrace, but
  does not show the thread # that allocated the block.
  This patch adds the output of the thread # that allocated the block.

*  The patch also fixes the confusion that might appear between
  the core threadid and the helgrind thread nr in Stack address description:
  A printed stack addrinfo was containing a thread id, while all other helgrind
  messages are using (supposed to use) an 'helgrind thread #' which
  is used in the thread announcement.

    Basically, the idea is to let a tool set a "tool specific thread nr'
    in an addrinfo.
    The pretty printing of the addrinfo is then by preference showing this
    thread nr (if it was set, i.e. different of 0).
    Currently, only helgrind uses this addrinfo tnr.

    Note: in xml mode, the output is matching the protocol description.
    I.e., GUI should not be impacted by this change, if they properly implement
    the xml protocol.


* Also, make the output produced by m_addrinfo consistent:
  The  message 'block was alloc'd at'  is changed to be like all other
  output : one character indent, and starting with an uppercase



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14175
2014-07-18 00:03:58 +00:00
Mark Wielaard
91c93d3896 Bug 336619 valgrind --read-var-info=yes doesn't handle DW_TAG_restrict_type.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14165
2014-07-15 15:47:25 +00:00
Mark Wielaard
03eb8f43a7 Bug 337094 ifunc wrapper is broken on ppc64.
ppc64 uses function descriptors, so we need to get the actual function
entry address for the VG_USERREQ__ADD_IFUNC_TARGET client request, but
we need to return the function descriptor itself from the ifunc_wrapper.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14163
2014-07-15 15:07:01 +00:00
Philippe Waroquiers
2b1ae38fe1 Slightly refined the NEWS entry for silly/fishy args
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14159
2014-07-14 21:39:11 +00:00
Philippe Waroquiers
c99e3af927 This patch decreases significantly the memory needed to store the lineloc info.
On a big executable, the trunk needs:
dinfo: 134873088/71438336  max/curr mmap'd, 134607808/66717872 max/curr

With the patch, we have:
dinfo: 99065856/56836096  max/curr mmap'd,   97883776/51663656 max/curr

So, peak dinfo memory decreases by about 36Mb, and final by 15Mb.

(for info, valgrind 3.9.0 uses
dinfo: 158941184/109666304  max/curr mmap'd, 156775944/107590656 max/curr
So, compared to 3.9.0, dinfo peak decreases by about 40%, and the final
memory is divided by more than 2).

The memory decrease is obtained by:

* using a dedup pool to store filename/dirname pair for the loctab source/line
  information.
  As typically, there is not a lot of such pairs, typically a UShort is
  good enough to identify a fn/dn pair in a dedup pool.
  To avoid losing memory due to alignment, the fndn indexes are stored
  in a "parallel" array to the DiLoc loctab array, with entries having
  1, or 2 or 4 bytes according to the nr of fn/dn pairs in the dedup pool.
  See priv_storage.h comments for details.

  (there was a extensible WordArray local implementation in readdwarf.c.
   As with this change, we use an xarray, the local implementation was
   removed).

* the memory needed for --read-inline-info is slightly decreased (-2Mb)
  by removing the (unused) dirname from the DiInlLoc struct.
  Handling dirname for inlined function caller implies to rework
  the dwarf3 parser read_filename_table common to the var and inlinfo parser.
  Waiting for this to be done, the dirname component is removed from DiInlLoc.

* the stabs reader (readstabs.c) is broken since 3.9.0. 
  For this change, the code has been updated to make it compile with the new
  DiLoc/FnDn dedup pool. As the code is completely broken, a vg_assert(0)
  has been put at the begin of the stabs reader.

* the pdb reader (readpdb.c) has been trivially updated and should still work.
  It has not been tested (how do we test this ?).
  A follow-up patch will be done to avoid doing too many calls to
  ML_(addFnDn) : instead of having one call per ML_(addLineInfo), one
  should have a single call done when reading the filename table.

This has also be tested in an outer/inner setup, to verify no
memory leak/bugs.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14158
2014-07-14 21:20:57 +00:00
Florian Krohm
0e951964ef Provide a back trace when a function argument of a known allocation
function is presumably negative. Fixes BZ 79311.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14157
2014-07-13 14:41:55 +00:00
Florian Krohm
aef15e280d Announce fix for BZ #336957
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14154
2014-07-11 21:32:23 +00:00
Tom Hughes
82ec0b5d43 Add support for the F_OFD_SETLK, F_OFD_SETLKW, and F_OFD_GETLK fcntl
commands. BZ#337285.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14149
2014-07-10 14:48:00 +00:00
Bart Van Assche
947b85111a NEWS: Mention #336772, --default-suppressions and the std::thread update in the drd manual
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14131
2014-07-05 06:52:48 +00:00
Florian Krohm
c40d351f36 Update the C++ demangler by importing files from GCC trunk @ 212125.
Add a smoke test for the demangler and update the helper script.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14124
2014-06-30 21:04:16 +00:00
Tom Hughes
94b049ff1d Add support for various SIOCETHTOOL operations. BZ#303536.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14114
2014-06-27 09:59:52 +00:00
Tom Hughes
49ed137491 Wire up recvmmsg on arm. BZ#334585.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14113
2014-06-26 13:34:53 +00:00
Tom Hughes
13c65e031d Add SIOCATMARK ioctl support.
Patch from Austin English via BZ#335441.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14112
2014-06-26 13:14:56 +00:00
Tom Hughes
4ef60ef102 Implement various SNDRV_CTL_xxx ioctls.
Patch from Ivan Sorokin via BZ#334936.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14111
2014-06-26 12:53:23 +00:00
Tom Hughes
e97f8c49d6 Handle the HCIGETDEVLIST ioctl.
Based on patch from Tomasz Nowak via BZ#335034.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14109
2014-06-26 11:44:46 +00:00
Tom Hughes
5f4dbbeb75 Add support for the SG_IO ioctl.
Patch from Daniel Kamil Kozar via BZ#333817.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14107
2014-06-26 11:29:05 +00:00
Tom Hughes
ba3d08c7a7 Handle the CDROM_DISC_STATUS ioctl.
Patch from Daniel Kamil Kozar via BZ#333788.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14106
2014-06-26 11:11:56 +00:00
Tom Hughes
8c9c829f4c Add support for TIOCNOTTY ioctl. BZ#331476.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14104
2014-06-26 11:03:32 +00:00
Florian Krohm
a4923d3057 Suppress a clang warning about an uninitialised variable.
Fixes BZ #329694.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14092
2014-06-24 11:35:45 +00:00
Florian Krohm
8f46d5fb35 BZ 330257 has been fixed in r14055.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14088
2014-06-23 19:43:32 +00:00
Florian Krohm
31caca50d5 ms_print ought to create temporary files in a proper directory as
specified with --with-tmpdir at configuration time or with TMPDIR
at runtime. Doing so fixes the symptom reported in BZ #332765.
Also fix an incorrect error message.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14077
2014-06-21 20:25:30 +00:00
Philippe Waroquiers
49514f8121 Refine NEWS entry for helgrind Ada tasks intercepts
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14048
2014-06-16 21:26:24 +00:00
Philippe Waroquiers
f3ee06ddce Add helgrind intercepts to have helgrind understanding Ada tasks terination rules
A recent gnatpro version is needed for this to work.

Thanks to these intercepts, some false positive errors are avoided,
and helgrind properly recuperates some internal memory associated
to the terminated task.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14046
2014-06-16 20:00:14 +00:00
Philippe Waroquiers
e5d788fc40 Announce in NEWS 199144 == 278972
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14045
2014-06-16 18:28:51 +00:00
Philippe Waroquiers
6158ccf35b Announce in NEWS the support for inlined function calls in stacktraces/suppressions
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14037
2014-06-15 15:54:58 +00:00