1141 Commits

Author SHA1 Message Date
Ivo Raisr
f2b34df721 Added meta mempool support into memcheck for describing a custom allocator which:
- Auto-frees all chunks assuming that destroying a pool destroys all
  objects in the pool
- Uses itself to allocate other memory blocks
Unit tests included.
Fixes BZ#367995
Patch by: Ruurd Beerstra <ruurd.beerstra@infor.com>



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15984
2016-09-24 21:15:44 +00:00
Ivo Raisr
98273bc5f4 Solaris: Add ioctl wrapper for MNTIOC_GETEXTMNTENT.
n-i-bz


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15981
2016-09-23 23:00:21 +00:00
Rhys Kidd
ab2edd2901 Preliminary support for macOS Sierra (10.12). Does not fully resolve bz#365327.
No regressions on OS X 10.11.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15976
2016-09-22 02:55:24 +00:00
Rhys Kidd
60defe8a5f MAXSYSCALL for OS X 10.11.6 (xnu 3248.60.10) was indeed 500. n-i-bz.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15947
2016-09-11 05:28:59 +00:00
Ivo Raisr
6260274e4e Follow recent Solaris development with respect to
SUNWDTRACE program header. Newer Solaris no longer utilizes
this program header as a scratchspace for DTrace fasttrap
provider, before libc is loaded.
For the time being, it serves as a space for initial thread
pointer.
n-i-bz


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15936
2016-08-12 22:28:50 +00:00
Petar Jovanovic
030cea68c8 mips32: add support for FPXX mode
With this patch, MIPS32 Valgrind compiled with -mfpxx can handle all types
(regarding FP_ABI flag) of MIPS32 ELFs.

- Functions arch_elf_pt_proc() and arch_check_elf() are added to elf reader
  according to linux/fs/binfmt_elf.c from Linux 4.1;
- Processing .MIPS.abiflags section and initializing appropriate FPU mode
  for MIPS32 are added;
- Emulation of prctl(GET/SET_FP_MODE) sys-calls are implemented for MIPS32.

Patch by Aleksandar Rikalo <Aleksandar.Rikalo@imgtec.com>

Related VEX change: r3243.

This implements BZ#366079.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15934
2016-08-10 14:38:10 +00:00
Julian Seward
7c3b4bf540 Make "ashmem" and "binder" ioctls be handled properly on 64-bit ARM Android,
rather than falling through to the generic handler and being mishandled.
Fixes #360574.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15923
2016-08-04 21:11:28 +00:00
Ivo Raisr
fbaa6ad350 Solaris: Further refinement of r15882 for Solaris versions
which do not have <sys/sysnvl.h> header file.
n-i-bz


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15885
2016-05-29 12:10:58 +00:00
Ivo Raisr
d894770ee3 Solaris: Add ioctl wrappers for DINFOUSRLD and DINFOIDENT.
n-i-bz


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15884
2016-05-29 09:29:28 +00:00
Ivo Raisr
aad88ea2d0 Solaris: Add syscall modctl with several commands implemented.
n-i-bz


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15882
2016-05-28 22:05:43 +00:00
Ivo Raisr
8ace9b4f06 Solaris ioctl: Add wrapper for I_FLUSH.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15878
2016-05-16 11:38:29 +00:00
Ivo Raisr
662eab632a Solaris ioctl: Add wrapper for I_FIND.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15877
2016-05-16 06:12:27 +00:00
Ivo Raisr
91f7614767 Solaris: Add syscall wrapper for sysfs(84)
Fixes BZ#361926


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15862
2016-04-19 15:57:13 +00:00
Ivo Raisr
a91bd93900 Fix build on newer illumos distributions where struct fpchip_state
was renamed to _fpchip_state.
n-i-z


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15856
2016-04-17 10:05:29 +00:00
Ivo Raisr
5b3c2f59c5 Run __gnu_cxx::__freeres() cleanup function available
from libstdc++ when available, similar to existing __libc_freeres().
New option --run-cxx-freeres=<yes|no> can be used to change whether
this cleanup function is called or not.

Note that __gnu_cxx::__freeres() is currently available
only in gcc 6. It is not yet decided what to do about
libstdc++ from gcc 5.
Tracked under https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69945
for libstdc++.

