Commit Graph

4237 Commits

Author SHA1 Message Date
Dejan Jevtic
886fffc9bd mips64: Correct the value for the VG_MIN_MALLOC_SZB
The VG_MIN_MALLOC_SZB was incorrectly defined for MIPS64.
The incorrect value was 8 and the correct value is 16.
Fixes massif/tests/big-alloc for MIPS64.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13455
2013-07-17 08:51:53 +00:00
Petar Jovanovic
f05ecb22f8 mips32/mips64: Avoid breakpoints in branch delay slots
Reusing parts of Chris Dearman's change in GDB to avoid placing breakpoints
in a branch delay slot.
Fixes gdbserver_tests/mcbreak for MIPS32 and MIPS64.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13451
2013-07-13 23:50:46 +00:00
Petar Jovanovic
302ca71a6a mips32: another VG_(am_get_advisory) needs non-single-page-size adjustment
Another mmap issue in which another VG_(am_get_advisory) needs adjustment
wrapper for cases when (VKI_SHMLBA > VKI_PAGE_SIZE) and argument is
VKI_MAP_SHARED.

Fix by DejanJ for Bug #320057.
Issue and the test case by Vasile Floroiu.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13450
2013-07-12 15:32:27 +00:00
Mark Wielaard
fe9acdded4 Bug 321969. Support [lf]setxattr on ppc32 and ppc64 linux kernel.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13449
2013-07-05 09:50:26 +00:00
Mark Wielaard
defd29702f Bug 321738 Add manpages for vgdb and valgrind-listener.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13443
2013-07-03 10:00:19 +00:00
Julian Seward
4fe9a30352 Merge r13421:HEAD from branches/DISRV. This merges the debuginfo-server
stuff into the trunk.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13440
2013-07-02 08:07:15 +00:00
Julian Seward
4506ba7258 Minor improvements in debug printing for stabs reading.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13439
2013-07-02 07:11:14 +00:00
Bart Van Assche
7e6e7ae4d1 [PATCH 4/4] xen: VKI_XENMEM_get_sharing_{freed, shared}_pages hypercall (#321065)
From: Andrew Cooper <andrew.cooper3@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13438
2013-06-30 07:59:50 +00:00
Bart Van Assche
8650980ea8 [PATCH 3/4] xen: VKI_XEN_SYSCTL_sched_id hypercall (#321065)
From: Andrew Cooper <andrew.cooper3@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13437
2013-06-30 07:59:09 +00:00
Bart Van Assche
bbe2f19d40 [PATCH 2/4] xen: update for interface changes in Xen 4.3 release (#321065)
From: Ian Campbell <ian.campbell@citrix.com>



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13436
2013-06-30 07:58:19 +00:00
Bart Van Assche
c46c27fd34 [PATCH 1/4] xen: distinguish the various fields of the Xen privcmd ioctls in the logging (#321065)
From: Ian Campbell <ian.campbell@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13435
2013-06-30 07:57:35 +00:00
Julian Seward
931af9d057 Make the ppc64-linux .opd-reading machinery work in the new framework.
git-svn-id: svn://svn.valgrind.org/valgrind/branches/DISRV@13434
2013-06-29 08:38:37 +00:00
Mark Wielaard
efcfc55b37 Bug 289360 parse_type_DIE confused by DW_TAG_enumeration_type.
GCC allows incomplete enums as GNU extension.
http://gcc.gnu.org/onlinedocs/gcc/Incomplete-Enums.html
These are marked as DW_AT_declaration and won't have a size.
They can only be used in declaration or as pointer types.
You can't allocate variables or storage using such an enum type.
So don't require a size for such enum types.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13433
2013-06-28 14:03:58 +00:00
Julian Seward
a2e5d25994 Exit a bit more gracefully if a request to get part of an image
exceeds the allowable range.  With this change, it should be
essentially impossible to crash V by feeding it invalid ELF or Dwarf.



git-svn-id: svn://svn.valgrind.org/valgrind/branches/DISRV@13432
2013-06-27 20:31:36 +00:00
Julian Seward
e3116970fd Minimal changes needed to make this suitable for trunk:
* add a new flag --allow-mismatched-debuginfo to override the
  CRC32/build-id checks, if needed

* tidy up logic for finding files on the --extra-debuginfo-path
  and at the --debuginfo-server

* don't assert if connection to the debuginfo server is lost;
  instead print a reasonable message and quit.



git-svn-id: svn://svn.valgrind.org/valgrind/branches/DISRV@13431
2013-06-27 17:39:15 +00:00
Julian Seward
d14f385579 Connect up the Mach-O reader to the new DiImage abstractions.
git-svn-id: svn://svn.valgrind.org/valgrind/branches/DISRV@13430
2013-06-25 12:42:52 +00:00
Philippe Waroquiers
da19b5f43e improve --help for --main-stacksize and supported ARM cpu
If the command line option --main-stacksize is not used,
the current ulimit value is used, with a min of 1MB
and a max of 16MB. Document this min/max default formula
in the --help.

Also indicate that Valgrind supports ARMv7


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13426
2013-06-12 21:45:39 +00:00
Julian Seward
5ab0775dc8 Improve performance of CRC32 computations for files in the local filesystem.
git-svn-id: svn://svn.valgrind.org/valgrind/branches/DISRV@13425
2013-06-10 08:34:26 +00:00
Julian Seward
68c9403938 Initial code for remote debuginfo server. Handles all ELF/Dwarf{2,3,4}
on Linux.  No Dwarf1, no Stabs, and MacOSX probably won't build.


git-svn-id: svn://svn.valgrind.org/valgrind/branches/DISRV@13423
2013-06-07 16:15:48 +00:00
Petar Jovanovic
3c8aeab70e mips64: add cases in wrappers for ptrace calls with GETREGSET
Add cases for PTRACE_GETREGSET in PRE(sys_ptrace) and POST(sys_ptrace).

This fixes memcheck/tests/linux/getregset on MIPS64 platforms with kernel
that supports ptrace call with PTRACE_GETREGSET.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13418
2013-06-03 15:33:09 +00:00
Philippe Waroquiers
ac56e88053 fix 320211 Stack buffer overflow in ./coregrind/m_main.c with huge TMPDIR
* Addition of a function to compute size of buffer needed for VG_(mkstemp)
* Use it to dimension buffers for all VG_(mkstemp) calls.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13409
2013-05-26 21:09:20 +00:00
Mark Wielaard
6fd4d3b541 Don't break platforms without AF_BLUETOOTH.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13405
2013-05-22 10:37:52 +00:00
Mark Wielaard
86f74d6026 Support Linux kernel AF_BLUETOOTH for bind().
Bug #320116. sockaddr_rc might contain some padding which might not be
initialized. Explicitly check the sockaddr_rc fields are set. That also
produces better diagnostics about which field is unitialized.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13404
2013-05-22 10:21:10 +00:00
Mark Wielaard
d4513c94f0 Support PTRACE_GET/SET_THREAD_AREA on x86.
BZ#320063.  (Josh Stone, jistone@redhat.com)

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13403
2013-05-22 10:21:08 +00:00
Petar Jovanovic
c116ce3d06 mips: enable syscalls prlimit64, process_vm_readv, process_vm_writev
Enable wrappers for syscalls prlimit64, process_vm_readv, process_vm_writev,
needed by the following tests:

- none/tests/rlimit64_nofile and
- none/tests/process_vm_readv_writev.

The change also adds definitions for several system calls for MIPS64.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13400
2013-05-14 14:13:15 +00:00
Florian Krohm
30f32f46d2 s390: valgrind side support for PFPO. New hwcap added.
See companion patch VEX r2719.

Patch by Maran Pakkirisamy (maranp@linux.vnet.ibm.com).
Part of fixing BZ #307113


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13387
2013-05-11 15:05:04 +00:00
Philippe Waroquiers
2ce4aedfab fix 319235 --db-attach=yes is broken with Yama ptrace scoping enabled
On Ubuntu systems, ptrace_scoping could forbid a process to ptrace another.
This ptrace scoping was already handled for vgdb by using SET_PTRACER
(the valgrind process must be ptraced by vgdb when it is blocked
in a syscall).
set_ptracer is however also needed when the old mechanism --db-attach=yes
is used.
The following changes are done:
* make the set_ptracer logic callable outside gdbserver
* make set_ptracer less restrictive (i.e. allow all
  processes of the user to ptrace). This removes a limitation for vgdb.
* call the set_ptracer in the child launched for --db-attach=yes
* cleaned up the ptrace scope restriction message and doc as vgdb
  is now working properly by default, even with ptrace_scope enabled.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13384
2013-05-09 21:29:23 +00:00
Carl Love
7c6281ffb8 Add syscall suport for system calls sys_mbind, sys_set_mempolicy and
sys_get_mempolicy.

This patch add support for the PPC64 sytem calls:
        259 - sys_mbind
	260 - sys_get_mempolicy
	261 - sys_set_mempolicy

This patch also adds the Add syscall 259, sys_mbind, support for the PPC32
platform.

The patch fixes bugzilla 318932.

Signed-off-by: Carl Love <cel@us.ibm.com>
---


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13383
2013-05-07 15:47:35 +00:00
Philippe Waroquiers
bd849e11cf fix gdbsrv inferior calls when PT_GNU_STACK declares stack not executable
With rev 13368, Valgrind obeys PT_GNU_STACK making the stack not
executable. This makes inferior function call with GDB >= 7.5 failing,
as GDB places a breakpoint on the stack, which must be decoded
and translated by Valgrind to have the inferior function call properly done.
=> introduce a special case in the conditions to allow translation
when a segment is not executable but is readable and there is a
breakpoint at the address.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13381
2013-05-02 22:06:31 +00:00
Petar Jovanovic
1fb2e817bb mips: fixup blksys_restart address for mips64
Restart logic has changed in kernel, this is counterpart in Valgrind.

This change fixes:

none/tests/syscall-restart1
none/tests/syscall-restart2

for mips64.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13379
2013-04-26 19:01:04 +00:00
Julian Seward
4811687de2 Increase size of the CIEs array to 5000.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13378
2013-04-26 08:59:40 +00:00
Julian Seward
d4e4244597 Android's elf.h doesn't have PT_GNU_STACK (sigh) and so r13368 broke
the build.  This conditionalises that fragment on the present of
PT_GNU_STACK.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13375
2013-04-22 09:57:01 +00:00
Petar Jovanovic
c159bbeb8a Calculate offsets in read_dwarf2_lineblock based on is64
Reading header length and values in external line info was incorrect at
some places as it used offsets based on dw64 that came from .debug_info.
Instead, offsets should be calculated based on is64 from .debug_line.
This issue surfaced in MIPS64 port, and it was discussed at:

https://bugs.kde.org/show_bug.cgi?id=313267#c20


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13373
2013-04-19 15:23:44 +00:00
Mark Wielaard
1156c98b80 Simplify read_unitinfo_dwarf2. Only try to read the first DIE.
Bug #305513. We should only read the first DIE of a compilation unit.
Each compilation unit header is followed by a single DW_TAG_compile_unit
(or DW_TAG_partial_unit, but those aren't important here) and its children.
There is no reason to read any of the children at this point. If the first
DIE isn't a DW_TAG_compile_unit we are done, none of the child DIEs will
provide any useful information.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13369
2013-04-17 13:48:29 +00:00
Tom Hughes
11234a9407 Pay attention to PT_GNU_STACK when deciding what permissions to
use for the client stack.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13368
2013-04-17 10:08:04 +00:00
Mark Wielaard
7d0adfcedc read_unitinfo_dwarf2 DW_FORM_ref_addr is address size in DWARF version 2.
Bug #305513 contained a patch for some extra robustness checks. But
the real cause of crashing in the read_unitinfo_dwarf2 DWARF reader
seemed to have been this issue where DWARF version 2 DWZ partial_units
were read and DW_FORM_ref_addr had an unexpected size. This combination
is rare. DWARF version 4 is the current default version of GCC.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13367
2013-04-11 17:55:39 +00:00
Philippe Waroquiers
a819df9d0a Solve false negative for various malloc replaced functions arguments
The replacement functions are running on the simulated CPU.
The code on the simulated CPU does not necessarily use
all arguments. E.g. args can be ignored and/or only given
to a NON SIMD call.
The definedness of such 'unused' arguments will not be verified
by memcheck.
A call to 'trigger_memcheck_error_if_undefined' allows 
memcheck to detect such errors for the otherwise unused args.
Apart of allowing memcheck to detect an error, the function
trigger_memcheck_error_if_undefined has no effect and
has a minimal cost for other tools replacing malloc functions.

(suggestion of the 'no operation check' from Julian).

tested on f12/x86, debian6/amd64, f18/ppc64
Note that some Darwin specific code has been modified
in coregrind/m_replace_malloc/vg_replace_malloc.c.
(Some of) this code has not been compiled (no access to a
Darwin system). The code changed is trivial, so there is
some chance it will compile and even maybe work.

Added a new test verifying that various malloc related
functions undefined args are triggering an error in memcheck.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13361
2013-04-04 21:10:22 +00:00
Petar Jovanovic
4ee8c6feea mips: enable several system call wrappers on mips64
Enable wrappers on mips64 for the following calls:

- dup3
- accept4
- epoll_create1
- timerfd_settime
- newfstatat

Also, allow additional flock64 values in sys_fcntl for mips64.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13358
2013-04-03 23:43:11 +00:00
Julian Seward
509a6efaa9 Don't assume that page size is 4K when loading PIEs. Fixes #263034.
(Dodji Seketeli, dodji@redhat.com)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13351
2013-03-29 09:57:24 +00:00
Julian Seward
cca00cebc1 Enable prctl on ppc64-linux. Fixes #308089.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13350
2013-03-29 09:40:48 +00:00
Tom Hughes
b31167235f Cope with old linkers which don't support -Ttext-segment but which do
generate build-id sections. #317091.  (Mark Wielaard, mjw@redhat.com)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13346
2013-03-28 15:53:21 +00:00
Julian Seward
7a5e91776f Be more aggressive about dropping the lock in spinloops.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13345
2013-03-28 10:40:53 +00:00
Julian Seward
dc0e01ab4d Build system and hwcaps fixes pertaining to #305728, which added
support for AVX2, BMI1, BMI2 and FMA instructions.
(Jakub Jelinek, jakub@redhat.com)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13340
2013-03-27 11:43:20 +00:00
Julian Seward
0ebe62078c Add hwcaps checking on amd64 for RDTSCP. Part of the fix for #251569
and its dups.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13337
2013-03-26 13:57:48 +00:00
Julian Seward
c7f8191472 Use -Wl,-Ttext-segment when static linking if possible to keep build-ids.
Fixes #317091.  (Mark Wielaard, mjw@redhat.com)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13331
2013-03-22 11:49:46 +00:00
Philippe Waroquiers
30275f300c Fix 316535 Use of |signed int| instead of (unsigned) |size_t| in messages...
* when SEGV trapped, report the main thread size as an unsigned size_t
* Similar for memcheck overlap errors
  For example, for the 2 calls:
     memcpy(&a, &a, 2147483648UL);
     memcpy(&a, &a, -1);  // silently accepted by gcc 4.4.4 -Wall
                          // while the 3rd arg is supposed to be a size_t
  we now obtain (on a 32 bit system)
    Source and destination overlap in memcpy(0xbe97113f, 0xbe97113f, 2147483648)
    Source and destination overlap in memcpy(0xbef6d13f, 0xbef6d13f, 4294967295)
  instead of
    Source and destination overlap in memcpy(0xbe8e012f, 0xbe8e012f, -2147483648)
    Source and destination overlap in memcpy(0xbe8e012f, 0xbe8e012f, -1)

Do not ask me why 
   memcpy(&a, &a, -1);
is supposed to be accepted/acceptable/valid code.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13326
2013-03-13 21:44:07 +00:00
Bart Van Assche
7069f35e52 Darwin: Make stack growth tracking consistent with other architectures
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13320
2013-03-10 12:51:15 +00:00
Bart Van Assche
1ae0d437be Darwin: Fix a compiler warning
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13319
2013-03-10 12:49:08 +00:00
Philippe Waroquiers
a612127d33 Better document an ignored return value.
The call to VG_(gdbserver_report_signal) is ignored
in synth_fault_common (m_signals.c) as these signals
are always to be delivered (as explained by the following
comment).
=> better document that the return value is ignored on purpose.
(spotted by Florian, using Coverity)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13306
2013-03-03 17:52:31 +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