diff --git a/ChangeLog b/ChangeLog index 9f384fd..754d0e5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -106,6 +106,8 @@ additions). "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 ----------------------------- diff --git a/src/sljit/sljitUtils.c b/src/sljit/sljitUtils.c index 6bd17e5..ec5c321 100644 --- a/src/sljit/sljitUtils.c +++ b/src/sljit/sljitUtils.c @@ -182,7 +182,10 @@ static pthread_mutex_t dev_zero_mutex = PTHREAD_MUTEX_INITIALIZER; 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; }