public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug testsuite/62060] g++.dg/tsan/cond_race.C triggers heap-use-after-free
Date: Fri, 08 Aug 2014 13:29:00 -0000	[thread overview]
Message-ID: <bug-62060-4-XexBpzJJDb@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-62060-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62060

--- Comment #3 from vries at gcc dot gnu.org ---
Created attachment 33275
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33275&action=edit
script to find differences

It seems we're missing more changes:
...
$ ./find.sh
--- compiler-rt/test/tsan/cond_race.cc    2014-08-08 14:23:28.907916207 +0200
+++ devel/src/gcc/testsuite/g++.dg/tsan/cond_race.C    2014-07-28
09:45:52.277091371 +0200
@@ -6,7 +5,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <pthread.h>
-#include <unistd.h>

 struct Ctx {
   pthread_mutex_t m;
@@ -33,8 +31,6 @@
   while (!c->done)
     pthread_cond_wait(&c->c, &c->m);
   pthread_mutex_unlock(&c->m);
-  // w/o this sleep, it can be reported as use-after-free
-  sleep(1);
   delete c;
   pthread_join(th, 0);
 }
--- compiler-rt/test/tsan/thread_leak2.c    2014-08-08 14:23:28.927916207 +0200
+++ devel/src/gcc/testsuite/c-c++-common/tsan/thread_leak2.c    2014-07-28
09:45:52.185091367 +0200
@@ -1,16 +1,19 @@
+
 #include <pthread.h>
-#include <stdio.h>
+#include <unistd.h>

 void *Thread(void *x) {
   return 0;
 }

 int main() {
+  int i;
+  for (i = 0; i < 5; i++) {
   pthread_t t;
   pthread_create(&t, 0, Thread, 0);
-  pthread_detach(t);
-  printf("PASS\n");
+  }
+  sleep(1);
   return 0;
 }

--- compiler-rt/test/tsan/mutexset1.cc    2014-08-08 14:23:28.919916207 +0200
+++ devel/src/gcc/testsuite/c-c++-common/tsan/mutexset1.c    2014-07-28
16:48:55.546509594 +0200
@@ -16,7 +17,8 @@

 void *Thread2(void *x) {
   Global--;
-  return NULL;
+
 }

 int main() {
@@ -34,4 +29,12 @@
   pthread_join(t[0], NULL);
   pthread_join(t[1], NULL);
   pthread_mutex_destroy(&mtx);
+  return 0;
 }
+
--- compiler-rt/test/tsan/tls_race.cc    2014-08-08 14:23:28.907916207 +0200
+++ devel/src/gcc/testsuite/c-c++-common/tsan/tls_race.c    2014-07-28
09:45:52.185091367 +0200
@@ -1,10 +1,9 @@
+
 #include <pthread.h>
 #include <stddef.h>
-#include <unistd.h>

 void *Thread(void *a) {
-  sleep(1);
   *(int*)a = 43;
   return 0;
 }
--- compiler-rt/test/tsan/atomic_stack.cc    2014-08-08 14:23:28.995916208
+0200
+++ devel/src/gcc/testsuite/c-c++-common/tsan/atomic_stack.c    2014-07-28
09:45:52.185091367 +0200
@@ -21,9 +22,10 @@
   pthread_create(&t[1], NULL, Thread2, NULL);
   pthread_join(t[0], NULL);
   pthread_join(t[1], NULL);
+  return 0;
 }


  parent reply	other threads:[~2014-08-08 13:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-08 10:02 [Bug testsuite/62060] New: " vries at gcc dot gnu.org
2014-08-08 10:29 ` [Bug testsuite/62060] " vries at gcc dot gnu.org
2014-08-08 12:18 ` chefmax at gcc dot gnu.org
2014-08-08 13:29 ` vries at gcc dot gnu.org [this message]
2014-08-08 16:02 ` tetra2005 at gmail dot com
2014-08-08 16:15 ` tetra2005 at gmail dot com
2015-01-12 20:34 ` bernd.edlinger at hotmail dot de
2015-01-13  8:26 ` vries at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-62060-4-XexBpzJJDb@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).