Commit Graph

58 Commits

Author SHA1 Message Date
Julian Seward
ed29b0b6a8 Fix POST(posix_spawn) on Darwin so it marks the returned pid as defined.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12883
2012-08-20 10:40:02 +00:00
Philippe Waroquiers
3abbddda09 fix 301281 valgrind hangs on OS X when the process calls system()
After looking more in depth, gdbserver must not be terminated
in PRE(posix_spawn) on MacOS: this is running in the parent and
(on MacOS) is a single syscall similar to a fork+exec.
On linux, posix_spawn is implemented using 2 syscalls
(fork followed by exec).



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12882
2012-08-20 09:27:15 +00:00
Philippe Waroquiers
6bae0a6e36 Fix 301281 valgrind hangs on OS X when the process calls system()
This should fix the bug (but could not test it : no MacOSX).
See equivalent code in syswrap-generic.c and comment
in pub_tool_gdbserver.h:
// tid == 0 indicates to stop gdbserver and report to gdb
// that the valgrind-ified process has exited.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12879
2012-08-18 09:50:27 +00:00
Julian Seward
4a3633e266 Update copyright dates to include 2012.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12843
2012-08-05 15:46:46 +00:00
Julian Seward
e9cda68ea7 Add support for sys_shm_unlink on Darwin. Fixes #288298.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12819
2012-08-03 07:47:01 +00:00
Julian Seward
dc0ca811ec Un-break the build on OSX < 10.8 following r12814
(which was initial OSX 10.8 support)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12815
2012-08-02 18:51:51 +00:00
Julian Seward
f0c0f9f3ce Add initial support for MacOSX 10.8. Note this is still very borked
and pretty much unusable for real work.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12814
2012-08-02 18:25:04 +00:00
Julian Seward
0b3c2d6642 Back out r12466, which stopped non-MAP_FIXED mmaps by the client on
Darwin from returning address zero (however insane that is).  r12466
appears to cause other applications to break (TextEdit, for one).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12813
2012-08-02 10:40:31 +00:00
Julian Seward
b5fc5d0a06 Add a nasty kludge in the handling of mmap on Darwin. Does not apply
to any other platforms.  Prevent mmap(ANON) from returning zero (zero
with success, that is) since (a) some programs are observed to be
spooked by getting zero from a successful call to mmap, and (b) it's
pretty stupid from the point of view of program safety and possibly
security, since it causes page zero to become accessible.  So don't.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12466
2012-03-27 10:06:31 +00:00
Bart Van Assche
ba416f24c6 Darwin: Fix a copy/paste error that was introduced in r12458
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12459
2012-03-26 18:13:29 +00:00
Bart Van Assche
563f0acd21 Check whether the big lock is held before invoking pre_thread_ll_create.
If the pre_thread_ll_create tracking function would be invoked without the
big lock being held, that would trigger a race condition in the tools that
implement this tracking function.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12458
2012-03-25 17:51:59 +00:00
Tom Hughes
3925f2d664 Only mark data which has actually been filled in by recvmsg as defined.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12380
2012-02-10 16:45:01 +00:00
Tom Hughes
baec53c5f1 Add support for the sendmmsg and recvmmsg system calls. Fixes BZ#277779.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12376
2012-02-10 11:30:09 +00:00
Julian Seward
fc489f1101 Don't break fcntl locks when program does mmap. #280965.
(Rusty Russell, rusty@rustcorp.com.au)

tdb uses fcntl locks and mmap, and some of the tests fail under valgrind. 
strace showed valgrind opening the tdb file, reading 1024 bytes, then closing
it.  This is not allowed: POSIX says if you open and close a file, all fcntl
locks on it are dropped (insane, yes).

Finally got around to hacking the source to track this down: di_notify_mmap is
doing the damage.  The simplest fix was to hand in an optional fd for it to
use, then have it do pread.

I had to fix your pread; surely this should seek back even if the platform
doesn't have pread support?



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12224
2011-10-24 08:53:03 +00:00
Julian Seward
c96096ab24 Update all copyright dates, from 20xy-2010 to 20xy-2011.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12206
2011-10-23 07:32:08 +00:00
Julian Seward
5806ea6327 * (marginally) fix debug printing for new 10.7 syscalls
* also, remove SfMayBlock annotations for those that obviously won't


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12075
2011-09-30 17:51:21 +00:00
Julian Seward
8885c4e740 Add initial support for Mac OS X 10.7 (Lion). Tracked by bug #275168.
* configure.in support

