Commit Graph

9980 Commits

Author SHA1 Message Date
Philippe Waroquiers
5f4e46336a announce fix for 309823 Generate errors for still reachable blocks
Functionality is provided via the new 3.9.0 arg
    --errors-for-leak-kinds=kind1,kind2,..  which leak kinds are errors?
                                            [definite,possible]
        where kind is one of definite indirect possible reachable all none

that was committed in rev 13170.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13305
2013-03-03 13:23:58 +00:00
Tom Hughes
269fc43ee7 Implement the name_to_handle_at system call for x86 and amd64.
Based on patch from Asmadeus to fix BZ#308930.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13304
2013-03-03 12:57:20 +00:00
Philippe Waroquiers
48f3860354 Avoid warning that format argument is not a string literal
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13303
2013-03-02 15:44:03 +00:00
Philippe Waroquiers
1b9a118603 Factorise some code from syswrap-amd64/arm/mips32/mips64-linux.c to syswrap-linux.c
Almost mechanical transformation, removes > 1000 SLOC.

Compiled and regtested on amd64/x86/mips32
Compiled and (somewhat) tested on mips64
Compiled on arm



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13302
2013-03-01 23:31:09 +00:00
Philippe Waroquiers
f239a1c516 small changes in sendmsg.c regtest
* avoid a warning related to pointer types
* replace exit (0) by return 0 (might help backtraces on Darwin, suggestion by Rich Coe)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13301
2013-03-01 23:05:43 +00:00
Philippe Waroquiers
5039f7dbbe allow compile time tracing to be enabled using the stats counters
(so put first the static stats counters).



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13300
2013-03-01 20:37:41 +00:00
Philippe Waroquiers
e9bcd2e95d Announce 296311 was fixed Wrong stack traces due to -fomit-frame-pointer (x86)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13299
2013-03-01 19:07:29 +00:00
Christian Borntraeger
293a0cefd6 wire up 2 vhost ioctls. The kernel does not use any parameter
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13298
2013-03-01 13:17:49 +00:00
Christian Borntraeger
85a4737869 initial tun/tap ioctls.
TUNSETIFF/TUNGETIFF/TUNSETOFFLOAD. See 315952.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13297
2013-03-01 12:56:07 +00:00
Julian Seward
4d4e322abf Do some more triagery.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13296
2013-03-01 12:10:33 +00:00
Julian Seward
18fc881c8f Do some triagery.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13295
2013-03-01 09:20:32 +00:00
Tom Hughes
592e58c747 Don't check the flags word in msghdr for sendmsg as the
kernel will neither read nor write it.

Patch from Mark Wielaard to fix BZ#315441.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13294
2013-02-28 12:50:55 +00:00
Julian Seward
75980bfb08 Update bug list.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13293
2013-02-28 09:03:21 +00:00
Petar Jovanovic
5dd4c02e39 mips: adding MIPS64LE support to Valgrind
Necessary changes to Valgrind to support MIPS64LE on Linux.
Minor cleanup/style changes embedded in the patch as well.
The change corresponds to r2687 in VEX.
Patch written by Dejan Jevtic and Petar Jovanovic.

More information about this issue:
https://bugs.kde.org/show_bug.cgi?id=313267


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13292
2013-02-27 23:17:33 +00:00
Philippe Waroquiers
6fc2200840 Fix vassert_fail producing random output for an empty format
vsnprintf does not do any addition to the buffer for an empty
format. So, buf was not null terminated.
This e.g. causes an assert_fail to output random characters
after the failed expression.
Fix by ensuring the buffer of vsnprintf is always null terminated
to start with.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13291
2013-02-26 21:54:28 +00:00
Philippe Waroquiers
ec83134fa2 fix 315545 (find_TTEntry_from_hcode): Assertion '(UChar*)sec->tt[tteNo].tcptr <= (UChar*)hcode' failed
Assertion 
  valgrind: m_transtab.c:674 (find_TTEntry_from_hcode):
  Assertion '(UChar*)sec->tt[tteNo].tcptr <= (UChar*)hcode' failed.
failure (encountered on some platforms while running gdbsrv tests).

The problem is related to invalidated entries and the host_extents
mapping between hostcode and the translation table entry.

