|
From: Bart V. A. <bar...@gm...> - 2006-08-14 17:03:35
|
On 3/19/06, Julian Seward <js...@ac...> wrote: > My view is, this first phase is to construct a proof-of-concept > patch which we can play with a bit, to see how well it works. > If that looks good then the next stage is to consider the cleanest > way to integrate it. As a result, in this first stage it doesn't > matter much if there are ugly infrastructure hacks. > A proof-of-concept version of drd is available at the following location: http://home.scarlet.be/~bvassche/drd/valgrind-5999.patch (apply it with patch -p0 <...) http://home.scarlet.be/~bvassche/drd/valgrind-5999-drd-2006-08-14.tar.bz2(extract with tar xjf ...) This version is not yet ready for a release -- e.g. it does not yet support floating-point instructions, and uses more memory than acceptable for some test cases. But it works well enough to demonstrate the DIOTA data race detection algorithm. And for the cases I tested, it works consistenly and reliably. After running the following commands ./autogen.sh && ./configure --prefix=$PWD/inst && make install the drd tool can be started e.g. on the unit test fp_race. This test program accesses the static variable s_d3 from two different threads. When started without command line options, s_d3 is accessed without locking (triggers a race condition). When started with command line option -m, s_d3 accesses are guarded by a mutex (no race condition on s_d3). This is reported correctly by the drd tool: $ inst/bin/valgrind --tool=drd drd/tests/fp_race ==5637== drd, a data race detector. ==5637== Copyright (C) 2006, and GNU GPL'd, by Bart Van Assche. THIS SOFTWARE IS A PROTOTYPE, AND IS NOT YET RELEASED ==5637== Using LibVEX rev 1579, a library for dynamic binary translation. ==5637== Copyright (C) 2004-2006, and GNU GPL'd, by OpenWorks LLP. ==5637== Using valgrind-3.3.0.SVN, a dynamic binary instrumentation framework. ==5637== Copyright (C) 2000-2006, and GNU GPL'd, by Julian Seward et al. ==5637== For more details, rerun with: -v ==5637== &s_d1 = 0x8049cf8; &s_d2 = 0x8049d00; &s_d3 = 0x8049d08 ==5637== Detected data races. Context: ==5637== 1st segment start (VG t 2, kernel t 5638, POSIX t 78117792) ==5637== at 0x421A648: clone (in /lib/libc-2.4.so) ==5637== ==5637== 1st segment end (VG t 2, kernel t 5638, POSIX t 78117792) ==5637== at 0x40423BD: start_thread (in /lib/libpthread-2.4.so) ==5637== by 0x421A65D: clone (in /lib/libc-2.4.so) ==5637== ==5637== 2nd segment start (VG t 1, kernel t 5637, POSIX t 69721984) ==5637== at 0x421A648: clone (in /lib/libc-2.4.so) ==5637== by 0x40429BC: pthread_create@@GLIBC_2.1 (in /lib/libpthread- 2.4.so) ==5637== by 0x401CAAF: pthread_create@* (vg_preloaded.c:135) ==5637== by 0x804884C: main (fp_race.cpp:97) ==5637== ==5637== 2nd segment end (VG t 1, kernel t 5637, POSIX t 69721984) ==5637== at 0x401C4FA: pthread_join (vg_preloaded.c:164) ==5637== by 0x8048876: main (fp_race.cpp:108) ==5637== ==5637== Actual data races: ==5637== Thread 2: ==5637== 0x0401B310 sz 4 W W (_rtld_local (offset 752, size 1524) in /lib/ld-2.4.so, ld-linux.so.2:Data) ==5637== at 0x40423BD: start_thread (in /lib/libpthread-2.4.so) ==5637== by 0x421A65D: clone (in /lib/libc-2.4.so) ==5637== ==5637== 0x0401E47D sz 1 R W (unknown) ==5637== at 0x40423BD: start_thread (in /lib/libpthread-2.4.so) ==5637== by 0x421A65D: clone (in /lib/libc-2.4.so) ==5637== ==5637== 0x04A7FC04 sz 4 W W (stack of VG t 2; kernel t 5638; POSIX t 78117792) ==5637== at 0x40423BD: start_thread (in /lib/libpthread-2.4.so) ==5637== by 0x421A65D: clone (in /lib/libc-2.4.so) ==5637== ==5637== 0x04A7FD9C sz 4 R W (stack of VG t 2; kernel t 5638; POSIX t 78117792) ==5637== at 0x40423BD: start_thread (in /lib/libpthread-2.4.so) ==5637== by 0x421A65D: clone (in /lib/libc-2.4.so) ==5637== ==5637== 0x08049D08 sz 8 W W (s_d3 (offset 0, size 8) in /home/bart/software/valgrind-svn/drd/tests/fp_race, NONE:BSS) ==5637== at 0x40423BD: start_thread (in /lib/libpthread-2.4.so) ==5637== by 0x421A65D: clone (in /lib/libc-2.4.so) ==5637== ==5637== 0xBEFF5F60 sz 8 R W (stack of VG t 1; kernel t 5637; POSIX t 69721984) ==5637== at 0x40423BD: start_thread (in /lib/libpthread-2.4.so) ==5637== by 0x421A65D: clone (in /lib/libc-2.4.so) ==5637== ==5637== 0xBEFF5F68 sz 4 W W (stack of VG t 1; kernel t 5637; POSIX t 69721984) ==5637== at 0x40423BD: start_thread (in /lib/libpthread-2.4.so) ==5637== by 0x421A65D: clone (in /lib/libc-2.4.so) ==5637== End of detected data races ==5637== ==5637== ERROR SUMMARY: 7 errors from 7 contexts (suppressed: 0 from 0) > inst/bin/valgrind --tool=drd drd/tests/fp_race -m ==5650== drd, a data race detector. ==5650== Copyright (C) 2006, and GNU GPL'd, by Bart Van Assche. THIS SOFTWARE IS A PROTOTYPE, AND IS NOT YET RELEASED ==5650== Using LibVEX rev 1579, a library for dynamic binary translation. ==5650== Copyright (C) 2004-2006, and GNU GPL'd, by OpenWorks LLP. ==5650== Using valgrind-3.3.0.SVN, a dynamic binary instrumentation framework. ==5650== Copyright (C) 2000-2006, and GNU GPL'd, by Julian Seward et al. ==5650== For more details, rerun with: -v ==5650== &s_d1 = 0x8049cf8; &s_d2 = 0x8049d00; &s_d3 = 0x8049d08 ==5650== ==5650== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) |