You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by François <fr...@gmail.com> on 2006/11/22 14:15:06 UTC

[PATCH] segfault in httpd-2.0.59, probably namespace conflict between libpcre and libc

Hi,

On Debian Sarge 3.1 rev2, httpd compiled with external libpcre 4.x and some
RewriteRules segfault occurs every time we start the daemon.
With a stacktrace :
#0  0xb7c66094 in mallopt () from /lib/tls/i686/cmov/libc.so.6
#1  0xb7c64ffb in free () from /lib/tls/i686/cmov/libc.so.6
#2  0xb7ca7bc3 in regfree () from /lib/tls/i686/cmov/libc.so.6
#3  0x080b9676 in regex_cleanup ()
#4  0xb7dc569f in run_cleanups () from /realsentry/wsp/engine-2.0
/lib/libapr-0.so.0
#5  0xb7dc4b13 in apr_pool_clear () from
/realsentry/wsp/engine-2.0/lib/libapr-0.so.0
#6  0x080b7831 in main ()

We can see that regfree() from libc is called, but it seems that the pointer
was returned by regcomp() from libpcre.

After a quick reading of httpd/server/util.c, it appears ap_pregcomp,
ap_pregfree, ap_regerror and ap_regexec call respectively regcomp(),
regfree(),
regerror() and regexec(). httpd is linked with both libc and libpcre that
both
export these 4 functions.

I tried to patch util.c to avoid the use of function with the same name than
libc ones. Basically this patch is a move of the code from pcreposix.c into
util.c, to use directly function from pcre (with pcre_ namespace) in httpd.

cheers,
-- 
*Francois Pesce*

Re: [PATCH] segfault in httpd-2.0.59, probably namespace conflict between libpcre and libc

Posted by Joe Orton <jo...@redhat.com>.
On Wed, Nov 22, 2006 at 02:15:06PM +0100, François wrote:
> On Debian Sarge 3.1 rev2, httpd compiled with external libpcre 4.x and some
> RewriteRules segfault occurs every time we start the daemon.

2.0.x doesn't support use of external PCRE, this should be reported to 
Debian directly since it's something patched in.

2.2.x supports the external PCRE and doesn't have the problem you 
describe from directly calling the POSIX regex.h functions.

Regards,

joe