4342 Commits

Author SHA1 Message Date
Tom Hughes
1cdbef5fd8 Fix typo in poll wrapper
Patch from Ivo Raisr via BZ#330941


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13795
2014-02-09 11:10:08 +00:00
Tom Hughes
6ef2cbe59d Add support for the clock_adjtime system call.
Based on a patch from Stefan Sørensen on BZ#330469.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13785
2014-01-30 22:33:02 +00:00
Tom Hughes
f1c82feda5 Both eventfd and eventfd2 have post handlers that we were failing
to call on most platforms. Fixes BZ #330459.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13784
2014-01-30 21:47:30 +00:00
Julian Seward
a4af4ac048 arm64: rename guest_SP to guest_XSP so as to avoid a name clash with
guest_SP from s390 world. 


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13776
2014-01-15 10:25:55 +00:00
Julian Seward
68a2a4ce01 Initial implementation of CFI based stack unwinding for arm64-linux.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13774
2014-01-13 00:21:09 +00:00
Julian Seward
3f6d211236 Add support for ARMv8 AArch64 (the 64 bit ARM instruction set).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13770
2014-01-12 12:54:00 +00:00
Philippe Waroquiers
231d67347f add --vgdb-prefix arg to callgrind_control
If valgrind is started with --vgdb-prefix arg, then callgrind_control
cannot find and control this valgrind.
So, add an (optional) argument to callgrind_control,
and have callgrind tool report the needed vgdb prefix argument
if the user supplied this arg.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13769
2014-01-11 13:56:48 +00:00
Tom Hughes
057f9b7069 The value of AT_BASE should be the offset between where the ELF interpreter
expected to be loaded (as expressed in the ELF headers) and where it was
actually loaded, and not (as valgrind was doing) the absolute value of the
load address for the interpreter.

Note that when prelink is not in use the two are normally the same, as the
intpreter (like all shared libraries) is normally linked with a zero load
address. When prelinked that is no longer true.

With that fixed, the hack to patch out AT_BASE to avoid confusing gdb on
systems where prelink is in use is no longer needed.

Fixes BZ#329612


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13768
2014-01-07 22:27:57 +00:00
Dejan Jevtic
423d0643b9 mips32: Adding mips32/Android support to Valgrind.
Necessary changes to Valgrind to support mips32 on Android.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13767
2013-12-27 09:06:55 +00:00
Philippe Waroquiers
c33117f7d6 Fix 325714 Empty vgcore but RLIMIT_CORE is big enough (too big)
Use ULong rather than UInt for coredump file size.

Tested manually by
  ulimit -c 4294967296
  ./vg-in-place ./gdbserver_tests/gone abort
valgrind creates vgcore.xxxxx unusable by GDB.

With the fix, GDB can read the core dump.

Patch from  Romain Geissler



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13762
2013-12-16 22:52:20 +00:00
Philippe Waroquiers
492a8ae2a2 Implement gdbsrv "v.info stats" command giving statistics for valgrind core + tools
* addition of VG_(needs_print_stats) in pub_tool_tooliface.h
* use the above in memcheck and helgrind
* output valgrind stats and calls print_stats in server.c



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13760
2013-12-15 20:24:43 +00:00
Philippe Waroquiers
b330c9fa31 Minor tweak in the VG_(poll) syscall and callers: have a way to show
the error in case the poll syscall unexpectedly fails.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13748
2013-12-05 22:10:55 +00:00
Philippe Waroquiers
45c11d4804 Minor tweak in the vgdb instructions output by valgrind:
to make copy/paste and then editing the command easier,
put the --pid=3393 at the end of the instruction output by valgrind.

So, in gdb command history, one can just recuperate the previous target
command in the history and more easily change the pid.
I.e. have:

target remote | /home/philippe/valgrind/refactor_vgdb/Inst/lib/valgrind/../../bin/vgdb --vgdb-prefix=truc --pid=3393

instead of

target remote | /home/philippe/valgrind/refactor_vgdb/Inst/lib/valgrind/../../bin/vgdb --pid=3393 --vgdb-prefix=truc 



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13747
2013-12-05 20:29:53 +00:00
Philippe Waroquiers
b8ed3a5b65 Fix 326462 Refactor vgdb to isolate invoker stuff into separate module
vgdb.c contained (conditionally compiled) "invoker" code to have ptrace syscalls
used to allow gdb/vgdb to connect to a valgrind process blocked in a syscall.
This "invoker" code is ptrace based.
Not all platforms are using ptrace.
=> refactor vgdb so as allow invoker code to be added more cleanly
for non ptrace based platforms (e.g. Darwin, Solaris).

