to implement this functionality reliably.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11522
+Release 3.6.0 (... 2011)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+DRD: removed command-line option --free-is-write again since it is impossible
+to implement this functionality reliably.
+
+
Release 3.6.0 (21 October 2010)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3.6.0 is a feature release with many significant improvements and the
</para>
</listitem>
</varlistentry>
- <varlistentry>
- <term>
- <option>
- <![CDATA[--free-is-write=<yes|no> [default: no]]]>
- </option>
- </term>
- <listitem>
- <para>
- Whether to report accessing freed memory as a race. Helps to detect
- memory accesses that occur after memory has been freed but might cause
- DRD to run slightly slower.
- </para>
- </listitem>
- </varlistentry>
<varlistentry>
<term>
<option>
/* Local variables. */
-static Bool s_free_is_write = False;
static Bool s_print_stats = False;
static Bool s_var_info = False;
static Bool s_show_stack_usage = False;
if VG_BOOL_CLO(arg, "--check-stack-var", check_stack_accesses) {}
else if VG_BOOL_CLO(arg, "--drd-stats", s_print_stats) {}
else if VG_BOOL_CLO(arg, "--first-race-only", first_race_only) {}
- else if VG_BOOL_CLO(arg, "--free-is-write", s_free_is_write) {}
else if VG_BOOL_CLO(arg,"--report-signal-unlocked",report_signal_unlocked)
{}
else if VG_BOOL_CLO(arg, "--segment-merging", segment_merging) {}
" time (in milliseconds) [off].\n"
" --first-race-only=yes|no Only report the first data race that occurs on\n"
" a memory location instead of all races [no].\n"
-" --free-is-write=yes|no Whether to report races between freeing memory\n"
-" and subsequent accesses of that memory[no].\n"
" --report-signal-unlocked=yes|no Whether to report calls to\n"
" pthread_cond_signal() where the mutex associated\n"
" with the signal via pthread_cond_wait() is not\n"
if (!is_stack_mem || DRD_(get_check_stack_accesses)())
{
- DRD_(thread_stop_using_mem)(a1, a2, !is_stack_mem && s_free_is_write);
+ DRD_(thread_stop_using_mem)(a1, a2, False);
DRD_(clientobj_stop_using_mem)(a1, a2);
DRD_(suppression_stop_using_mem)(a1, a2);
}
- if (!is_stack_mem && s_free_is_write)
- DRD_(trace_store)(a1, len);
}
static __inline__
qt4_rwlock.vgtest \
qt4_semaphore.stderr.exp \
qt4_semaphore.vgtest \
- read_after_free.stderr.exp \
- read_after_free.vgtest \
recursive_mutex.stderr.exp-linux \
recursive_mutex.stderr.exp-darwin \
recursive_mutex.vgtest \
annotate_smart_pointer \
atomic_var \
circular_buffer \
- read_after_free \
tsan_unittest
endif
+++ /dev/null
-#define _GNU_SOURCE 1
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <pthread.h>
-
-static char* s_mem;
-static volatile int s_freed;
-
-static void* thread_func(void* arg)
-{
- // Busy-wait until pthread_create() has finished.
- while (s_freed == 0)
- pthread_yield();
- free(s_mem);
- __sync_add_and_fetch(&s_freed, 1);
- return NULL;
-}
-
-int main(int argc, char** argv)
-{
- pthread_t tid;
- int quiet;
- char result;
-
- quiet = argc > 1;
-
- s_mem = malloc(10);
- if (!quiet)
- fprintf(stderr, "Pointer to allocated memory: %p\n", s_mem);
- assert(s_mem);
- pthread_create(&tid, NULL, thread_func, NULL);
- __sync_add_and_fetch(&s_freed, 1);
- // Busy-wait until the memory has been freed.
- while (s_freed == 1)
- pthread_yield();
- // Read-after-free.
- result = s_mem[0];
- if (!quiet)
- fprintf(stderr, "Read-after-free result: %d\n", result);
- pthread_join(tid, NULL);
- fprintf(stderr, "Done.\n");
- return 0;
-}
+++ /dev/null
-
-Conflicting load by thread 1 at 0x........ size 1
- at 0x........: main (read_after_free.c:?)
-Allocation context: unknown.
-
-Done.
-
-ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
+++ /dev/null
-prereq: test -e read_after_free && ./supported_libpthread
-vgopts: --read-var-info=yes --check-stack-var=yes --free-is-write=yes --show-confl-seg=no
-prog: read_after_free
-args: -q