1113 Commits

Author SHA1 Message Date
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
Julian Seward
adc2dafee9 Update copyright dates, to include 2015. No functional change.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15577
2015-08-21 11:32:26 +00:00
Florian Krohm
f82fedcc39 Fix incorrect header guard. Reported by giacomopoz@gmail.com
Fixes BZ #351531


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15573
2015-08-20 21:41:28 +00:00
Julian Seward
e421887527 345338 - TIOCGSERIAL and TIOCSSERIAL ioctl support on Linux
Patch from Martin Ling (martin-kdebugs@earth.li)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15542
2015-08-14 08:17:37 +00:00
Julian Seward
396f02357d Bug 349034 - Add Lustre ioctls LL_IOC_GROUP_LOCK and LL_IOC_GROUP_UNLOCK
Patch from Frank Zago (fzago@cray.com)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15541
2015-08-14 08:05:35 +00:00
Julian Seward
a2df7642ef Bug 339563 - The DVB demux DMX_STOP ioctl doesn't have a wrapper.
Patch from mchehab@infradead.org (Mauro Carvalho Chehab).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15537
2015-08-13 14:53:17 +00:00
Bart Van Assche
ade9e09dfb valgrind.h: Suppress client request code generation on x32
Ensure that no code is generated for client requests on x32.

From: Matthias Schwarzott <zzam@gentoo.org>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15526
2015-08-12 13:29:10 +00:00
Ivo Raisr
cb0b01d098 Add support for repository cache protocol version 26.
Patch contributed by Tomas Jedlicka <jedlickat@gmail.com>.
n-i-bz


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15518
2015-08-11 09:12:40 +00:00
Florian Krohm
aefb16463d Fix a few function declarations.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15514
2015-08-09 16:27:44 +00:00
Florian Krohm
130cf6ffca The number of elements in a RangeMap cannot be negative.
Let the return type of VG_(sizeRangeMap) reflect that.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15492
2015-08-05 13:23:11 +00:00
Florian Krohm
99514d1d7f The number of elements in an OSet cannot be negative.
Let the return type of VG_(OSetGen_Size) reflect that.
Also fix a few casts.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15491
2015-08-05 12:09:55 +00:00
Florian Krohm
7bd7811604 The number of elements in a hash table cannot be negative.
Let the return type of VG_(HT_count_nodes) reflect that.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15490
2015-08-05 11:26:10 +00:00
Florian Krohm
6bd3e3e934 Add missing header files.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15489
2015-08-05 07:48:32 +00:00
Rhys Kidd
c5cf91fc5d ioctl handling needs to do POST handling on generic ioctls and needs to handle BPF ioctls
bz#312989

Patch by Guy Harris <guy@alum.mit.edu>

On OS X 10.10

Before:

== 593 tests, 214 stderr failures, 10 stdout failures, 0 stderrB failures, 0 stdoutB failures, 30 post failures ==

After:

== 593 tests, 214 stderr failures, 10 stdout failures, 0 stderrB failures, 0 stdoutB failures, 30 post failures ==


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15451
2015-07-25 07:57:55 +00:00
Florian Krohm
021a3ef28b Remove command line options --db-attach and --db-command which were
deprecated in 3.10.0


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15445
2015-07-24 11:50:12 +00:00
Rhys Kidd
e2dfee078f Fix valgrind 3.9.0 build fails on Mac OS X 10.6.8
bz#327745

Patch by Mark H <mh8928@yahoo.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15444
2015-07-24 10:23:34 +00:00
Julian Seward
ac60633d65 Bug 345248 - add support for Solaris OS in valgrind
Authors of this port:
    Petr Pavlu         setup@dagobah.cz
    Ivo Raisr          ivosh@ivosh.net
    Theo Schlossnagle  theo@omniti.com
            


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15426
2015-07-21 14:44:28 +00:00
Julian Seward
2ac4c69401 Fix "346411 MIPS: SysRes::_valEx handling is incorrect"
Specialise type SysRes for mips{32,64}-linux to enable 
meaningful equality comparisons.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15404
2015-07-08 17:08:23 +00:00
Rhys Kidd
0fcd971d15 Preliminary support for OS X 10.11 (El Capitan). Refer BZ#348909 for ongoing work.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15403
2015-07-08 13:46:57 +00:00
Bart Van Assche
6ae9001870 xen: Drop bogus port field from vki_xen_ioctl_evtchn_bind_virq
This ioctl argument struct has never had such a member.

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


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15386
2015-06-28 16:57:48 +00:00
Bart Van Assche
a914bcf7f5 xen: Implement physdev_op and map_pirq
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15385
2015-06-28 16:57:10 +00:00
Bart Van Assche
b64fedcf91 xen: Implement the xsm_op hypercall
More recent Xen toolstacks use this for the SID_TO_CONTEXT operation
only, even when XSM is not in use.

XSM is actually an abstraction layer, of which the only current
implementation is FLASK. So this blindly assumes that the backend is
FLASK. Should another XSM backend be invented then we will have to
sort of detecting the correct one.

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


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15384
2015-06-28 16:55:45 +00:00
Bart Van Assche
31229b7020 xen: syswrap XEN_SCHEDOP_remote_shutdown
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15383
2015-06-28 16:53:58 +00:00
Bart Van Assche
3adbf40a38 Follow-up for r15381
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15382
2015-06-28 16:52:49 +00:00
Bart Van Assche
d2a0392539 xen: Basic syswrap infrastructure for XEN_sched_op hypercalls
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@15381
2015-06-28 16:48:22 +00:00
Bart Van Assche
7a8a964019 xen: syswrap XENMEM_machphys_compat_mfn_list
XENMEM_machphys_compat_mfn_list is functionally identical to
XENMEM_machphys_mfn_list but returns a different list from Xen.

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


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15379
2015-06-28 16:46:30 +00:00
Bart Van Assche
b51ec07994 xen: syswrap XEH_HVMOP_set_pci_intx_level
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15377
2015-06-28 16:44:21 +00:00
Bart Van Assche
56e19e386d xen: syswrap XEN_HVMOP_track_dirty_vram
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15376
2015-06-28 16:43:14 +00:00
Bart Van Assche
04c609b998 xen: implement VKI_XEN_DOMCTL_irq_permission
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15375
2015-06-28 16:42:38 +00:00