* add file vgdb.h for:
   - definition of the vgdb-invoker interface
   - common declarations between vgdb.c and vgdb-invoker implementations
* move ptrace related code from vgdb.c to new file vgdb-invoker-ptrace.c
* new file vgdb-invoker-none.c containing an empty invoker implementation
  used on platforms that do not (yet) have a invoker implementation
  (e.g. android and darwin).
* modified Makefile.am to use one of the vgdb-invoker-*.c file depending
  on the platform.
* small changes related to changing ptraceinvoker to invoker in various files:
  gdbserver_tests/make_local_links, gdbserver_tests/nlcontrolc.vgtest,
  gdbserver_tests/mcinvokeRU.vgtest, gdbserver_tests/nlsigvgdb.vgtest  
  gdbserver_tests/mcinvokeWS.vgtest, coregrind/m_gdbserver/README_DEVELOPERS

Patch from Ivo Raisr, slightly modified



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13743
2013-12-01 14:56:28 +00:00
Bart Van Assche
b6afe8ce21 xen: Implement XEN_DOMCTL_set_max_evtchn
This is new in Xen 4.4.

From: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13738
2013-12-01 10:59:07 +00:00
Bart Van Assche
9b1fe961a5 xen: XEN_SYSCTL_debugkeys hypercall
From: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13737
2013-12-01 10:58:38 +00:00
Bart Van Assche
44e8025b78 xen: XEN_SYSCTL_readconsole hypercall
From: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13736
2013-12-01 10:58:11 +00:00
Bart Van Assche
182bf544af xen: XEN_DOMCTL_shadow_op hypercall
And some of the sub-subops.  It is a little hacky given the legacy way of
having several methods of enabling/disbling LOG_DIRTY mode.

From: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13735
2013-12-01 10:57:43 +00:00
Bart Van Assche
b9a87170d6 xen: XEN_DOMCTL_sethvmcontext hypercall
Xen reads 'num' and 'array' from the structure, and reads the entire buffer.
Nothing gets written back.

From: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13734
2013-12-01 10:57:14 +00:00
Bart Van Assche
7447bdac9b xen: XEN_DOMCTL_getpageframeinfo3 hypercall
Xen reads 'num' and the 'array' pointer from ARG1, and proceeds to read and
modify-in-place the entire userspace array.

From: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13733
2013-12-01 10:56:28 +00:00
Bart Van Assche
c798ab2b61 xen: XEN_DOMCTL_gethvmcontext hypercall
The semantics of XEN_DOMCTL_gethvmcontext are little interesting.

If the 'buffer' field of the structure is NULL, the hypercall is a request for
the required buffer size, which written into the 'size' paramater.

If 'buffer' is non NULL, Xen will write to the buffer, and update 'size' with
the amount of data written.

From: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13732
2013-12-01 10:55:54 +00:00
Bart Van Assche
fc2f8ac0e0 xen: XENMEM_remove_from_physmap hypercall
Xen reads the entire structure and writes nothing.

From: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13731
2013-12-01 10:55:13 +00:00
Bart Van Assche
2bd24b6ef5 xen: XENMEM_add_to_physmap hypercall
Xen reads the entire structure, and if the space is _gmfn, will write the
structure back

From: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13730
2013-12-01 10:54:42 +00:00
Bart Van Assche
7f1b1eb0fb xen: XENMEM_machphys_mfn_list hypercall
The XENMEM_machphys_mfn_list implementation reads 'max_extents' and
'extents_start'.  It writes to the array at 'extents_start', and writes the
number of extents written into the 'nr_extents' field.

From: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13729
2013-12-01 10:54:06 +00:00
Bart Van Assche
8d61cb581e xen: XENMEM_maximum_gpfn hypercall
Xen reads a 16 bit domid from the pointer provided in ARG2, but does not write
anything back.

From: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13728
2013-12-01 10:53:34 +00:00
Bart Van Assche
3e4e3ebac0 xen: XENMEM_maximum_ram_page hypercall
Xen does not read or write any memory for this hypercall

