Revamped. Split into sections, added stuff about the name "Valgrind" (where it
comes from, pronunciation), removed some obsolete questions, added some new
ones.
Tom Hughes [Wed, 31 Mar 2004 15:23:13 +0000 (15:23 +0000)]
Implement tcdrain in the pthread library. The fact that this function
is missing was reported in bug #70344 but the reporter then closed the
bug saying that they were using the wrong version of valgrind.
Tom Hughes [Sun, 28 Mar 2004 11:26:29 +0000 (11:26 +0000)]
For FPU/MMX/SSE instructions which don't reference any memory, make memcheck
look at whether the eflags are read or written and generate UCode to validate
and/or mark as valid the eflags when necessary.
Tom Hughes [Mon, 22 Mar 2004 19:46:29 +0000 (19:46 +0000)]
Redirect _dl_sysinfo_int80, which is glibc's default system call
routine, to the routine in our trampoline page so that the
special sysinfo unwind hack in vg_execontext.c will kick in.
When creating new threads, initially block all signals. It's up to the
client code (in vg_libpthread.c) to set the appropriate signal mask when
its ready. This prevents a bug where a thread gets sent a signal before
even running any of its initialization code, which can cause problems
(particularly if the signal handler directly or indirectly uses TLS).
This change does two things: one is the implementation of
VG_(synth_fault_*), which synthesize faults as if an instruction had
caused a CPU fault. This is used in two places: one in vg_translate.c,
when trying to fetch instructions from bad memory, and the other in
vg_ldt.c, when using a bad segment register. This fixes a bug where an
assertion would fail rather than getting a useful message.
Julian Seward [Sun, 14 Mar 2004 03:06:37 +0000 (03:06 +0000)]
Modify the memory manager so it "natively" supports 8-byte alignment,
basically by messing with the block layout.
* Move freelist next ptr from before payload to after it
* Ensure payload and red zones always have sizes which are
multiples of 8-bytes.
Seems to work OK. Values returned from the two basic allocator
functions VG_(arena_malloc) and VG_(arena_malloc_aligned) are
vg_asserted to have suitable alignment (== 8, >= 8 && == requested
alignment) respectively.
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.
Fix bug 69856; teach Helgrind about all the new SSE-related UOps.
Haven't actually tested races with all those new memory access
instructions though...
Use Tom's instruction set tests on all tools which do instrumentation, so
we can make it's OK for all instructions. Helgrind is badly broken in this
test (bug 69856).
Raise RLIMIT_AS to max allowable, so that we can create the large mappings
we need to. If the hard limit is set to low, then things will fail as
large mmaps fail.
Tom Hughes [Sun, 7 Mar 2004 19:36:14 +0000 (19:36 +0000)]
Fix the handling of libc thread specific data so that it doesn't rely on
being able to use malloc as the libc malloc tries to use thread specific
data and we wind up in a recursive nightmare.
Fix assertion failure when using VG_(system) near program termination.
The problem is that the use of VG_(system) causes a SIGCHLD to be sent
to the process, which ends up being delivered to one of the proxy LWPs
(which is a small problem in itself, but nothing too bad).
The proxy tells the scheduler LWP about this, and the scheduler LWP sends
a sigACK reply.
Then, while the proxy LWP is in the SigACK state, and the SigACK reply
is still queued in the message pipe, the scheduler LWP starts shutting
Valgrind down, and sends a SIGVGKILL to all proxy LWPs. This causes
the proxy to drop from sigACK state to WaitReq state, and it reads
further commands - one of which is the SigACK message - this causes the
assertion failure.
The fix is to simply make the proxy LWP exit immediately when it gets
a SIGVGKILL, and not process any more requests.
This change also fixes a bug in VG_(system), in which the child process
returns back into Valgrind rather than exiting when exec fails.
Tom Hughes [Sun, 29 Feb 2004 12:02:32 +0000 (12:02 +0000)]
Changed the fdleak tests to explicitly attach /dev/null as the standard
input so that the output is well known regardless of whether the test is
run from a terminal or from cron.
Some newer systems have a new version of pthreadtypes.h that comes from glibc
2.3.3, which is binary-compatible, but not source compatible with the old one,
which came from LinuxThreads. We were using the types defined in the old one,
which caused compilation errors on systems using the new one.
This commit introduces our own versions of these types. Our versions are laid
out identically to the LinuxThreads ones, but the field names are different.
We convert all pthread types to our versions before using them, so we don't
rely on the pthreadtypes.h types any more. Hopefully this will fix the
problem; I have three reports that it does. Let's see...
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.
This fixes bug 75614. It seems that a symbol can be named
"foo<bar::blat>"; normally stabs names are terminated by ':', but we
also need to keep track of <> pairs so we can ignore nested colons.
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.)