117 Commits

Author SHA1 Message Date
Nicholas Nethercote
38ff4e69d1 Comment changes only: s/skin/tool/
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2555
2004-08-03 13:29:09 +00:00
Nicholas Nethercote
7bdbf7377f Factor out differences between VG_(system) and PRE(execve). Required moving
mash_colon_env() from vg_syscalls.c to vg_mylibc.c.  Saved 20 lines of code.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2554
2004-08-03 13:08:31 +00:00
Nicholas Nethercote
9a31e70a79 Cleaned up vg_include.h:
- removed various things that are no longer used
- made (module-)local some things that were global
- improved the formatting in places

Removed about 160 lines of code, and non-trivially reduced the number
of global entities.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2541
2004-08-01 22:36:40 +00:00
Tom Hughes
f10c38f7e5 Modify the ipc system call so that only those calls which may block
are treated as blocking.

This fixes bug #86000 because shmat is no longer treated as blocking
and it is therefore no longer possible for two threads to try and use
the same address for the shared memory segment.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2536
2004-07-29 22:40:07 +00:00
Tom Hughes
1afbb3fc45 Modified the fcntl system call so that only those reason codes which
can block (ie F_SETLKW) are treated as blocking.

This resolves the F_SETOWN problem described in bug #85969.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2535
2004-07-29 21:20:11 +00:00
Tom Hughes
b5f08d077f Add support for allowing the POST function for a system call to be called
even when the system call fails, and allow the PRE function to modify the
system call flags.

Also fix nanosleep so that it only marks the returned time as defined
if the system call exited with EINTR due to be interrupted.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2534
2004-07-29 17:44:23 +00:00
Tom Hughes
3a75fc74df Fix checking of execve() when argv is a null pointer.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2520
2004-07-21 16:23:38 +00:00
Nicholas Nethercote
4e6783677f apostrophe pedantry; comment change only
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2488
2004-07-16 17:32:15 +00:00
Tom Hughes
61fa07e868 Implement support for the async I/O system calls in 2.6 kernels. This
requires padding of the address space around calls to io_setup in order
to constrain the kernel's choice of address for the I/O context.

Based on patch from Scott Smith <scott-kde@gelatinous.com> with various
enhancements, this fixes bug #83060.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2485
2004-07-15 23:13:37 +00:00
Nicholas Nethercote
585a5d8244 Removed some unnecessary is_kerror() checks.
Fixed nanosleep's formatting.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2475
2004-07-10 18:08:13 +00:00
Nicholas Nethercote
977f595b53 Added assertion checking to a whole bunch of mmap() and munmap() calls. I used
assertions because if these calls fail, it's a bug in Valgrind.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2474
2004-07-10 17:49:17 +00:00
Nicholas Nethercote
159da68dd4 Format wibble
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2472
2004-07-10 17:30:07 +00:00
Nicholas Nethercote
662b1e6029 Remove out-of-date comment.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2470
2004-07-10 17:22:27 +00:00
Nicholas Nethercote
8a556ef47c A few changes:
- removed an unnecessary VG_(unmap_range)() call in do_brk() -- the
  VG_(munmap)() just before it does it anyway.
- inlined mprotect_segment() and munmap_segment() because it's more concise and
  easier to understand that way.
- a couple of minor formatting changes
- added and cleaned up a couple of comments


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2469
2004-07-10 17:21:14 +00:00
Nicholas Nethercote
be21773f17 Removed the 'place-holder' behaviour of VG_(mmap). Previously, VG_(mmap) would
add a segment mapping to the segment skip-list, and then often the caller of
VG_(mmap) would do another one for the same segment, just to change the SF_*
flags.  Now VG_(mmap) gets passed the appropriate SF_* flags so it can do it
directly.   This results in shorter, simpler code, and less work at runtime.

Also, strengthened checking in VG_(mmap), POST(mmap), POST(mmap2) -- now if the
result is not in the right place, it aborts rather than unmapping and
continuing.  This is because if it's not in the right place, something has
gone badly wrong.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2466
2004-07-10 16:50:09 +00:00
Tom Hughes
f9a0e004f5 Implement an emulated soft limit for file descriptors in addition to
the current reserved area, which effectively acts as a hard limit. The
setrlimit system call now simply updates the emulated limits as best
as possible - the hard limit is not allowed to move at all and just
returns EPERM if you try and change it.

This should stop reductions in the soft limit causing assertions when
valgrind tries to allocate descriptors from the reserved area.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2440
2004-06-26 11:27:52 +00:00
Nicholas Nethercote
2fab200ad0 Renamed the following options:
--logfile-fd  -->  --log-fd
  --logfile     -->  --log-file
  --logsocket   -->  --log-socket