* new supp file darwin11.supp

* comment out many intercepts in mc_replace_strmem.c and
  vg_replace_malloc.c that are apparently unnecessary for Darwin

* add minimal handling for the following new syscalls and mach traps:
    mach_port_set_context
    task_get_exception_ports
    getaudit_addr
    psynch_mutexwait
    psynch_mutexdrop
    psynch_cvbroad
    psynch_cvsignal
    psynch_cvwait
    psynch_rw_rdlock
    psynch_rw_wrlock
    psynch_rw_unlock
    psynch_cvclrprepost

* wqthread_hijack on amd64-darwin: deal with
  tst->os_state.pthread having an apparently different offset,
  which caused an assertion failure

* m_debuginfo: for 32 bit processes on Lion, use the DebugInfoFSM
  cleanup added in r12041/12042 to handle apparently new dyld
  behaviour, which is to map text areas r-- first and only
  vm_protect them later to r-x.



The following cleanups remain to be done

* remove apparently pointless, commented out wrapper macro
  invokations in mc_replace_strmem.c, eg

  //MEMMOVE(VG_Z_DYLD,        memmove)

  (or determine that they are still necessary, and uncomment)


* ditto in vg_replace_malloc.c, plus general VGO_darwin cleanups
  there


* write proper syscall wrappers for
    mach_port_set_context
    task_get_exception_ports
    getaudit_addr
    psynch_mutexwait
    psynch_mutexdrop
    psynch_cvbroad
    psynch_cvsignal
    psynch_cvwait
    psynch_rw_rdlock
    psynch_rw_wrlock
    psynch_rw_unlock
    psynch_cvclrprepost
  These are currently just no-ops and may be causing Memcheck to
  report false undef-value errors


* figure out why it doesn't work properly unless built with gcc-4.2 on
  Lion.

  gcc-4.2 is the "normal" gcc (i686-apple-darwin11-gcc-4.2.1).  Plain
  gcc is the hybrid gcc-front-end clang-back-end thing
  (i686-apple-darwin11-llvm-gcc-4.2).  Whereas on Snow Leopard, plain
  gcc is the normal gcc.

  The symptoms of the failure are that wqthread_hijack in
  syswrap-amd64-linux.c hits this /*NOTREACHED*/ vg_assert(0); right
  at the end (you need a pretty complex threaded app to trigger this),
  which makes me think that either ML_(wqthread_continue_NORETURN) or
  call_on_new_stack_0_1 do return, which they are not expected to.