Fixes BZ#345307 (partially).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15840
2016-03-30 17:53:03 +00:00
Ivo Raisr
d3eb7a8894 Add support for repository cache protocol version 31
n-i-bz


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15831
2016-03-16 15:08:42 +00:00
Mark Wielaard
eba2cff480 Use correct syscall numbers on arm64. Fix rename, dup2 and getpgrp.
We were using some wrong syscall numbers in vki-scnums-arm64-linux.h
arm64 doesn't implement a couple of old deprecated system calls like
rename, dup2, getpgrp and fork. Adjust m_libcfile.c rename and dup2
functions to use renameat (also on tilegx) and dup3 (with fcntl fallback
for bad oldfd). And in m_libcproc.c implement getpgrp as getpgid(0).
Also don't compile the fork syswrap on arm64 (it only supports clone).

In practice this only affected callgrind which was unable to rename
dump files in some cases and ELF core dumps might have contained some
bogus prstatus fields.

Related to bug #359503 - Add missing syscalls for aarch64 (arm64)
Reported by Marcin Juszkiewicz who also posted a nice overview
of system calls on different linux architectures:
https://marcin.juszkiewicz.com.pl/2016/03/05/from-a-diary-of-aarch64-porter-system-calls/

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15824
2016-03-09 16:18:34 +00:00
Ivo Raisr
e059272ce0 Solaris door: Add support for REP_PROTOCOL_ENTITY_FMRI
n-i-bz


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15819
2016-02-29 20:20:36 +00:00
Petar Jovanovic
d7a9a37a07 mips: determine page size at runtime
Instead of passing an option to the configure script, use runtime detection
of the page size. Remove the "--with-pagesize" parameter from the configure
script.
Also accept 8k and 32k as valid page sizes.

Patch by Maran Pakkirisamy

It fixes BZ#342356.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15813
2016-02-26 15:30:53 +00:00
Ivo Raisr
782d01dd78 Enable remote debugging for position independent executables
on Solaris. With gcc 5.3, PIEs can be produced on Solaris 12.

gdb on Solaris requires AT_ENTRY to correctly work with those.
See very long comment before function svr4_exec_displacement().
n-i-bz


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15810
2016-02-23 21:48:13 +00:00
Mark Wielaard
3c4de2eb09 Bug 359703 s390: wire up separate socketcalls system calls
The linux 4.3 s390 kernel has separate system calls that were originally
hidden behind the socketcall multiplexer system call. Newer glibc versions
will use these direct system calls instead of socketcall when available.
Causing several regtest failures.

This fix simply wires up the split out system calls directly to the
existing syswrap handlers for s390.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15802
2016-02-23 15:19:49 +00:00
Ivo Raisr
f71b442444 Solaris syscall: commands A_GETSTAT and A_SETSTAT
for auditon(2) subcode of the auditsys() syscall
were removed in Solaris 12.
However they stay for Solaris 11 and illumos.
n-i-bz


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15791
2016-02-17 18:11:32 +00:00
Ivo Raisr
24e1e9f493 Solaris syscall: Add support for getrandom(143).
n-i-bz


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15782
2016-02-05 22:57:42 +00:00
Mark Wielaard
68a1308014 Bug #358030 Support direct socket calls on x86 32bit (new in linux 4.3)
Patch by ronald.wahl@raritan.com.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15764
2016-01-20 22:24:43 +00:00
Florian Krohm
6389086806 Followup to r15762. Add missing type in cast expression.
Do not use C++ comments. They are not allowed in this file.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15763
2016-01-17 20:34:53 +00:00
Florian Krohm
d6156d8f84 Avoid an MSVC compiler warning about an unused function parameter.
Fixes BZ #356817


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15762
2016-01-17 16:20:14 +00:00
Ivo Raisr
e3df68d823 Add support for repository cache protocol version 27.
n-i-bz


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15742
2015-12-04 17:37:41 +00:00
Petar Jovanovic
6b95752621 mips: add missing "memory" to the clobber list
Add "memory" to the clobber arguments of VALGRIND_DO_CLIENT_REQUEST_EXPR.

This fixes memcheck/tests/vbit-test/vbit-test.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15740
2015-11-27 14:51:33 +00:00
Ivo Raisr
8baa800e63 Implement properly setjmp/longjmp on Solaris x86/amd64.
The default implementation provided by __builtin functions
does very weird things.
Uncovered by Philippe's commit r15716.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15734
2015-11-21 21:35:34 +00:00
Rhys Kidd
ff615aca37 Resolve build error on OS X, from r15728. n-i-bz.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15733
2015-11-21 00:37:33 +00:00
Ivo Raisr
0d30686d21 When searching for global public symbols (like for the somalloc
synonym symbols), exclude the dynamic (runtime) linker as it is very
special.
Fixes BZ#355454


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15728
2015-11-18 20:38:37 +00:00
Mark Wielaard
8b4dd5c47c BZ#355188 valgrind should intercept all malloc related global functions.
This implements the interception of all globally public allocation
functions by default. It works by adding a flag to the spec to say the
interception only applies to global functions. Which is set for the
somalloc spec. The librarypath to match is set to "*" unless the user
overrides it. Then each DiSym keeps track of whether the symbol is local
or global. For a spec which has isGlobal set only isGlobal symbols will
match.

