[Pcre-svn] [514] code/trunk: A racing condition is fixed in …

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [514] code/trunk: A racing condition is fixed in JIT reported by Mozilla.
Revision: 514
          http://www.exim.org/viewvc/pcre2?view=rev&revision=514
Author:   zherczeg
Date:     2016-05-19 19:09:07 +0100 (Thu, 19 May 2016)
Log Message:
-----------
A racing condition is fixed in JIT reported by Mozilla.


Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/src/sljit/sljitUtils.c


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2016-05-14 16:35:20 UTC (rev 513)
+++ code/trunk/ChangeLog    2016-05-19 18:09:07 UTC (rev 514)
@@ -106,7 +106,9 @@
 "private" knowledge of the data structures. This is unnecessary; the code has 
 been re-factored and no longer includes pcre2_internal.h.


+25. A racing condition is fixed in JIT reported by Mozilla.

+
Version 10.21 12-January-2016
-----------------------------


Modified: code/trunk/src/sljit/sljitUtils.c
===================================================================
--- code/trunk/src/sljit/sljitUtils.c    2016-05-14 16:35:20 UTC (rev 513)
+++ code/trunk/src/sljit/sljitUtils.c    2016-05-19 18:09:07 UTC (rev 514)
@@ -182,7 +182,10 @@
 static SLJIT_INLINE sljit_s32 open_dev_zero(void)
 {
     pthread_mutex_lock(&dev_zero_mutex);
-    dev_zero = open("/dev/zero", O_RDWR);
+    /* The dev_zero might be initialized by another thread during the waiting. */
+    if (dev_zero < 0) {
+        dev_zero = open("/dev/zero", O_RDWR);
+    }
     pthread_mutex_unlock(&dev_zero_mutex);
     return dev_zero < 0;
 }