Commit Graph

4939 Commits

Author SHA1 Message Date
Florian Krohm
4dbe16f4cf Function is_plausible_guest_addr should also consider SkShmC
segments.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15222
2015-05-13 08:11:56 +00:00
Florian Krohm
463aa75635 In functions VG_(am_relocate_nooverlap_client) and VG_(am_extend_map_client)
need to allow SkShmC segments, too.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15221
2015-05-12 21:52:08 +00:00
Florian Krohm
c000459632 Fix bug in do_mremap. Also need to allow SkShmC segments.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15219
2015-05-12 21:19:25 +00:00
Philippe Waroquiers
a13ea37999 Add back vg_assert(xa); that was removed by error in r15211
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15215
2015-05-11 21:02:00 +00:00
Philippe Waroquiers
73266b0930 Micro-optimisation following helgrind secmap gc
Checking the range in indexXA can be done with one comparison.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15211
2015-05-11 19:41:43 +00:00
Rhys Kidd
6e3d1f9b0a Fix typo in task_policy_set() output. n-i-bz.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15210
2015-05-11 13:24:42 +00:00
Rhys Kidd
fc04f5d4c6 OS X task_info: UNKNOWN task message [id 3405, to mach_task_self(), reply 0x........]
bz#254164

Before:

== 593 tests, 234 stderr failures, 22 stdout failures, 0 stderrB failures, 0 stdoutB failures, 30 post failures ==

After:

== 593 tests, 233 stderr failures, 22 stdout failures, 0 stderrB failures, 0 stdoutB failures, 30 post failures ==


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15209
2015-05-11 13:19:48 +00:00
Philippe Waroquiers
4fd2651558 Improves the way arena statistics are shown
The mmap'd max/curr and max/curr nr of bytes will be shown e.g. as
   11,440,408/    4,508,968 
instead of
     11440656/ 4509200 

So, using more space, but more readable (in particular when the
nr exceeds the width, and so are not aligned anymore)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15208
2015-05-10 22:40:38 +00:00
Florian Krohm
7548da2acb Simplify is_valid_for taking advantage of the fact that SegKinds
are one-hot encoded.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15201
2015-05-10 11:07:06 +00:00
Philippe Waroquiers
bd9e34096e Add some cfi directives in the code doing syscall (by Valgrind).
This allows to attach to Valgrind when VAlgrind is blocked in a syscall
and have GDB producing a stacktrace, rather than being unable
to unwind.
I.e. instead of having:
  (gdb) bt
  #0  0x380460f2 in do_syscall_WRK ()
  (gdb) 
with the directives, we obtain:
   (gdb) bt
   #0  vgPlain_mk_SysRes_x86_linux (val=1) at m_syscall.c:65
   #1  vgPlain_do_syscall (sysno=168, a1=944907996, a2=1, a3=4294967295, a4=0, a5=0, a6=0, a7=0, a8=0) at m_syscall.c:791
   #2  0x38031986 in vgPlain_poll (fds=0x385226dc <remote_desc_pollfdread_activity>, nfds=1, timeout=-1) at m_libcfile.c:535
   #3  0x3807479f in vgPlain_poll_no_eintr (fds=0x385226dc <remote_desc_pollfdread_activity>, nfds=1, timeout=-1)
       at m_gdbserver/remote-utils.c:86
   #4  0x380752f0 in readchar (single=4096) at m_gdbserver/remote-utils.c:938
   #5  0x38075ae3 in getpkt (buf=0x61f35020 "") at m_gdbserver/remote-utils.c:997
   #6  0x38076fcb in server_main () at m_gdbserver/server.c:1048
   #7  0x38072af2 in call_gdbserver (tid=1, reason=init_reason) at m_gdbserver/m_gdbserver.c:721
   #8  0x380735ba in vgPlain_gdbserver (tid=1) at m_gdbserver/m_gdbserver.c:788
   #9  0x3802c6ef in do_actions_on_error (allow_db_attach=<optimized out>, err=<optimized out>) at m_errormgr.c:532
   #10 pp_Error (err=0x61f580e0, allow_db_attach=1 '\001', xml=1 '\001') at m_errormgr.c:644
   #11 0x3802cc34 in vgPlain_maybe_record_error (tid=1643479264, ekind=8, a=2271560481, s=0x0, extra=0x62937f1c)
       at m_errormgr.c:851
   #12 0x38028821 in vgMemCheck_record_free_error (tid=1, a=2271560481) at mc_errors.c:836
   #13 0x38007b65 in vgMemCheck_free (tid=1, p=0x87654321) at mc_malloc_wrappers.c:496
   #14 0x3807e261 in do_client_request (tid=1) at m_scheduler/scheduler.c:1840
   #15 vgPlain_scheduler (tid=1) at m_scheduler/scheduler.c:1406
   #16 0x3808b6b2 in thread_wrapper (tidW=<optimized out>) at m_syswrap/syswrap-linux.c:102
   #17 run_a_thread_NORETURN (tidW=1) at m_syswrap/syswrap-linux.c:155
   #18 0x00000000 in ?? ()
   (gdb) 




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15194
2015-05-08 21:37:18 +00:00
Tom Hughes
2799d8f88a Add support for the syncfs system call.
Based on patch from j@eckel.me on BZ#347389.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15191
2015-05-07 18:54:31 +00:00
Carl Love
8933335653 Patch 1 in a series of cleanup patches from Will Schmidt
Update ifdefs around the bogus-LR-value-handling code to allow ppc64le to
behave as ppc64 (BE) does.