Note that because of padding to keep the addresses in DiSym aligned the
addition of the extra bool isGlobal doesn't actually grow the struct.
The comments explain how the struct could be made more compact on 32bit
systems, but this isn't as easy on 64bit systems. So I didn't try to do
that in this patch.

For ELF symbols keeping track of which are global is trivial. For pdb I
had to guess and made only the "Public" symbols global. I don't know
how/if macho keeps track of global symbols or not. For now I just mark
all of them local (which just means things work as previously on platforms
that use machos, no non-system symbols are matches by default for somalloc
unless the user explicitly tells which library name to match).

Included are two testcases for shared libraries (wrapmalloc) and staticly
linked (wrapmallocstatic) malloc/free overrides that depend on the new
default. One existing testcase (new_override) was adjusted to explicitly
not use the new somalloc default because it depends on a user defined
new implementation that has side-effects and should explicitly not be
intercepted.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15726
2015-11-15 16:50:43 +00:00
Ivo Raisr
e7be5069c3 Solaris syscall: Add support for lwp_cond_signal(171).
Fixes BZ#354392.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15718
2015-10-26 16:13:05 +00:00
Philippe Waroquiers
6b5a479bda Fix 353891 Assert 'bad_scanned_addr < VG_ROUNDDN(start+len, sizeof(Addr))' failed
All memory dereferences during leak search are checked either with
aspacemgr or using the VA-bits.
So, in theory, no memory fault should occur.
However, the leak search is done so as to resist to e.g.
- desynchronisation between the real pages mapped and the aspacemgr state.
- client pages mprotected against reading
- any other reason why dereferencing a client address would fail.

So, the function lc_scan_memory installs a fault catcher that
is called if a memory fault signal is raised during memory scan.
However, memory dereference is also done in the function heuristic_reachedness.
So, this function must also resist to memory fault.

This patch also installs a fault catcher for the function heuristic_reachedness.

More in details, the following changes are done:
* pub_tool_signal.h and m_signals.c :
  VG_(set_fault_catcher) now returns the previously set fault catcher.
  This is needed so that heuristic_reachedness/lc_scan_memory can save
  and restore the previous fault catcher.

* mc_leakcheck.c:
  Addition of leak_search_fault_catcher that contains the common
  code for the (currently 2) fault catchers used during leak search.

* Modification of heuristic_reachedness and lc_scan_memory:
  Add 2 (small) specific fault catcher that are calling the common
  leak_search_fault_catcher.