From: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13727
2013-12-01 10:53:05 +00:00
Bart Van Assche
b848d83815 xen: Infratructure for XEN_TMEM_* hypercalls
and an implementation of XEN_TMEM_control save_begin.

Xen will read various fields at various time, but write nothing back for a
save_begin subop.

From: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13726
2013-12-01 10:52:22 +00:00
Bart Van Assche
bbbdd846be xen: Fix XEN_SYSCTL_getdomaininfolist for version 0xa
From: Andrew Cooper <andrew.cooper3@citrix.com>

Also add a default case so future bumps of the sysctl interface version dont
result in spurious passes of the IOCTL handler.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13725
2013-12-01 10:51:19 +00:00
Mark Wielaard
98a63bf1d4 Bug 327916 - DW_TAG_typedef may have no name
We already accepted DW_TAG_typedef without a name for Ada. But g++ for
OpenMP can also emit such nameless DW_TAG_typedefs. Just accept them.
Also fix up anonymous enum and typedef printing in tytypes.c.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13718
2013-11-24 17:19:35 +00:00
Mark Wielaard
e622570ce0 dwz compressed alternate .debug_info and .debug_str not read correctly.
Bug #327837. The buildid from the .gnu_debugaltlink section was parsed
incorrectly (from the wrong offset). Causing the debug alt file not to
be found.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13715
2013-11-20 11:54:38 +00:00
Dejan Jevtic
c8213ce37a mips32/64: Fix the problem with cacheflush on mips platforms.
On mips platforms the second cacheflush parameter is the number
of bytes in cache that needs to be flushed. When we are discarding
translation we need to use this number instead of:
((ULong) ARG2) - ((ULong) ARG1) + 1ULL
This patch also include syscall wrapper for __NR_sigaction on mips32.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13707
2013-10-31 16:58:31 +00:00
Philippe Waroquiers
14a60a028b In an inner valgrind, register the interim stack earlier
The "late" registration of the interim stack is causing false
positive non addressable memcheck errors in x86.

Registering the interim stack earlier avoids these false positive.

Note however that this is just a bypass for the problem.

I believe there is a more fundamental problem in m_stacks.c stack handling:
In case a thread is switching of stack while the new stack is not yet
registered, the stack switching code will keep the old stack as current stack,
as the stack corresponding to the new sp cannot be found.
In such a case, the zone between the old and new SP in this unknown stack
can be marked either as addressable (if unknown stack is growing)
or unaddressable (if unknown stack is shrinking).
Then at some point in time, the new stack is registered.
If just after that, the sp is changed so as to grow the stack
by nr of bytes not determinable at translation time, VG_(unknown_SP_update)
will be called, will detect the stack switch and will do nothing.
This leaves a certain zone of the stack (the grown zone) in a not
addressable state, as the stack switch code has in fact wrongly
guessed a stack switch, while in fact what should have been detected
is just a sp change in a stack previously unknown.

Proper fixes might be: 
 1. in "IF_STACK_SWITCH_SET_current_stack_AND_RETURN", do not return
    if old and new sp are in the stack stack.
    rather continue so as to execute correctly the sp change in
    the newly discovered stack.
and/or
 2. in the stack registration code (client request), if the current SP
    is inside the stack being registered, also set the current stack
    to the just registered stack pointer

None of these fixes are being looked at currently, as such changes looks
too adventurous close to 3.9.0



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13674
2013-10-22 21:20:14 +00:00
Philippe Waroquiers
81d7bfddde Fix 324227 memcheck false positive leak when a thread calls exit+block
only reachable via other thread live register

The exiting thread will have its registers considered as not reachable
anymore, registers of other threads will be considered reachable.

This is ensured by using a different exit reason for the
exiting thread and for the other threads.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13670
2013-10-21 19:57:08 +00:00
Philippe Waroquiers
fbe834ff1a unbreak (future) Mac OS 10.9, 11.0, ... builds
Disappeared syscalls are better 
  #ifdef-ed with "< version_in_which_they_disappear"