This fixes the overlap test case, where the stack unwinding code was
otherwise coming up with bad instruction pointers.
    
This patch fixes Vagrind bugzilla 347322.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15183
2015-05-06 19:18:28 +00:00
Florian Krohm
fa0d7aa5c6 Simplify. The condition on line 1223 is always true.
Here's why:

The condition

 if (VG_(brk_limit) > VG_(brk_base))   line 1223

is reachable iff 

  newbrk < VG_(brk_base)  on line 1201  is false  AND
  newbrk < VG_(brk_limit) on line 1205  is true

Rewrite as

  newbrk >= VG_(brk_base)    is true  AND
  newbrk <  VG_(brk_limit)   is true

Rewrite as

  newbrk >= VG_(brk_base)        is true  AND
  newbrk <= VG_(brk_limit) - 1   is true

Combine

  VG_(brk_base) <= newbrk <= VG_(brk_limit) - 1

Therefore

  VG_(brk_base) <= VG_(brk_limit) - 1

Or

  VG_(brk_base) < VG_(brk_limit)

Which is the same as

  VG_(brk_limit) > VG_(brk_base)

qed.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15181
2015-05-05 06:14:10 +00:00
Philippe Waroquiers
d31115a1d4 One more msg to use 'mmap-ed ANONYMOUS' wording
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15180
2015-05-04 20:00:49 +00:00
Philippe Waroquiers
109b2f9417 * Out of memory message was using 'bytes have already been allocated.'
while this nr is in fact the total anonymously mmap-ed.
  Change the message so as to reflect the shown number.
* Show also the total anonymous mmaped in non OOM memory statistics



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15177
2015-05-03 21:48:13 +00:00
Philippe Waroquiers
4256a17920 This patch adds a function that allows to directly properly size an xarray
when the size is known in advance.

3 places identified where this function can be used trivially.

