You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by Gopi Krishna Bhavaraju <go...@pspl.co.in> on 2000/12/22 11:09:33 UTC
mod_so/7008: Hard-coded dlopen flags (RTLD_GLOBAL) Ref: mod_so.c and unix.c
>Number: 7008
>Category: mod_so
>Synopsis: Hard-coded dlopen flags (RTLD_GLOBAL) Ref: mod_so.c and unix.c
>Confidential: no
>Severity: critical
>Priority: medium
>Responsible: apache
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: apache
>Arrival-Date: Fri Dec 22 02:10:01 PST 2000
>Closed-Date:
>Last-Modified:
>Originator: gopi@pspl.co.in
>Release: 1.3.12 and 1.3.14
>Organization:
apache
>Environment:
SunOS ultra 5.6 Generic_105181-13 sun4u sparc SUNW,Ultra-5_10
>Description:
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.
>How-To-Repeat:
Load two modules using DSO mechanism which have a same function defined in
them with different body or use dlopen function in one of them. And get a
happy core dump.
>Fix:
Parameterize the dlopen flags for "LoadModule" directive to
specify the scope(RTLD_GLOBAL or RTLD_LOCALE) of the module
to be loaded in the httpd.conf file.
>Release-Note:
>Audit-Trail:
>Unformatted:
[In order for any reply to be added to the PR database, you need]
[to include <ap...@Apache.Org> in the Cc line and make sure the]
[subject line starts with the report component and number, with ]
[or without any 'Re:' prefixes (such as "general/1098:" or ]
["Re: general/1098:"). If the subject doesn't match this ]
[pattern, your message will be misfiled and ignored. The ]
["apbugs" address is not added to the Cc line of messages from ]
[the database automatically because of the potential for mail ]
[loops. If you do not include this Cc, your reply may be ig- ]
[nored unless you are responding to an explicit request from a ]
[developer. Reply only with text; DO NOT SEND ATTACHMENTS! ]
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.
Re: mod_so/7008: Hard-coded dlopen flags (RTLD_GLOBAL) Ref: mod_so.c and unix.c
Posted by Tony Finch <do...@dotat.at>.
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!"