Newly appeared syscalls are better
  #ifdef-ed with ">= version_in_which_they_appear"



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13669
2013-10-21 18:39:01 +00:00
Julian Seward
6abdeda828 Enable sys_rt_sigsuspend on ppc64-linux. Not sure why this is
necessary, but I found it lying around in a ppc64 tree, so there
was probably some use case at some point.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13668
2013-10-21 10:07:43 +00:00
Julian Seward
4a9b50efe7 Un-break the build on OSX 10.7.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13659
2013-10-18 14:45:29 +00:00
Julian Seward
dbf9b63605 Update copyright dates (20XY-2012 ==> 20XY-2013)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13658
2013-10-18 14:27:36 +00:00
Julian Seward
682b7211e6 arm-linux only: make unwinding by stack scanning (a nasty hack)
be controllable from the command line.  Fixes (kind of) #289578.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13657
2013-10-18 13:21:26 +00:00
Mark Wielaard
e671b086cf Don't report BMI support when AVX support is missing.
Bug #326113. This is a bit conservative, but it is what the linux kernel
also seems to be doing. If AVX support is missing (because the OS doesn't
save the wide registers), then also don't report supporting BMI.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13656
2013-10-18 13:11:05 +00:00
Julian Seward
ab319a7e24 Followup to r13652 (make the translation cache size be command-line
controllable): reduce MAX_N_SECTORS to 24, speed up Sector
initialisation, wording tweaks.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13655
2013-10-18 11:18:45 +00:00
Philippe Waroquiers
61b8b9617b Allow the user to dimension the translation cache
A previous commit had decreased to 6 (on android) and increased to 16
(other platforms) the nr of sectors in the translation cache.
This patch adds a command line option to let the user specify
the nr of sectors as e.g. 16 sectors might be a lot and cause
an out of memory for some workloads or might be too small for
huge executable or executables using a lot of shared libs.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13652
2013-10-18 00:08:20 +00:00
Philippe Waroquiers
619be966db Allow tools to provide some statistics in suppression list produced at the end
Option -v outputs a list of used suppressions. This only gives
the nr of times a suppression was used.
For a leak search, this only gives the nr of loss records that
have been suppressed, but it does not give additional needed details
to understand more precisely what has been suppressed
(i.e. nr of blocks and nr of bytes).

=> Add in the tool interface update_extra_suppression_use and
print_extra_suppression_info functions to allow the tool to record
additioonal use statistics for a suppression. These statistics
can be done depending on the error (and its data) which is suppressed.

Use this in memcheck for the leak suppressions, to maintain and output
the nr of blocks and bytes suppressed by a suppression during
the last leak search.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13651
2013-10-17 22:10:41 +00:00
Dejan Jevtic
5c16367f0c mips64: Fix compiler warning.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13650
2013-10-16 14:15:38 +00:00
Julian Seward
4fc45578f6 Disallow client mmap calls with MAP_32BIT as a flag.
Fixes, or at least addresses, #324181.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13644
2013-10-14 14:50:57 +00:00
Julian Seward
5f16bea2a7 Fix "Assertion '!di->soname' failed" on weird files.
Fixes #320661.  (Jiří Hruška, jirka@fud.cz)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13640
2013-10-14 12:02:15 +00:00
Julian Seward
3fd8c455b3 Enable sys_prlimit64 on arm-linux. Fixes #320131.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13639
2013-10-14 11:51:43 +00:00
Julian Seward
e4e2d388da PPC32/64: Allow 16 byte icache and dcache lines.
Partial fix for #308135.  (christophe.leroy@c-s.fr)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13637
2013-10-14 11:41:46 +00:00
Florian Krohm
d0ff47dfcc Remove unused variable (and associated compiler warning).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13625
2013-10-07 20:25:17 +00:00
Dejan Jevtic
961e487650 mips64: add extra Iop cases in VEX and fix compiler
warning.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13624
2013-10-07 10:27:31 +00:00
Philippe Waroquiers
3e5f78f04d pub_tool_oset.h and m_oset.c cleanup
* Remove dead code in m_oset.c VG_(OSetGen_ResetIterAt)
  The code at the end of VG_(OSetGen_ResetIterAt) was unreachable
  (detected by BEAM checker).
  Looking at SVN, the initial commit of VG_(OSetGen_ResetIterAt)
  already contained this deadcode.

* pub_tool_oset.h was wrongly indicating that signed words could
  be used for fast cmp oset.

* modified memcheck/tests/unit_oset.c to test VG_(OSetGen_ResetIterAt)

* modified memcheck/tests/unit_oset.c to not use signed words
  (it was previously using signed words, but only with positive values)





git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13622
2013-10-06 16:35:35 +00:00