4356 Commits

Author SHA1 Message Date
Tom Hughes
59d4e2822a Handle IPv6 addresses when reporting open file descriptors.
Based on a patch from Roger Light on BZ#175819.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13836
2014-02-24 15:06:06 +00:00
Mark Wielaard
7f675b0c9b BZ#331380 Syscall param timer_create(evp) points to uninitialised byte(s)
Only check struct sigevent actually used by the kernel. If SIGEV_THREAD_ID
is set check sigev_notify_thread_id, otherwise don't.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13835
2014-02-24 10:38:45 +00:00
Julian Seward
c67214fcb6 Fix incorrect include, spotted by mjw.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13828
2014-02-21 14:56:48 +00:00
Julian Seward
b1b41a45d8 * fix a bug in sys_clone that was causing threads to hang at exit
* enable enough syscalls to be able to run ssh and bash


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13826
2014-02-21 14:51:14 +00:00
Julian Seward
40469b7085 Enable sys_ppoll, sys_kill, sys_socketpair.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13824
2014-02-20 23:20:08 +00:00
Julian Seward
fa2ba0f61a arm64-linux: make restarting of syscalls interrupted by signals work
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13823
2014-02-20 23:18:32 +00:00
Julian Seward
c1cd47aae4 First attempt at supporting sys_clone.
Also enable: sys_exit, sys_nanosleep, sys_madvise.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13822
2014-02-20 17:36:56 +00:00
Mark Wielaard
93d88baa00 Bug 331337 s390x WARNING: unhandled syscall: 326 (dup3)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13820
2014-02-20 15:43:07 +00:00
Dejan Jevtic
3d1369a6e0 mips32: Support for 64bit FPU on MIPS32 platforms.
Tests for 64bit FPU instructions on MIPS32 platforms.
Some mips instructions can cause SIGILL (Illegal instruction),
so we need to add SIGILL signal and a proper handler for that signal.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13817
2014-02-19 11:57:22 +00:00
Florian Krohm
bc1f32fb67 Fix BZ #327212. Check for absolute path name at the end of
expand_file_name -- not at the beginning.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13816
2014-02-19 11:16:00 +00:00
Philippe Waroquiers
68e8bbc426 arm64: implement the apply on all GP register.
This is needed for leak search to work properly/not crash.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13804
2014-02-12 20:50:03 +00:00
Philippe Waroquiers
012e0080ef No need to discard translation in gdbserver when --vgdb=full
is given, as all instructions are in any case instrumented when
full is given.

This is (slightly) more efficient for full, and allows
to bypass the arm64 discard_translation problem caused by unchain
missing


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13802
2014-02-12 20:41:58 +00:00
Philippe Waroquiers
2d3d477689 Fix or implement various things to have V gdbsrv working on arm64
* better handle error recovery when calling remote_desc_activity
  (avoid exhausting safe fd range)
* fix small error in m_gdbserver/README_DEVELOPERS
* implemented mknod and poll syscall on mknodat and ppoll
  (mknod and poll are not directly supported on arm64)
* implement or fix various gdbsrv specific things needed for arm64
* changed assert condition in aspacemgr to VKI_SHMLBA >= VKI_PAGE_SIZE

With these changes, gdbserver integration seems to be basically working.
However, when breakpoints are placed or removed, discard_translations
causes an assert as the unchain has not been implemented yet for arm64 :

    --1118:1:gdbsrv   remove software_breakpoint at addr 0x400DE74 0x400DE74: _dl_debug_state (in /usr/lib64/ld-2.17.so)
    --1118:2:transtab   discard_translations(0x400de74, 2) req by m_gdbserver breakpoint remove
    --1118:2:transtab                       FAST, ec = 27

    vex: priv/main_main.c:1070 (LibVEX_UnChain): Assertion `0' failed.
    vex storage: T total 5480544 bytes allocated
    vex storage: P total 0 bytes allocated

    valgrind: the 'impossible' happened:
       LibVEX called failure_exit().
    ==1118==    at 0x3809E6B8: ??? (in /home/philippe/crossaarch64/trunk/Inst/lib/valgrind/none-arm64-linux)

    sched status:
      running_tid=1

What remains to be done:
  * arm64 xml register description files (allowing shadow registers to be looked at).
  * ptrace invoker : currently disabled for both arm and arm64
  * cpsr transfer to/from gdb to be looked at (see also arm equivalent code)




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13800
2014-02-11 23:50:16 +00:00
Christian Borntraeger
4b8f0be86d - Handle KVM_CREATE_IRQCHIP, which does not take any parameter
and returns 0 or -1.
- white space fixes around the KVM ioctls


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13799
2014-02-11 15:15:31 +00:00
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