[Date Prev][Date Next]
Glibc regex concurrency issues (Was: (ITS#3932) regex/librewrite concurrency issue
- To: openldap-devel@OpenLDAP.org
- Subject: Glibc regex concurrency issues (Was: (ITS#3932) regex/librewrite concurrency issue
- From: Pierangelo Masarati <email@example.com>
- Date: Sun, 14 Aug 2005 11:40:12 +0200
- In-reply-to: <200508132116.j7DLGPXI055925@boole.openldap.org>
- References: <200508132116.j7DLGPXI055925@boole.openldap.org>
- User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050524 CentOS/1.7.8-126.96.36.199.centos3
Whil einvestigating some odd issue I recently had with librewrite while
running test039 on multiple CPU machines, I found that I was getting odd
coredumps when 2 threads accessed the same regex_t inside librewrite.
The problem occurred inside the internals of regexec(), and my glibc
(2.3.4) does not have symbols in, so I couldn't trace the exact place.
However, before going to compiling my own glibc, I searched glibc's CVS
and I found that there might be an issue, although I couldn't find a
precise bug notification. Looking at
it appears that in HEAD some concurrency issue was recently solved.
This fix has been merged into released code between 2.3.4 and 2.3.5, so
I suspect that my glibc, and many before 2.3.5, may suffer from the same
Now the point is: since wrapping regex calls 'round mutextes seemed to
cure my problem, and since regex is used in librewrite, ACLs,
authz-regexp, and limits, should we provide a compile switch to protect
regex if one fears its implementation may not be thread safe? I've
prepared a patch for this (I note that the patch I submitted with
ITS#3932 is incomplete: the file <libraries/lblutil/regex.c> is missing,
so I'm posting it now). This problem is not OpenLDAP specific, but
given the impact of regex on OpenLDAP software, and the impact of
rebuilding glibc (other implementations of regex may suffer from the
same problem) on production systems which cannot undergo an upgrade
shortly, I'd prefer to provide a workaround for those that require it.
SysNet - via Dossi,8 27100 Pavia Tel: +390382573859 Fax: +390382476497