You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Ralf S. Engelschall" <rs...@engelschall.com> on 1998/06/10 16:27:24 UTC

Problem: buggy regex, WANTHSREGEX no chance

Hmmm... there is a subtle problem with the regex stuff:

  - platform is AIX (or any other with a broken regex lib)

  - Apache is compiled with all modules as DSO

  - the regex library of the system is broken,
    for instance some mod_rewrite rules like
    RewriteRule    .*/afp:.*       http://www.helios.de/afpengage.html
    RewriteRule    .*/afp/.*       http://www.helios.de/afpengage.html
    cause a SIGSEGV inside the regexec() functions.

  - WANTHSREGEX has no effect.

Why? Because the DSO's are not linked against the HS regex lib, so even with
WANTHSREGEX the broken system lib is linked against the DSO. Bang!

We first have to set WANTHSREGEX for AIX, of course. But what can we do to
workaround the linking problem? The only thing the guy who has discovered the
above problem (Jens-Uwe Mager) and I know would be to use ap_regxxx() wrappers
in the Apache core. Then the HS regex lib is linked with the core
and modules get the correct symbols.

Any ideas or suggestions?
                                       Ralf S. Engelschall
                                       rse@engelschall.com
                                       www.engelschall.com

Re: Problem: buggy regex, WANTHSREGEX no chance

Posted by Jens-Uwe Mager <ju...@helios.de>.
On Wed, Jun 10, 1998 at 04:19:12PM -0700, Dean Gaudet wrote:

> Right, doesn't that mean that we've just omitted the right symbol
> information for the regex stuff?

This is what I thought at first as well. I did add the regexec et al.
symbols to the httpd.exp file to export these from the core httpd (the
core was linked against HSREGEX). Unfortunately the dynamic linker then
has two versions of the same symbol to choose from, and in my case (as
per Murphy) it did choose the regexec from libc while running the
mod_rewrite module.

This is why I came up with the idea of an ap_regex*() api, this way any
module will use whatever the core is linked against, even a replacement
version as in the case of the broken one in the AIX libc.

-- 
Jens-Uwe Mager

HELIOS Software GmbH
Steinriede 3
30827 Garbsen
Germany

Phone:		+49 5131 709320
FAX:		+49 5131 709325
Internet:	jum@helios.de

Re: Problem: buggy regex, WANTHSREGEX no chance

Posted by Dean Gaudet <dg...@arctic.org>.

On Thu, 11 Jun 1998, Jens-Uwe Mager wrote:


> The AIX shared library concept is a bit unusual as it introduces a new
> scope for symbols beyond what standard C provides, namely exported
> symbols that are global across multiple load modules. Most ELF based
> symbols simply make C global symbols also global across load modules.

Right, doesn't that mean that we've just omitted the right symbol
information for the regex stuff?

Dean


Re: Problem: buggy regex, WANTHSREGEX no chance

Posted by Jens-Uwe Mager <ju...@helios.de>.
On Wed, Jun 10, 1998 at 02:15:02PM -0700, Dean Gaudet wrote:
> This is still a problem if you add -Lregex -lregex when building the
> shared library?

No, this works fine for my problem case. It embeds a copy of the
HSREGEX routines in every module referencing it, though. This also
means that you get a seperate copy of the global and static variables
of these routines for every .so module. I do not know enough about
HSREGEX and apache if any modules pass these compiled data structures
across module boundaries and if there is any global state associated
beyond the malloc area.

I could imagine a situation where passing a regex compiled in one
module freed in another module would not find any global state
associated, as each module has its own instantiation of the global and
static variables.

The AIX shared library concept is a bit unusual as it introduces a new
scope for symbols beyond what standard C provides, namely exported
symbols that are global across multiple load modules. Most ELF based
symbols simply make C global symbols also global across load modules.

-- 
Jens-Uwe Mager

HELIOS Software GmbH
Steinriede 3
30827 Garbsen
Germany

Phone:		+49 5131 709320
FAX:		+49 5131 709325
Internet:	jum@helios.de

Re: Problem: buggy regex, WANTHSREGEX no chance

Posted by Dean Gaudet <dg...@arctic.org>.
This is still a problem if you add -Lregex -lregex when building the
shared library?

Dean

On Wed, 10 Jun 1998, Ralf S. Engelschall wrote:

> 
> Hmmm... there is a subtle problem with the regex stuff:
> 
>   - platform is AIX (or any other with a broken regex lib)
> 
>   - Apache is compiled with all modules as DSO
> 
>   - the regex library of the system is broken,
>     for instance some mod_rewrite rules like
>     RewriteRule    .*/afp:.*       http://www.helios.de/afpengage.html
>     RewriteRule    .*/afp/.*       http://www.helios.de/afpengage.html
>     cause a SIGSEGV inside the regexec() functions.
> 
>   - WANTHSREGEX has no effect.
> 
> Why? Because the DSO's are not linked against the HS regex lib, so even with
> WANTHSREGEX the broken system lib is linked against the DSO. Bang!
> 
> We first have to set WANTHSREGEX for AIX, of course. But what can we do to
> workaround the linking problem? The only thing the guy who has discovered the
> above problem (Jens-Uwe Mager) and I know would be to use ap_regxxx() wrappers
> in the Apache core. Then the HS regex lib is linked with the core
> and modules get the correct symbols.
> 
> Any ideas or suggestions?
>                                        Ralf S. Engelschall
>                                        rse@engelschall.com
>                                        www.engelschall.com
>