]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fix 338698 race condition between gdbsrv and vgdb on startup
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Fri, 5 Sep 2014 23:57:57 +0000 (23:57 +0000)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Fri, 5 Sep 2014 23:57:57 +0000 (23:57 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14475

NEWS
coregrind/m_gdbserver/remote-utils.c

diff --git a/NEWS b/NEWS
index 24f79ab39d823a98161f4a1471526a1f8e0e5118..e16456a18255c2e7cce7c1a61fa13f5b4f8e65f5 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -309,6 +309,7 @@ where XXXXXX is the bug number as listed below.
 338499  --sim-hints parsing broken due to wrong order in tokens
 338615  suppress glibc 2.20 optimized strcmp implementation for ARMv7
 338681  Unable to unwind through clone thread created on i386-linux
+338698  race condition between gdbsrv and vgdb on startup
 338703  helgrind on arm-linux gets false positives in dynamic loader
 n-i-bz  Fix KVM_CREATE_IRQCHIP ioctl handling
 n-i-bz  s390x: Fix memory corruption for multithreaded applications
index 6ee1f7e0534162cd514712125c7d3bf6f2d5f718..aa2cd4ae06e82f552a307c75029f134855c8b57d 100644 (file)
@@ -390,11 +390,6 @@ void remote_open (const HChar *name)
       VG_(unlink)(to_gdb);
       VG_(unlink)(shared_mem);
 
-      safe_mknod(from_gdb);
-      safe_mknod(to_gdb);
-
-      pid_from_to_creator = pid;
-      
       o = VG_(open) (shared_mem, VKI_O_CREAT|VKI_O_RDWR, 0600);
       if (sr_isError (o)) {
          sr_perror(o, "cannot create shared_mem file %s\n", shared_mem);
@@ -421,6 +416,15 @@ void remote_open (const HChar *name)
       }
       shared = (VgdbShared*) addr_shared;
       VG_(close) (shared_mem_fd);
+
+      safe_mknod(to_gdb);
+      safe_mknod(from_gdb);
+      /* from_gdb is the last resource created: vgdb searches such FIFOs
+         to detect the presence of a valgrind process.
+         So, we better create this resource when all the rest needed by
+         vgdb is ready : the other FIFO and the shared memory. */
+
+      pid_from_to_creator = pid;
    }
    
    setup_remote_desc_for_reading ();