to be consistent with each other and other options (esp. --input-fd).  Also
renamed some related variables.  The old names still work, for backwards
compatibility, but they're not documented.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2429
2004-06-21 12:42:35 +00:00
Tom Hughes
827e3bebb6 Don't try and validate the contents of the environment passed to
the execve system call if the envp pointer is null as it causes
valgrind to die with a segmentation fault.

CCMAIL: 83573-done@bugs.kde.org


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2427
2004-06-19 13:02:34 +00:00
Tom Hughes
96d29fe8ac Add support for the FIGETBSZ and FIBMAP ioctls based on a patch
from Joseph D Wagner <theman@josephdwagner.info>.

CCMAIL: 83025-done@bugs.kde.org


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2426
2004-06-19 12:41:05 +00:00
Tom Hughes
0546e3739c Add support for the HDIO_GET_IDENTITY ioctl based on patch
from Jim McDonald <jim@mcdee.net>.

CCMAIL: 83340-done@bugs.kde.org


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2425
2004-06-19 12:12:01 +00:00
Tom Hughes
c88651b1fc Add support for SIOCGMIIPHY, SIOCGMIIREG and SIOCSMIIREG ioctls and
improve the checking of other interface related ioctls.

Based in part on a patch from Jim McDonald <jim@mcdee.net> supplied
as a fix for bug #83344.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2424
2004-06-17 23:04:58 +00:00
Tom Hughes
05369f9e57 Add support for the semtimedop system call.
Based on patch from Peter Knaggs <sedragdnuon@yahoo.com>.

CCMAIL: 79714-done@bugs.kde.org


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2410
2004-06-13 14:23:00 +00:00
Robert Walsh
d9e00c2c90 Implement syscall 258, for those of use running Fedora Core 2.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2391
2004-04-29 08:40:50 +00:00
Tom Hughes
a159f627cb Make support for the FBIOGET ioctls conditional on linux/fb.h being
present at compile time.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2382
2004-04-22 07:28:43 +00:00
Tom Hughes
e14c5dc6ed Add support for the FBIOGET_VSCREENINFO and FBIOGET_FSCREENINFO ioctls
based on a patch from Paul Olav Tvete <paul@trolltech.com>.

CCMAIL: 77022-done@bugs.kde.org


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2381
2004-04-21 15:52:33 +00:00
Nicholas Nethercote
a9f0026a55 Added acct() syscall.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2352
2004-04-10 00:26:10 +00:00
Jeremy Fitzhardinge
19a82f5eae Fix bug 69872. This change adds a coredumper to vg_signal.c. This means
that when the client is killed by a coredumping signal, Valgrind will
generate the coredump itself, which is full of client state, rather than
Valgrind state; this core file will therefore be useful to the developer
in debugging their program.

The corefile generated is named vgcore.pidNNNNN (and maybe with .M on
the end in case of duplicates).  If you set a logfile with --logfile,
then this name will be used as the basename for the core file, so that
both the core and the logs will be next to each other.

Valgrind respects the RLIMIT_CORE limit when generating the file; if the
limit is set to 0, then it will not generate one.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2312
2004-03-13 02:06:58 +00:00
Jeremy Fitzhardinge
e7b88d999d Fix shmdt by using the right argument for the shared segment address.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2269
2004-02-25 00:07:10 +00:00
Nicholas Nethercote
df8ba4773c Check new fds are not within Valgrind's reserved range. Still one case for
recvmsg() where I'm not sure if it should be checked, and if so, what error
should be returned if the check fails.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2268
2004-02-24 23:57:47 +00:00
Jeremy Fitzhardinge
d03690c430 Fix the use of brk. This change removes the requirement for the "real" brk
segment to be moved up to stage2's brk segment.  Instead, Valgrind's
use of brk is simulated with mmap.  In order to prevent any unwanted use
of the process brk segment, it also sets the RLIMIT_DATA to 0, which will
make brk always fail.  glibc's malloc will use mmap to allocate if brk
fails.  We try to intercept glibc's brk, but malloc seems to always use the
library-internal version.  (The client's use of brk has always been simulated,
and is unaffected by this change.)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2266
2004-02-24 23:42:55 +00:00
Nicholas Nethercote
0ecccb51cb Three CDROM ioctls, from Rocky Bernstein.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2259
2004-02-22 18:08:04 +00:00
Nicholas Nethercote
3b2f2b7d57 Fix so that new versions of system (using clone()) work.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2253
2004-02-15 16:15:05 +00:00
Nicholas Nethercote
500de31850 This patch fixes getrlimit(RLIMIT_FILENO) to return VG_(max_fd) as the soft
limit for file descriptors to try and prevent the target programming realising
that the reserved file descriptors exist. It also appears to fix
sysconf(_SC_OPEN_MAX) so that must be going through the same system call.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2250
2004-02-15 15:32:51 +00:00
Nicholas Nethercote
18b4c5e404 fix code typo
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2249
2004-02-15 15:10:25 +00:00
Nicholas Nethercote
49c135649d Now doing pre_mem_read()s on the args to execve(), so eg. Memcheck can check
them.  Added a regtest for this.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2244
2004-02-12 14:34:14 +00:00
Nicholas Nethercote
b2e8445916 Added support for epoll.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2241
2004-02-10 23:44:15 +00:00
Nicholas Nethercote
24f0c82b8c Patch from Tom Hughes:
Patch to provide a proper environment to the debugger

    Although this patch isn't strictly needed to allow alternative debuggers to
    be used, it is needed if you want to use an X based debugger such as ups
    (and presumably ddd) as VG_(system) has until now passed an empty
    enviroment when starting the debugger but that causes DISPLAY to be lost.

    This patch causes VG_(system) to pass a copy of the client environment
    instead, with the necessary mashing done to clean up the LD_xxx variables.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2233
