You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Tony Finch <do...@dotat.at> on 2001/01/04 04:23:15 UTC

Re: mod_so/7008: Hard-coded dlopen flags (RTLD_GLOBAL) Ref: mod_so.c and unix.c

Gopi Krishna Bhavaraju <go...@pspl.co.in> wrote:
>
>If two modules are have same function name define in them the Solaris 
>operationg system always uses the first definition available at run-time
>as these modules are loaded using RTLD_GLOBAL flag, which leads to 
>core dump.
>
>However it works fine if I load them using RTLD_LOCAL flag in
>ap_dso_load() function in file src/os/unix/os.c.
>
>That means each module code space is not protected by Apache web-server
>at run-time, unless I modify the Apache source code itself, which I 
>can not do as my modules will be used for proprietory purposes.

Can anyone explain the following log message from src/os/unix/os.c in
more detail? What sort of modules are "their own modules"? Language
extension modules or Apache modules?

revision 1.12
date: 1998/07/10 18:29:50;  author: rasmus;  state: Exp;  lines: +2 -2
Set the RTLD_GLOBAL dlopen mode parameter to allow dynamically loaded
modules to load their own modules dynamically.  This improves mod_perl
and mod_php3 when these modules are loaded dynamically into Apache.

Tony.
-- 
f.a.n.finch    fanf@covalent.net    dot@dotat.at
"Because all you of Earth are idiots!"

Re: mod_so/7008: Hard-coded dlopen flags (RTLD_GLOBAL) Ref: mod_so.c and unix.c

Posted by Tony Finch <do...@dotat.at>.
OK, I thought it would be something like that. I've closed the PR
giving the submitter the obvious work-arounds.

Tony.
-- 
f.a.n.finch    fanf@covalent.net    dot@dotat.at
"Then they attacked a town. A small town, I'll admit.
But nevertheless a town of people. People who died."

Re: mod_so/7008: Hard-coded dlopen flags (RTLD_GLOBAL) Ref: mod_so.c and unix.c

Posted by "Theo E. Schlossnagle" <je...@omniti.com>.
If you dlopen mod_backhand.so and then mod_backhand goes and dl_open()'s other
shared objects, things can get screwy.  Solaris is really picky about this.  I
still have problems with mod_backhand not being able to dynamically load
candidacy functions if mod_backhand itself is shared on Solaris.  For some
reason if you dlopen() with RTLD_GLOBAL, things play much nicer.

Tony Finch wrote:
> revision 1.12
> date: 1998/07/10 18:29:50;  author: rasmus;  state: Exp;  lines: +2 -2
> Set the RTLD_GLOBAL dlopen mode parameter to allow dynamically loaded
> modules to load their own modules dynamically.  This improves mod_perl
> and mod_php3 when these modules are loaded dynamically into Apache.

-- 
Theo Schlossnagle
1024D/A8EBCF8F/13BD 8C08 6BE2 629A 527E  2DC2 72C2 AD05 A8EB CF8F
2047R/33131B65/71 F7 95 64 49 76 5D BA  3D 90 B9 9F BE 27 24 E7

Re: mod_so/7008: Hard-coded dlopen flags (RTLD_GLOBAL) Ref: mod_so.c and unix.c

Posted by Doug MacEachern <do...@covalent.net>.
it also means that a dynamic Perl or PHP extension can hook into modules
pulled in by LoadModule.  for example, Apache::Request (Apache/Request.so)
references symbols that live in modperl.so, Apache::Backhand
(Apache/Backhand.so) references symbols that live in mod_backhand.so.
dlopen() with the global flag allows the extensions to resolve these
symbols at runtime.

i do think there should be a flags parameter to apr_dso_load() and an
optional flags parameter for LoadModule that is fed to it, something like:

#defaults to global
LoadModule foo_module mod_foo.so

#same as default
LoadModule foo_module mod_foo.so DL_GLOBAL

#does not use the global flag
LoadModule foo_module mod_foo.so DL_LOCAL

if there are compat issues, we could add a new apr_dso_load_flags() and
apr_dso_load() just becomes a wrapper around that.