* The way sigprocmask is handled has been changed:
  Before this patch, lc_scan_memory was saving/restoring the procsigmask
  for each scanned block (and was restoring it when the fault catcher
  was longjmp-ing back to lc_scan_memory in case of SEGV or BUS.
  This was causing 2 system calls for each block scanned.

  Now, lc_scan_memory and  heuristic_reachedness are not saving/restoring
  the procmask: the work to reset the sigprocmask is only done
  in leak_search_fault_catcher. This is more efficient as no syscall
  anymore is done during leak search, except for (normally) unfrequent
  SIGSEGV/BUS. It is also simpler as signal handling is now done at
  a single place.
  
  It is ok to reset the procmask (in fact, just remove the caught signal
  from the process sigmask) as during leak search, no other activity than
  the leak search is on-going, and so no other SEGV/BUS can be received
  while the handler runs.

This gives moderate speed improvements for applications allocating a lot of
blocks (about 10% improvement when leak searching in 1 million small blocks).

Test case (slightly modified) by Matthias Schwarzott.
  
  
  



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15716
2015-10-22 19:14:30 +00:00
Julian Seward
5e5d78dda0 Fix inconsistent use of vki_ prefixes for struct vki_ifreq.
No functional change.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15713
2015-10-19 11:21:33 +00:00
Ivo Raisr
b6aeb1c9e6 Solaris syscall: Add support for lwp_cond_wait(170).
Provide scalar test as well.
Fixes BZ #353920.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15708
2015-10-16 12:20:20 +00:00
Ivo Raisr
9aaa41b23d Solaris syscall: Enable fchdir(120) - generic.
Provide scalar tests as well.
Fixes BZ #353917.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15707
2015-10-15 09:37:14 +00:00
Florian Krohm
91a29a676c On a zEC12 or z13, a glibc with lock elision enabled infers from HWCAP
that the prerequisites for lock elision are met.  Then it may use TBEGIN
and other transactional-execution instructions which are not implemented
by Valgrind.  Likewise, the upcoming glibc 2.23 will exploit vector
instructions if they are advertised by HWCAP; and those are currently
not implemented by Valgrind either.  In general, the increased use of
ifunc may lead to more such cases in the future.

This patch suppresses the advertising of those hardware features via
HWCAP which are either not known to Valgrind or currently unsupported.

Patch by Andreas Arnez (arnez@linux.vnet.ibm.com).
Fixes BZ #353680.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15702
2015-10-12 20:35:56 +00:00
Ivo Raisr
6ef7c1085f Solaris syscall: Add support for pset family (207).
Provide scalar tests as well.
Fixes BZ #353398.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15700
2015-10-12 19:10:42 +00:00
Florian Krohm
193f88fad4 Make sure no executable stack gets created.
Explanation by Matthias Schwarzott:

The linker will request an executable stack as soon as at least one
object file, that is linked in, wants an executable stack.
And the absence of the 
      .section .note.GNU-stack."",@progbits
is enough to tell the linker that an executable stack is needed.
So even an empty asm-file must at least contain this statement to not
force executable stacks on the whole executable.

* Define a helper macro MARK_STACK_NO_EXEC that disables the
  executable stack.
* Instantiate this macro unconditionally at the end of each asm file.

Patch by Matthias Schwarzott <zzam@gentoo.org>.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15692
2015-09-30 20:30:48 +00:00
Ivo Raisr
cf2ca3123f Solaris ioctl: more of those sockio ioctl wrappers.
SIOCGLIFBRDADDR, SIOCGLIFCONF, SIOCGLIFFLAGS, SIOCGLIFNETMASK.
n-i-bz


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15689
2015-09-29 14:23:51 +00:00
Ivo Raisr
9c3ee43887 Solaris ioctl: more wrappers for sockio ioctls.
SIOCGIFCONF, SIOCGIFFLAGS, SIOCGIFNETMASK, and SIOCGIFNUM.
n-i-bz


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15686
2015-09-29 05:20:16 +00:00
Ivo Raisr
a0bde0618b Solaris syscall: Add support for system_stats (154).
Provide scalar test as well.
n-i-bz


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15684
2015-09-25 21:04:45 +00:00
Ivo Raisr
516df5f4b5 Support correctly AT_SUN_SYSSTAT_ADDR and AT_SUN_SYSSTAT_ZONE_ADDR
in the auxiliary vector.

This is possible as Solaris 12 kernel now creates auxv even
for statically linked binaries.
n-i-bz


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15682
2015-09-25 20:12:26 +00:00
Julian Seward
0a8d1755ec Merge, from branches/VALGRIND_3_11_BRANCH, NEWS and docs/xml/vg-entities.xml.
Bump version to 3.12.0.SVN.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15679
2015-09-23 13:35:36 +00:00
Julian Seward
515b7fe0b3 Bug 342008 - valgrind.h needs type cast for _zzq_default to compile with clang/llvm in 64-bit mode.
(arm64, that is)
Patch from chh@google.com.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15633
2015-09-06 13:10:22 +00:00
Rhys Kidd
b1631e4c8e Fix UNKNOWN fcntl 97 on OS X 10.11
bz#351632

On OS X 10.11 (DP8)

Before:

== 595 tests, 575 stderr failures, 10 stdout failures, 0 stderrB failures, 0 stdoutB failures, 30 post failures ==

After:

== 595 tests, 219 stderr failures, 9 stdout failures, 0 stderrB failures, 0 stdoutB failures, 30 post failures ==

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15619
2015-09-03 11:31:58 +00:00
Julian Seward
d60f46535c Add missing copyright notices for Xen related files.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15614
2015-09-01 13:32:21 +00:00
Ivo Raisr
7a4cc7d5fd Add support for ldsoexec on Solaris.
Solaris runtime linker allows to run dynamically linked programs indirectly, as:
    ld.so.1 <dynamic_executable>
This is now possible under Valgrind as well.

Fixes BZ#351858.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15607
2015-08-31 21:31:09 +00:00
Rhys Kidd
d8a45cbef1 Preliminary support for OS X 10.11 (El Capitan) documentation. bz#348909.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15584
2015-08-23 08:27:45 +00:00