Bug #75601 [NEW]: Thread race in PCRE JIT support
| From: | rperper at litespeedtech dot com | Date: | Thu, 30 Nov 2017 14:23:14 +0000 |
| Subject: | Bug #75601 [NEW]: Thread race in PCRE JIT support | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-212837@lists.php.net to get a copy of this message | ||
From: rperper at litespeedtech dot com
Operating system: OpenSuSE
PHP version: 7.2.0
Package: PCRE related
Bug Type: Bug
Bug description:Thread race in PCRE JIT support
Description:
------------
I am a developer at LiteSpeed Technologies and am working on a
thread-capable version of the PHP module to be included in the
Open-LiteSpeed web server. During load testing, using PCRE with JIT
support enabled (the default) with the thread-sanitizer enabled, we
detected a race condition in sljitUtils.c line 224. It appears that
there are unprotected globals which will never be successful in a
multi-threaded environment. We recommend protecting these globals with
atomic functions, or in some other way to avoid the race conditions.
Test script:
---------------
Can not be reproduced in a script.
Actual result:
--------------
[1m[31mWARNING: ThreadSanitizer: data race (pid=49992)
[1m[0m[1m[34m Read of size 8 at 0x7ffff4de1798 by thread T2
(mutexes: write M546):
[1m[0m #0 sljit_allocate_stack
/home/user/proj/openlitespeed/src/modules/mod_lsphp/php-7.2/ext/pcre/pcrelib/sljit/sljitUtils.c:224
(mod_lsphp72.so+0x000000323c2f)
#1 php_pcre_jit_stack_alloc
/home/user/proj/openlitespeed/src/modules/mod_lsphp/php-7.2/ext/pcre/pcrelib/pcre_jit_compile.c:11625
(mod_lsphp72.so+0x000000323b9f)
#2 zm_activate_pcre
/home/user/proj/openlitespeed/src/modules/mod_lsphp/php-7.2/ext/pcre/php_pcre.c:229
(mod_lsphp72.so+0x00000037f31b)
#3 zend_activate_modules
/home/user/proj/openlitespeed/src/modules/mod_lsphp/php-7.2/Zend/zend_API.c:2600
(mod_lsphp72.so+0x0000012ebfab)
#4 php_request_startup
/home/user/proj/openlitespeed/src/modules/mod_lsphp/php-7.2/main/main.c:1696
(mod_lsphp72.so+0x0000010c528e)
#5 lsiapi_module_main
/home/user/proj/openlitespeed/src/modules/mod_lsphp/php-7.2/sapi/mod_lsphp/mod_lsphp.c:1489
(mod_lsphp72.so+0x000001586250)
#6 process_req
/home/user/proj/openlitespeed/src/modules/mod_lsphp/php-7.2/sapi/mod_lsphp/mod_lsphp.c:1536
(mod_lsphp72.so+0x0000015847c5)
#7 mod_lsphp_begin_process
/home/user/proj/openlitespeed/src/modules/mod_lsphp/php-7.2/sapi/mod_lsphp/mod_lsphp.c:1667
(mod_lsphp72.so+0x00000157f3a0)
#8 MtHandlerProcess(ls_lfnodei_s*)
/home/user/proj/openlitespeed/src/lsiapi/modulehandler.cpp:46
(openlitespeed+0x00000088ced5)
#9 WorkCrew::workerRoutine(CrewWorker*)
/home/user/proj/openlitespeed/src/thread/workcrew.cpp:448
(openlitespeed+0x000000944a11)
#10 CrewWorker::thr_main(void*)
/home/user/proj/openlitespeed/src/thread/crewworker.cpp:36
(openlitespeed+0x00000094531e)
#11 Thread::start_routine(void*)
/home/user/proj/openlitespeed/src/thread/thread.cpp:43
(openlitespeed+0x000000942657)
--
Edit bug report at https://bugs.php.net/bug.php?id=75601&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75601&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75601&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75601&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=75601&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=75601&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=75601&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=75601&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=75601&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=75601&r=support
Expected behavior: https://bugs.php.net/fix.php?id=75601&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=75601&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=75601&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=75601&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75601&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=75601&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=75601&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=75601&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=75601&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=75601&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=75601&r=mysqlcfg