* figure out if some of the uninitialised value errors reported in
  system libraries on are caused by Memcheck being confused by LLVM
  generated code, as per bug #242137



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12043
2011-09-21 08:43:08 +00:00
Julian Seward
8cf71fb1ad Un-break the build on OSX following r11910.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11921
2011-07-26 23:02:10 +00:00
Julian Seward
42ada29286 Add a new client request and pair of macros,
VALGRIND_{DISABLE,ENABLE}_ERROR_REPORTING, which allow a thread to
temporarily disable reporting of errors it makes.  This is useful for
making Memcheck behave sanely in the presence of some MPI
implementations.  Also mark up libmpiwrap.c accordingly.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11910
2011-07-24 16:02:33 +00:00
Julian Seward
77ea74b82e gdbserver: (#214909 c 82)
ensure proper cleanup of gdbsrv FIFOs/shmem files with untraced fork/exec

* syswrap-{generic|darwin|aix5}.c : in PRE(sys_execve) : terminate gdbserver
* pub_core_gdbserver.h and m_gdbserver.c : add VG_(gdbserver_prerun_action),
  factorising the actions to do by gdbserver at "startup" (i.e. a traced
  fork or a traced exec).
* scheduler.c : implement startup action using VG_(gdbserver_prerun_action)

(Philippe Waroquiers, philippe.waroquiers@skynet.be)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11771
2011-05-17 18:14:53 +00:00
Robert Walsh
7671cab5c8 Fix no-arg ioctls on Darwin.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11714
2011-04-27 19:04:31 +00:00
Julian Seward
945eccc8e4 Make MacOS builds work again following fixes for #259977
(revs 11687,8,9)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11690
2011-04-11 22:08:06 +00:00
Julian Seward
30dcecc9c9 Un-break the trunk build on OSX (broken by r11483 on 6 Dec '10).
Fixes #261654.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11489
2011-01-04 14:18:35 +00:00
Julian Seward
bee9b6b321 chmod_extended and fchmod_extended: handle NULL xsecurity argument correctly.
Fixes #247510.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11412
2010-10-07 15:38:51 +00:00
Julian Seward
371f1ef15e darwin: support sys_open_extended, sys_removexattr, sys_fremovexattr.
open_extended has the same kludge as chmod_extended/fchmod_extended.
Fixes #246549.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11332
2010-09-02 22:42:14 +00:00
Julian Seward
ad6190eace Support sys_proc_info on 32-bit darwin as well as 64-bit. This
gets rid of complaints about "unsupported syscall unix:336".


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11231
2010-07-27 09:09:55 +00:00
Julian Seward
8981f6c7e6 Support sys_audit_session_self on MacOSX 10.6 (Dave MacLachlan,
dmaclach@gmail.com).  Fixes #244670.  I'm assuming this also compiles
on 10.5 but haven't tried it.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11222
2010-07-21 19:54:43 +00:00
Julian Seward
3270201d65 Use the wrapper for sys___semwait_signal for 10.5 also on 10.6,
rather than have a different one for 10.6.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11221
2010-07-21 16:34:47 +00:00
Julian Seward
18ac942546 Support sys_symlink on Darwin. Fixes #237485.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11220
2010-07-21 16:21:43 +00:00
Julian Seward
bb88383593 Fix compiler warnings with the proc_info wrapper.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11218
2010-07-21 15:28:34 +00:00
Julian Seward
ca846cfb0a Get rid of a whole bunch of format string warnings, by the probably
excessively blunt-instrument approach of casting all offending values
to 64-bits.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11205
2010-07-01 14:17:32 +00:00
Julian Seward
df1eec38c3 Add a handler for syscall proc_info, 64-bit Darwin only atm.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11202
2010-07-01 10:47:23 +00:00
Nicholas Nethercote
6fd0eb7b07 Merged the MACOSX106 branch to the trunk. Merge command:
svn merge -r11143:HEAD svn://svn.valgrind.org/valgrind/branches/MACOSX106

There were some easy-to-resolve conflicts.

Then I had to fix up coregrind/link_tool_exe*.in -- those files had been
added independently on both the trunk and the branch, AFAICT.  I just
overwrote the trunk versions with the branch versions.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11194
2010-07-01 00:20:20 +00:00
Julian Seward
9b0574dff8 Update copyright dates to 2010.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11121
2010-05-03 21:37:12 +00:00
Julian Seward
426c137045 New flag: --trace-children-skip=patt1,patt2,etc
Specifies a comma-separated list of executable-names
(with "*" and "?" wildcards allowed) that should not be traced into
even when --trace-children=yes.  Modified version of a patch
from Bill Hoffman.  Fixes #148932.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10927
2009-11-05 08:55:13 +00:00
Nicholas Nethercote
9acc4cc4d8 Fix the access_extended wrapper, which was rather broken. That's what I get
for not testing properly.  Added a regtest for it too.  Fixes bug 200760
(again, properly this time).



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10826
2009-08-16 00:00:17 +00:00
Nicholas Nethercote
c922a7201d Add a crappy wrapper for access_extended(), one of the more ridiculous
syscalls I've had the displeasure of encountering.  Due to its
ridiculousness, the wrapper misses a PRE_MEM_WRITE check and so can result
in false positives.  The POST_MEM_WRITE update is present, though, so it
shouldn't cause subsequent problems.  Fixes bug 200760.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10786
2009-08-12 02:30:20 +00:00
Julian Seward
2c168a6128 Resync after {wq,p}thread_hijack rather than merely doing a check.
Believed to help with, although not fix, the underlying problem in
#192634.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10751
2009-08-07 20:28:58 +00:00
Julian Seward
1bce42d94e Minor improvements to printing w.r.t. sync checking / resyncing.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10693
2009-08-03 01:05:18 +00:00
Nicholas Nethercote
9cecb57a28 Handle the memory written by aio_read() properly -- mark the memory buffer
as written once aio_return() is successfully called.

Also check the addressability of the buffer for both aio_read() and
aio_write().

Also check the file descriptor for aio_read() and aio_write().

And add a test for this.  There's one corner case of the test that doesn't
work as expected and is currently commented out.  But aio_*() certainly
works better than it used to.

All this is for bug 197227.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10539
2009-07-23 04:30:06 +00:00
Nicholas Nethercote
eefed9ebfc Add support for __pthread_kill(). This hopefully fixes bug 201016.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10537
2009-07-23 00:06:16 +00:00
Nicholas Nethercote
9ca3448218 Add support on Darwin for mount(). Finishes off bug 198624.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10461
2009-07-15 06:39:15 +00:00
Nicholas Nethercote
c5310baaff Added support for getfsstat64() on Darwin. This partly fixes bug 198624.
Fixed a couple of other minor things too.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10460
2009-07-15 06:24:57 +00:00
Nicholas Nethercote
ef7925e7bc Add support on Darwin for fstat_extended() and fstat64_extended(). Partly
addresses bug 198624.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10458
2009-07-15 06:01:45 +00:00
Nicholas Nethercote
705bcf4d73 Handle setpgid(). Partly addresses bug 198624.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10457
2009-07-15 05:46:43 +00:00
Nicholas Nethercote
26daa53d28 In VG_(get_changed_segments) use dynamic memory allocation rather than
static memory allocation to avoid hardwiring an upper limit on CSS_SIZE.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10374
2009-06-24 08:32:42 +00:00
Nicholas Nethercote
5e7562af08 Add support for various aio_*() syscalls on Darwin. With them, Quicktime
runs, albeit incredibly slowly.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10371
2009-06-24 06:25:36 +00:00
Nicholas Nethercote
7eb329d028 Support and test mincore() on Darwin.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10368
2009-06-24 04:15:29 +00:00
Nicholas Nethercote
b05a2a18d7 This commit merges the BUILD_TWEAKS branch onto the trunk. It has the
following improvements:

- Arch/OS/platform-specific files are now included/excluded via the
  preprocessor, rather than via the build system.  This is more consistent
  (we use the pre-processor for small arch/OS/platform-specific chunks
  within files) and makes the build system much simpler, as the sources for
  all programs are the same on all platforms.

- Vast amounts of cut+paste Makefile.am code has been factored out.  If a
  new platform is implemented, you need to add 11 extra Makefile.am lines.
  Previously it was over 100 lines.

- Vex has been autotoolised.  Dependency checking now works in Vex (no more
  incomplete builds).  Parallel builds now also work.  --with-vex no longer
  works;  it's little use and a pain to support.  VEX/Makefile is still in
  the Vex repository and gets overwritten at configure-time;  it should
  probably be renamed Makefile-gcc to avoid possible problems, such as
  accidentally committing a generated Makefile.  There's a bunch of hacky
  copying to deal with the fact that autotools don't handle same-named files
  in different directories.  Julian plans to rename the files to avoid this
  problem.

- Various small Makefile.am things have been made more standard automake
  style, eg. the use of pkginclude/pkglib prefixes instead of rolling our
  own.

- The existing five top-level Makefile.am include files have been
  consolidated into three.

- Most Makefile.am files now are structured more clearly, with comment
  headers separating sections, declarations relating to the same things next
  to each other, better spacing and layout, etc.

- Removed the unused exp-ptrcheck/tests/x86 directory.

- Renamed some XML files.

- Factored out some duplicated dSYM handling code.

- Split auxprogs/ into auxprogs/ and mpi/, which allowed the resulting
  Makefile.am files to be much more standard.

- Cleaned up m_coredump by merging a bunch of files that had been
  overzealously separated.

The net result is 630 fewer lines of Makefile.am code, or 897 if you exclude
the added Makefile.vex.am, or 997 once the hacky file copying for Vex is
removed.  And the build system is much simpler.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10364
2009-06-24 00:37:09 +00:00
Nicholas Nethercote
d48af010b9 Add wrappers for shmat() and shmdt() on Darwin. Fixes bug 191271.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10297
2009-06-10 23:26:13 +00:00