469 Commits

Author SHA1 Message Date
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
Julian Seward
e32c76a6c2 Update.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14020
2014-06-10 12:05:33 +00:00
Dejan Jevtic
f1b4547420 mips64: Tests for Cavium MIPS Octeon Atomic and Count Instructions.
Tests for instructions:
baddu, pop, dpop, saa, saad, laa, laad, lai, laid, lad, ladd, law, lawd,
las, lasd, lac, lacd


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13994
2014-06-04 11:36:21 +00:00
Philippe Waroquiers
9b67d18f11 Improve address description for address in the stack.
--read-var-info=yes is very memory and cpu intensive.
This patch ensures that even witout --read-var-info=yes that
the frame where the address point is reported in the address
description.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13991
2014-05-22 23:48:24 +00:00
Julian Seward
32adfb9026 Update.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13989
2014-05-21 20:23:43 +00:00
Carl Love
2548eee443 Forgot to update NEWS file with bugzilla 335155 fix.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13988
2014-05-21 19:33:57 +00:00
Bart Van Assche
af88283a6d NEWS: Add #333072
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13985
2014-05-18 19:33:39 +00:00
Philippe Waroquiers
ab71852280 Fix 334788 clarify doc about --log-file initial program directory
Behaviour is kept unchanged, a paragraph is added in the doc to
clarify.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13979
2014-05-17 05:50:46 +00:00
Mark Wielaard
a1513e0348 Revert "Tools should explain why an option is bad when using fmsg_bad_option."
This reverts valgrind svn r13975. This was a work in progress, still being
discussed in bug #334802. It should not yet been pushed.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13978
2014-05-16 22:38:46 +00:00
Mark Wielaard
1418e68e22 Tools should explain why an option is bad when using fmsg_bad_option.
Add an explanation of why an option was bad to fmsg_bad_option calls that
were just using "" as argument. Fixes bug #334802.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13975
2014-05-16 22:28:42 +00:00
Julian Seward
b0e2fd66e4 Update.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13973
2014-05-16 12:22:50 +00:00
Philippe Waroquiers
183b978d08 Factorises the address code description and printing
of memcheck and helgrind in a common module:
  pub_tool_addrinfo.h pub_core_addrinfo.h m_addrinfo.c

At the same time, the factorised code is made usable by other
tools also (and is used by the gdbserver command 'v.info location'
which replaces the helgrind 'describe addr' introduced 1 week ago
and which is now callable by all tools).

The new address description code can describe more addresses
(e.g. for memcheck, if the block is not on the free list anymore,
but is in an arena free list, this will also be described).

Similarly, helgrind address description can now describe more addresses
when --read-var-info=no is given (e.g. global symbols are
described, or addresses on the stack are described as
being on the stack, freed blocks in the arena free list are
described, ...).
See e.g. the change in helgrind/tests/annotate_rwlock.stderr.exp
or locked_vs_unlocked2.stderr.exp

The patch touches many files, but is basically a lot of improvements
in helgrind output files.
The code changes are mostly refactorisation of existing code.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13965
2014-05-14 20:39:27 +00:00
Julian Seward
cdce5974bf Update.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13964
2014-05-14 13:29:04 +00:00
Mark Wielaard
85011418d1 Use safe_to_deref in coregrind syswrap-generic.c (msghdr_foreachfield).
Call ML_(safe_to_deref) before using msghdr msg_name, msg_iov or msg_control.
Fixes bug #334705.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13963
2014-05-14 11:35:54 +00:00
Mark Wielaard
5f385bb6e3 Support -Wformat -Werror=format-security.
Check if gcc supports -Wformat -Werror=format-security and use it if so.
Fix m_gdbserver/remote-utils.c sr_perror call. Fixes Bug #334727.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13962
2014-05-14 10:50:14 +00:00
Julian Seward
a9be523b3f Minor updates.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13955
2014-05-13 09:29:33 +00:00
Julian Seward
2c2bee19b1 3_9_BUGSTATUS.txt: looked at all bugs in the file. Moved fixed ones
to NEWS (if not already there).  Put the rest of them into a set of
categories depending on which part of the code base is affected, which
divides them up into -- IMO -- much more managable groups.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13951
2014-05-09 16:13:21 +00:00
Mark Wielaard
a07285e393 Add test for MPX instructions and bnd prefix. Bug #333666.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13948
2014-05-09 11:41:46 +00:00