The problem: when an entry is invalidated, the translation table
entry is changed to status Deleted. However, the host extent array
element is not cleaned up.
If a search for a host code address (find_TTEntry_from_hcode)
finds this entry, the translation table entry in Deleted status
is considered as a 'not found', which ensures that the invalidated
entry is not used (e.g. for chaining).
This is all ok.

However, it might be that this Deleted entry is re-used
(see function VG_(add_to_transtab), searching for a Empty
or Deleted entry.
If the Deleted entry is re-used, then a search for the
dead host code can give a result pointing to the re-used
entry. That is clearly wrong.
Note that it is unclear if this bug can only be triggered
while using gdbsrv or if this bug can be triggered with
just the "normal" invalidation logic of translation.
gdbsrv being a heavy "user" of invalidation, it might
be it helps to trigger the code. Alternatively, as gdbsrv
invalidation is special (e.g. invalidation of some entries
is done during translation of other entries), it might be
the bug is specific to gdbsrv.

In any case, to avoid the bug:
searching for an host code address must not only
ignore Deleted entries, but must also ignore an entry
found via a host_extent element which is for a Deleted
entry that was re-used afterwards (pointed to by a
newer host_extent element).


Multiple solutions are possible for fixing the bug:
Sol1: cleanup the host_extents array when an entry is deleted.
  The cleanup is however deemed costly:
  Each invalidate operation must do a search in the host_extents.
  The host_extents array must then be "compacted" to remove
  the "dead" host extent element from the array.
  The compact operation can be avoided if instead of removing
  the element, one marks instead the element as "dead"
  e.g. by using one bit of UInt len for that:
     UInt len : 31;
     Bool dead : 1;
  This avoids the compact, but still incurrs the cost of
  search and modify the host_extent for each entry invalidated.
  Invalidating entries seems to be a critical operation
  (e.g. specific ECLASS related  data structures have been
   done to allow fast deletion).
  => it is deemed that a solution not incurring cost during
  invaliation is preferrable.

* Sol 2: detect in find_TTEntry_from_hcode
  that the host_extent element is re-used, and handle it similarly
  to an host_extents which points at a Deleted entry.
  This detection is possible as if an entry is re-used after
  having been deleted, this implies that its host code will be
  after the end of the host code of the deleted entry
  (as host code of a sector is not re-used).
  The attached patch implements this solution.

* Sol 3: avoid re-using an entry : the entry would then stay
  in Deleted state. This is deemed not ok as it would
  imply that invalidation of entries will cause a sector to
  become full faster.

The patch:
* adds a new function
  Bool HostExtent__is_dead (const HostExtent* hx, const Sector* sec)
  telling if the host extent hx from sector sec is a dead entry.
* this function is used in find_TTEntry_from_hcode so that
  dead host extents are not resulting in host code to be found.
* adds a regression test which caused the assert failure before
  (bug was found/reported/isolated in a small test case by Dejan Jevtic).
* To check the logic of HostExtent__is_dead, m_transtab.c sanity check is
  completed to verify that the nr of entries in use in a sector is equal
  to the nr of non dead entries in the host extent array.
* adds/improves traces in m_transtab.c (enabled at compile
  time using #define DEBUG_TRANSTAB).
  Some already existing 'if (0)' conditions are replaced
  by if (DEBUG_TRANSTAB)

Regression tested on 
   f12/x86
   debian6/amd64 (also with export EXTRA_REGTEST_OPTS=--sanity-level=4)




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13290
2013-02-24 23:16:58 +00:00
Tom Hughes
0d1fe31512 Make msgrcv wrappers on amd64, arm and mips32 look for IPC_NOWAIT in
the flags argument, not the type argument. Fixes #315534.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13289
2013-02-21 10:57:23 +00:00
Petar Jovanovic
23923e4d3d Add Valgrind's implementation of memmove to avoid link issue
One of the recent changes, r2682 (Make HReg a struct), caused a build
break on several x86_64 and MIPS build bots/platforms that used older
gcc versions. The issue was that compilers generated calls to memmove,
and since it was built with -nodefaultlibs, the entry could not be
resolved. The fix wraps VG_(memmove) in memmove().


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13288
2013-02-15 03:12:17 +00:00
Bart Van Assche
a367a2d4fe Add support for the Linux ioctl IB_USER_MAD_ENABLE_PKEY
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13287
2013-02-14 17:10:01 +00:00
Florian Krohm
1f53bd2199 s390: Testcases and vbit-tester changes for the following
DFP insns:
- extract basied exponent
- insert biased exponent
- quantize
- reround to significance
Patch by Maran Pakkirisamy (maranp@linux.vnet.ibm.com).
Part of fixing BZ #307113.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13286
2013-02-14 14:28:22 +00:00
Florian Krohm
6965adf43e s390: Add testcase for these DFP insns: CDGTRA, CXGTR, CGXTR, and CGDTR (VEX r2680).
Update vbit tester. Patch by Maran Pakkirisamy (maranp@linux.vnet.ibm.com).
Part of fixing BZ #307113.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13285
2013-02-08 23:34:31 +00:00
Julian Seward
2dd19127c1 Add intercepts for some Qt5 functions. (David Faure, faure@kde.org)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13284
2013-02-07 11:53:36 +00:00
Julian Seward
efda19cb3d Line-wrap a comment and put in some #undefs. Non-functional change.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13283
2013-01-31 10:39:07 +00:00
Philippe Waroquiers
247d18674e Bypass warning reported by gcc
gcc reports a warning:
m_stacktrace.c:183: warning: ‘xip_verified’ may be used uninitialized in this function

This warning is a false positive:
xip_verified is assigned in the following branch:
      if (UNLIKELY(xip_verif >= CFUNWIND)) {
         if (xip_verif == CFUNWIND) {
            ...
         } else {
           <<<< here xip_verified is initialised >>>>
         }
      }


xip_verified is then used only if xip_verif > CFUNWIND.

Assign a rubish value to xip_verified to silence gcc.

(??? there are GCC pragmas that can be used to
disable a warning only on a specific line e.g.
something like:

   #pragma GCC diagnostic ignored "-Wuninitialized"
   Addr xip_verified; // xip for which we have calculated fpverif_uregs
   #pragma GCC diagnostic warning "-Wuninitialized"

instead of
   Addr xip_verified = 0; // xip for which we have calculated fpverif_uregs
   // 0 assigned to silence false positive -Wuninitialized warning

but the #pragma technique seems not used currently.

So, using the bypass by assigning a rubbish value




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13282
2013-01-30 23:53:59 +00:00
Philippe Waroquiers
b466dd954a better handle and better document the case of multi-locks cycles
In case a lock order violation is detected in a multi lock cycle,
then the current code cannot produce the set of locks and the
stack traces involved in the cycle.
However, it is still possible to produce the stack trace of
the new lock and the other lock between which a cycle was discovered.

Also, add a comment in the code clarifying why the set of locks
establishing the required order cannot (currently) be produced.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13281
2013-01-30 23:21:34 +00:00
Philippe Waroquiers
352b1d384c Improves stacktrace unwinding on x86
* other platforms (e.g. amd64) are first trying to unwind
  with cfi info, then with the fp chain.
* fp unwind when code is compiled without frame pointer can
  fail and give incomplete stack traces (often terminating
  with a random program counter, causing a huge amount of
  recorded stack traces).

This patch improves unwinding on x86 by:
* first time an IP is unwound, do the unwind both with
  CFI technique and with fp technique.
  If results are identical, IP is inserted in a cache of
  'fp unwindable' IP
* following unwind of the same IP are then done directly
  either with fp unwind or with cfi, depending on the
  cached result of the check done during first unwind.

The cache is needed so as to avoid as much as possible cfi unwind,
as this is significantly slower than fp unwind.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13280
2013-01-30 23:18:11 +00:00
Julian Seward
ac5abb76ac test_reservation(), test_double_pair_instrs(): Fix broken inline assembly
causing segfaults with gcc-4.7.  The inline assembly still isn't right,
but it's better than it was before.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13279
2013-01-29 22:14:01 +00:00
Julian Seward
dbf3bf279d Increase maximum usable memory amount from 32GB to 64GB on 64-bit Linux.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13278
2013-01-29 21:14:46 +00:00
Julian Seward
d120d46f76 get_otrack_shadow_offset_wrk: amd64: add a (very rare) missing case.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13277
2013-01-29 21:13:00 +00:00
Julian Seward
0fe8fb34cf Non functional change (formatting, comments) related to newly created
Iex_ITE.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13276
2013-01-29 21:11:55 +00:00
Julian Seward
875aed56c4 Fix the mkLazy3 case for I32 x I8 x I128 -> I128.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13275
2013-01-29 17:18:56 +00:00
Florian Krohm
1161672315 Fix a buffer overflow in VG_(assert_fail).
Patch by Matthias Schwarzott (zzam@gentoo.org) with some minor mods.
Fixes BZ 313811


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13274
2013-01-29 04:25:45 +00:00
Florian Krohm
ed4825e88e Infrastructure cleanup part 2. valgrind side changes.
Replace Iex_Mux0X with Iex_ITE (if-then-else).
Companion patch to VEX r2668.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13273
2013-01-29 03:57:40 +00:00
Julian Seward
e084ec0459 Initialise a local variable, so as to stop gcc-4.7.2 complaining that
some part of it is used uninitialised.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13272
2013-01-28 15:17:52 +00:00
Bart Van Assche
0ab171e889 drd: Make --trace-addr trace all loads for the specified address
Thanks to Florian for reporting this.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13271
2013-01-27 10:58:47 +00:00
Bart Van Assche
9816dee903 drd: Avoid that Coverity complains about a dead assignment
Thanks to Florian for reporting this.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13270
2013-01-27 10:56:04 +00:00
Philippe Waroquiers
a24644d175 Fix warning (missing #include file)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13269
2013-01-26 16:45:01 +00:00
Florian Krohm
00d3fbd9dc Avoid copying a string coming from argv[] into a fixed size buffer.
Pointed out by Coverity's checker.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13268
2013-01-26 16:32:18 +00:00
Julian Seward
45bb2fab08 Changes to track r2664, which changed the type of the condition field
of Mux0X from Ity_I8 to Ity_I1.  Patch from Florian Krohm.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13267
2013-01-26 11:49:15 +00:00
Florian Krohm
e50359ee42 Improve help message.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13266
2013-01-24 21:32:32 +00:00
Florian Krohm
248f590c8e Update list of ignored files.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13265
2013-01-24 03:26:48 +00:00
Florian Krohm
24b5658c60 Tweak script; ignore some more opcodes.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13264
2013-01-24 03:21:12 +00:00
Philippe Waroquiers
dbc1a5d2d6 Avoid doing a useless system call in scheduler sanity check
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13263
2013-01-23 22:19:36 +00:00
Philippe Waroquiers
d9a9aa9786 Implement the gdbsrv monitor command v.do expensive_sanity_check_general
(useful to check the sanity of valgrind on request and/or from GDB,
when an error is reported by the tool).
Also re-order the NEWS entries to put the internals things after
the user level new functions.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13262
2013-01-23 22:10:28 +00:00
Philippe Waroquiers
e6ced88776 ensure nightly reports the GDB version
Useful to investigate the behaviour of gdbsrv tests


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13261
2013-01-23 21:46:22 +00:00
Carl Love
fa4ebebbd7 Fix implementation of the DFP integer operands.
The implementation of integer operands doesn't really match the documentation
for the Iop. Take for example Iop_ExtractExpD64. It is documented as
D64 -> I64 but the implementation of the UNARY is defined as
UNARY(Ity_D64, Ity_D64). The result is an integer that is stored in an integer
format in a floating point register. On the IBM s390 however, the architecture
stores the integer value in a general purpose register (GPR) not a floating
point register. This issue exists with the implementation of 11 Iops where the
PPC implementation has either a source or destination whose value is an integer
but the value is stored in a floating point register in an integer format. After
reviewing the PPC implementation with the s390 developer, it was agreed the
cleanest way to fix this is to change the PPC implementation. The BINOP will be
changed to be consistent with the Iop description. This means the PPC
instruction implementation of the PPC instruction in guest_ppc_toIR.c will need
to reinterpret integer source operands as integers which will move the value
from a floating point register to an integer register before calling binop().
The underlying PPC implementation of the unop() for the specific Iop will also
need to change to move the value from the integer register back to the floating
point register so the native instruction can be issued with the integer value
in a floating point register. It was decided that making the changed in PPC,
rather then having the s390 reinterpret integers as DFP and then move the value
back to an integer register, was preferable as it makes the implementation of
the unop(), binops(), triop() consistent with the definition of the Iop.

This patch also includes the needed changes for the vbit tester.  The Iop
definitions in memcheck/tests/vbit-test/util.c had to be updated to be consitent
with the changes in the Iops as documented below.  Also, the function mkLazy3()
in memcheck/mc_translate.c had to be updated to handle the I32 x I8 x I64 -> I64
and I32 x I8 x I128 -> I128 cases.

The specific list of changes are as follows:

Iop name in pub/libvex_ir.h
   documented type
     type of UNARY/BINARY/TERNARY in priv/ir_defs.c
-------------------------------------------------------

Iop_ExtractExpD64
   D64 -> I64
      UNARY(Ity_D64, Ity_D64); (current)
      UNARY(Ity_D64, Ity_I64); (fix)
 

Iop_ExtractExpD128
   D128 -> I64
       UNARY(Ity_D128, Ity_D64); (current)
       UNARY(Ity_D128, Ity_I64); (fix)

Iop_InsertExpD64
   I64 x I64 -> D64
   I64 x D64 -> D64 (fix definition)
       BINARY(Ity_D64,Ity_D64, Ity_D64); (current)
       BINARY(Ity_I64,Ity_D64, Ity_D64); (fix)

Iop_InsertExpD128
    I64 x I128 -> D128
    I64 x D128 -> D128 (fix definition)
        BINARY(Ity_D64,Ity_D128, Ity_D128); (current)
        BINARY(Ity_I64,Ity_D128, Ity_D128); (fix)

Iop_I64StoD128
    I64S -> D128
        UNARY(Ity_D64, Ity_D128); (current)
        UNARY(Ity_I64, Ity_D128); (fix)

Iop_D64toI64S
    IRRoundingModeDFP(I32) x D64 -> I64
        BINARY(ity_RMode, Ity_D64, Ity_D64) (current)
        BINARY(ity_RMode, Ity_D64, Ity_I64) (fix)

Iop_D128toI64S
    IRRoundingModeDFP(I32) x D128 -> I64
        BINARY(ity_RMode, Ity_D128, Ity_D64); (current)
        BINARY(ity_RMode, Ity_D128, Ity_I64); (fix)

Iop_I64StoD64
    IRRoundingModeDFP(I32) x I64 -> D64
        BINARY(ity_RMode, Ity_D64, Ity_D64); (current)
        BINARY(ity_RMode, Ity_I64, Ity_D64); (fix)

Iop_SignificanceRoundD64
    IRRoundingModeDFP(I32) x I8 x D64 -> D64
        TERNARY(ity_RMode,Ity_D64,Ity_D64, Ity_D64); (current)
        TERNARY(ity_RMode,Ity_I8,Ity_D64, Ity_D64); (fix)

Iop_SignificanceRoundD128
    IRRoundingModeDFP(I32) x I8 x D128 -> D128
         TERNARY(ity_RMode,Ity_D128,Ity_D128, Ity_D128); (current)
         TERNARY(ity_RMode,Ity_I8,Ity_D128, Ity_D128); (fix)

The patch is for bugzilla 311100
VEX Committed revision 2652

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13260
2013-01-22 20:26:34 +00:00
Florian Krohm
bf50824155 s390: Pedantic cleanups by Maran.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13259
2013-01-22 13:59:54 +00:00
Florian Krohm
87dc0e335c Make sure the variable is completely initialised. That's good
practice and also silences a complaint from the Coverity checker.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13258
2013-01-22 00:25:05 +00:00
Philippe Waroquiers
35ee46968d Fix NULL dereference if no integer arg given to monitor block_list cmd
Reported by Florian (spotted by coverity).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13257
2013-01-21 22:05:47 +00:00
Florian Krohm
e0685bc47a Remove pointless test. vts->ts is an array and cannot be NULL.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13256
2013-01-21 20:38:54 +00:00