2004-01-26 17:10:01 +00:00
Nicholas Nethercote
aa5c98c53b Moved stage2.c into vg_main.c. Merged main() and VG_(main)(); VG_(main)()
no longer exists.  One advantage of this is that global
variables/structures needed for communicating between the two can be made
local.  Also, the order in which things happen has been simplified.

This is mostly just a big refactoring.  Startup is now a fair bit easier to
understand.  Dependencies between the various startup stages are fairly well
documented in comments.  Also, --help and --version now work properly --
eg. --help gives tool-specific help if --tool was specified.  There is still
some parts where things could be reordered and/or simplified, and where the
dependencies aren't clear.  These are marked with 'XXX'.

One new feature was added: ability to read options from ~/.valgrindrc and
./.valgrindrc.  Part of this is support for specifying tool-specific options
in the form --toolname:tool-specific-option.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2222
2004-01-24 18:18:54 +00:00
Jeremy Fitzhardinge
75d6dc8434 This change implements the TLS extension to the x86 ABI. This allows
threads to have thread-private data which is quickly accessible via a
segment in the GDT, stored in %gs.  The patch implements the relevent
syscalls (setthreadarea), and also manages switching the VCPU's segment
information at thread context-switch time.  Mostly Tom Hughes' work.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2215
2004-01-21 01:27:27 +00:00
Nicholas Nethercote
e8ceb12795 From Tom Hughes: patch to report port numbers correctly
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2210
2004-01-20 14:43:42 +00:00
Jeremy Fitzhardinge
7def6b371b Fix bug 72484. Set the process signal mask to match the client's before
running exec.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2198
2004-01-16 02:17:30 +00:00
Jeremy Fitzhardinge
aab639348b Fix bug 72650. Only restart syscalls on signal if the client asked for it.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2197
2004-01-16 02:15:23 +00:00
Jeremy Fitzhardinge
3816d99f73 Fix for bug 72006 by Tom Hughes: report proper error returns for mmap()
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2191
2004-01-07 08:44:43 +00:00
Jeremy Fitzhardinge
7d63c9a792 Fix problem with trace-children=yes when using a tool which replaces
malloc.  The problem was that LD_PRELOAD was being left set with
our replacement .so files, which meant they were being applied to
stage1/stage2.  This caused malloc to fail and a subsequent SIGSEGV.
This change unconditionally removes all of Valgrind's special environment
before each execve, since it will be replaced as needed by the child
Valgrind.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2184
2004-01-04 23:52:59 +00:00
Nicholas Nethercote
07b8e3438b Updated copyright dates for 2004. Also added a couple of missing headers and
footers to some new files.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2177
2004-01-04 16:43:23 +00:00
Dirk Mueller
e7fda6bd73 add support for mincore syscall, patch by Tom Hughes
CCMAIL: 69783-done@bugs.kde.org


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2161
2004-01-02 22:52:34 +00:00
Jeremy Fitzhardinge
88892fd58d Re-add proper support for mremap(). Also, fix a bug in munmap().
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2142
2003-12-22 08:48:50 +00:00
Jeremy Fitzhardinge
7a9b741860 Also remove vgpreload_*.so from LD_PRELOAD when we're not tracing
children.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2132
2003-12-19 00:35:20 +00:00
Jeremy Fitzhardinge
ebe35cedb9 Patch from Tom Hughes: set VG_(max_fd) based on the current file
descriptor limit rather than assuming 1024.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2127
2003-12-18 02:39:22 +00:00
Robert Walsh
f3cc076219 Ignore internal Valgrind file descriptors.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2125
2003-12-18 01:48:06 +00:00