The result is a reduction of 'realloc' operations in core
arena, and a small reduction in ttaux arena
(it is the nr of operations that decreases, the memory usage itself
stays the same (ignoring some 'rounding' effects).

E.g. for perf/bigcode 0, we change from
  core 1085742/ 216745904 totalloc-blocks/bytes,     1085733 searches
  ttaux 5348/   6732560 totalloc-blocks/bytes,        5326 searches
to
  core 712666/ 190998592 totalloc-blocks/bytes,      712657 searches
  ttaux 5319/   6731808 totalloc-blocks/bytes,        5296 searches

For bz2, we switch from
  core 50285/  32383664 totalloc-blocks/bytes,       50256 searches
  ttaux 670/    245160 totalloc-blocks/bytes,         669 searches
to
  core 32564/  29971984 totalloc-blocks/bytes,       32535 searches
  ttaux 605/    243280 totalloc-blocks/bytes,         604 searches

Performance wise, on amd64, this improves memcheck performance
on perf tests by 0.0, 0.1 or 0.2 seconds depending on the test.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15173
2015-05-01 16:46:38 +00:00
Rhys Kidd
9fe1f89425 Fix aspacem segment mismatch: seen with none/tests/bigcode
bz#345824

Tested on OS X 10.9 and OS X 10.10.

Before:

== 595 tests, 237 stderr failures, 23 stdout failures, 0 stderrB failures, 0 stdoutB failures, 31 post failures ==

After:

== 595 tests, 236 stderr failures, 22 stdout failures, 0 stderrB failures, 0 stdoutB failures, 31 post failures ==


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15171
2015-05-01 06:29:51 +00:00
Florian Krohm
b6251821a1 Remove a few embarassing comments.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15169
2015-04-30 20:44:17 +00:00
Florian Krohm
307f73e22b Fix the namespace of the functions dealing with segment names.
As those are private to the address space manager they should
be ML_ not VG_ prefixed.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15165
2015-04-30 17:34:04 +00:00
Julian Seward
47f7612998 DW_CFA_def_cfa_expression: don't push the CFA on the stack before
evaluation starts.  For DW_CFA_val_expression and DW_CFA_expression
doing so is correct, but not for DW_CFA_def_cfa_expression.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15160
2015-04-30 11:45:13 +00:00
Julian Seward
a9b9383bcc Fix intermittent build error on aarch64-linux caused by inadequate
alignment for some data symbols.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15157
2015-04-29 20:48:48 +00:00
Florian Krohm
97b35b97f6 Issue an error message if then brk segment overflows.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15155
2015-04-29 12:59:16 +00:00
Florian Krohm
1322e9be35 Use error exit code when bailing out.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15153
2015-04-28 18:46:33 +00:00
Florian Krohm
748d43b662 Fix fallout from r15138: build error on Darwin due to renamed function.
Fixes BZ #346801.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15149
2015-04-27 17:28:15 +00:00
Florian Krohm
a0bc5cba58 Remove magic constant. Use LibVEX_GUEST_STATE_ALIGN instead.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15148
2015-04-27 14:28:28 +00:00
Florian Krohm
7681c4e4e0 Follow up on VEX r3144 and remove VexGuestTILEGXStateAlignment.
Also fix the alignment check which should be mod 16 not mod 8.
Well, actually, it should be mod LibVEX_GUEST_STATE_ALIGN but
that is another patch.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15147
2015-04-27 14:26:26 +00:00
Florian Krohm
11309294c4 Fix an outdated comment as pointed out in BZ #211256.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15146
2015-04-27 14:04:52 +00:00
Florian Krohm
b1d6b96f07 Fix BZ #342683. Based on patch by Ivo Raisr.
What this does is to make sure that the initial client data segment
is marked as unaddressable. This is consistent with the behaviour of
brk when the data segment is shrunk. The "freed" memory is marked
as unaddressable.
Special tweaks were needed for s390 which was returning early from
the funtion to avoid sloppy register definedness initialisation.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15144
2015-04-25 18:23:21 +00:00
Florian Krohm
e0927ca1ea Fix the writev / readv wrappers. Do not read the array pointed to
by the 2nd argument, if the element count is negative.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15143
2015-04-25 18:14:17 +00:00
Philippe Waroquiers
f6ab65fc2a Replace adler32 by sdbm_hash in m_deduppoolalloc.c
adler32 is not very good as a hash function.
sdbm_hash gives more different keys that adler32,
and in a large majority of the cases, shorter chains.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15142
2015-04-25 14:53:35 +00:00
Philippe Waroquiers
0543df0e12 Give statistics about RCEC helgrind hash table chains.
Improve statistic in coregrind hash table


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15141
2015-04-25 14:00:24 +00:00
Florian Krohm
7dc618ae86 Check for any client stack segment. Rule out valgrind segments.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15140
2015-04-24 10:05:23 +00:00
Florian Krohm
9d3d254a8b Fix an assertion in the address space manager. BZ #345887.
The VG_(extend_stack) call needs to be properly guarded because the
passed-in address is not necessarily part of an extensible stack
segment. And an extensible stack segment is the only thing that
function should have to deal with.
Previously, the function VG_(am_addr_is_in_extensible_client_stack)
was introduced to guard VG_(extend_stack) but it was not added in all
places it should have been.

Also, extending the client stack during signal delivery (in sigframe-common.c)
was simply calling VG_(extend_stack) hoping it would do the right thing.
But that was not always the case. The new testcase 
none/tests/linux/pthread-stack.c exercises this (3.10.1 errors out on it).

Renamed ML_(sf_extend_stack) to ML_(sf_maybe_extend_stack) and add
proper guard logic for VG_(extend_stack).

Testcases none/tests/{amd64|x86}-linux/bug345887.c by Ivo Raisr.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15138
2015-04-23 15:20:00 +00:00
Mark Wielaard
04f8bc3793 Enable rt_sigpending syscall on ppc64 linux.
Patch from Thomas Huth <thuth@redhat.com>

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15133
2015-04-22 15:29:03 +00:00
Florian Krohm
2d01f78684 Rename VG_(am_is_bogus_client_stack_pointer) to
VG_(am_addr_is_in_extensible_client_stack).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15132
2015-04-22 14:16:11 +00:00
Florian Krohm
3e50adbd1c Fix a silly bug.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15131
2015-04-22 13:50:13 +00:00
Philippe Waroquiers
d6c0fde7fe Move a comment useful to the caller to the .h, rather than keeping it
in the .c



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15127
2015-04-21 20:56:49 +00:00
Bart Van Assche
44609129ea Add support for LL_IOC_PATH2FID and LL_IOC_GETPARENT Lustre ioctls
From: Frank Zago <fzago@cray.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15123
2015-04-21 17:46:52 +00:00
Florian Krohm
eee95ccc03 Use the proper function.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15118
2015-04-20 21:13:03 +00:00
Florian Krohm
fd55c4421f Remove SysRes::_valEx from common code as it is specific to mips.
ifdef'ed accordingly.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15117
2015-04-20 21:02:18 +00:00
Florian Krohm
a9b8e1e789 Remove function sr_ResHI from Linux specific code.
Add function VG_(sr_as_string).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15116
2015-04-20 20:42:42 +00:00
Florian Krohm
65832be442 Update tilegx's do_clone function adopting the stack bound changes
made in r14392.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15115
2015-04-20 17:00:02 +00:00
Philippe Waroquiers
7aee63c33e Ensure we print the memory statistics with the default verbosity,
when giving --stats=yes


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15114
2015-04-19 17:56:42 +00:00
Philippe Waroquiers
9d18c8ddd0 fix 346307 fuse filesystem syscall deadlocks
Mark 2 additional syscalls as 'mayblock' when fuse-compatible hint
is given.
Patch from aozgovde@ralota.com



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15112
2015-04-19 12:39:33 +00:00
Florian Krohm
8d5672dbd6 Remove a few unneeded header files.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15111
2015-04-18 17:45:34 +00:00
Florian Krohm
8291138a99 Fix a comment.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15110
2015-04-18 17:41:31 +00:00
Florian Krohm
d1a1c32462 Factor out the 'extend' function. We only need one version for Linux and
one for Darwin. Down from 11. 
Carve out a new function 'track_frame_memory' that communicates to the
tool the allocation of a new stack frame. This was slightly different on
Linux and Darwin but should be the same on both platforms.
New files: priv_sigframe.h and sigframe-common.c


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15109
2015-04-18 10:33:54 +00:00
Florian Krohm
789084fb99 Followup to r15101. Remove pointless cast. The castee already
has that type.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15104
2015-04-17 08:56:11 +00:00
Carl Love
a10fc36f9f Fix the compiler warning about casting the arguments to the functions
LibVEX_GuestPPC64_get_CR() and LibVEX_GuestPPC64_get_XER(). 

The bugzilla for this issue is 346267.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15101
2015-04-16 16:25:29 +00:00
Florian Krohm
74d8930a26 Fix function call: 1st argument is the thread id.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15100
2015-04-15 21:45:57 +00:00