rse 98/03/25 01:44:49
Modified: . STATUS
src CHANGES
src/modules/standard mod_so.c
Log:
Make shared object loading work again (now that -DHIDE is the default).
Distributed modules are loaded with AP_<name>_module and custom
modules are now loaded with the fallback strategy via <name>_module
(because their <name>_module is not and canno be hidden by hide.h).
Revision Changes Path
1.205 +2 -0 apache-1.3/STATUS
Index: STATUS
===================================================================
RCS file: /export/home/cvs/apache-1.3/STATUS,v
retrieving revision 1.204
retrieving revision 1.205
diff -u -r1.204 -r1.205
--- STATUS 1998/03/23 07:42:09 1.204
+++ STATUS 1998/03/25 09:44:44 1.205
@@ -102,6 +102,8 @@
* Ralf's reanim. of undocum. directive: ProxyReceiveBufferSize, PR#1348
* Ralf's mod_proxy fix to use FTP SIZE response for Content-Length,
PR#1183
* Ralf's change to make the shared object compilation command more
portable
+ * Dean's protect against FD_SETSIZE mismatches
+ * Ralf's fallback stategy because of HIDE for loading shared object
modules
Available Patches:
1.731 +5 -0 apache-1.3/src/CHANGES
Index: CHANGES
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
retrieving revision 1.730
retrieving revision 1.731
diff -u -r1.730 -r1.731
--- CHANGES 1998/03/25 02:57:19 1.730
+++ CHANGES 1998/03/25 09:44:46 1.731
@@ -1,4 +1,9 @@
Changes with Apache 1.3b6
+
+ *) Finally fix the shared object loading by using a fallback strategy to
+ overcome the HIDE feature problematic without loosing special cases.
Also
+ a huge comment was added to mod_so.c to make the situation more clear
+ for the future. [Ralf S. Engelschall]
*) Protect against FD_SETSIZE mismatches. [Dean Gaudet]
1.15 +66 -9 apache-1.3/src/modules/standard/mod_so.c
Index: mod_so.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_so.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- mod_so.c 1998/03/23 15:44:15 1.14
+++ mod_so.c 1998/03/25 09:44:48 1.15
@@ -222,6 +222,7 @@
so_server_conf *sconf;
moduleinfo *modi;
moduleinfo *modie;
+ char *modname_hidden;
int i;
/*
@@ -240,7 +241,53 @@
modi->name = modname;
/*
- * Actually load the file into the address space
+ * NOW COMES THE PROBLEMATIC PART:
+ *
+ * Because of the -DHIDE/hide.h feature of Apache 1.3 we have eight
+ * situations from which four doesn't work at all and four are a bit
+ * different because of the AP_ hiding stuff and the fact that this
symbol
+ * hiding applies only to distributed modules.
+ *
+ * Apache ...... means the Apache code itself
+ * S-Module .... means a standard module which is distributed with Apache
+ * C-Module .... means a custom module which is not distributed with
Apache
+ * HIDE ........ means -DHIDE was used when compiling
+ * !HIDE ....... means -DHIDE was not used when compiling
+ * xxx ......... means the symbol "<name>_module" of the module structure
+ *
+ * Resolving| dlopen() dlsym()
+ * | (implicit) (explicit)
+ * Situation | core->module core<-module
+ * ------------------------------+-----------------------------------
+ * The compatible variants: |
+ * Apache+!HIDE & S-Module+!HIDE | succeeds succeeds only w/ xxx
+ * Apache+ HIDE & S-Module+ HIDE | succeeds succeeds only w/ AP_xxx
+ * Apache+!HIDE & C-Module+!HIDE | succeeds succeeds only w/ xxx
+ * Apache+ HIDE & C-Module+ HIDE | succeeds succeeds only w/ xxx
<<==
+ * The incompatible variants: |
+ * Apache+!HIDE & S-Module+ HIDE | fails would succeed w/ AP_xxx
+ * Apache+ HIDE & S-Module+!HIDE | fails would succeed w/ xxx
+ * Apache+!HIDE & C-Module+ HIDE | fails would succeed w/ xxx
+ * Apache+ HIDE & C-Module+!HIDE | fails would succeed w/ xxx
+ *
+ * In other words: For the incompatible variants where the Apache core
was
+ * built with a different setting than the ones the module was compiled
+ * with, we have no chance at all because the implicit resolving of
+ * Apache's core symbols in dlopen() already fails for the module
(because
+ * for instance the module needs palloc while Apache exports AP_palloc).
+ *
+ * So, only for the compatible variants we have a chance. And here we
+ * succeed by always trying to resolve the plain xxx symbol and only for
+ * the case of a distributed standard module we have to resolve via the
+ * AP_xxx variant. Because we cannot decide if the module to be loaded is
+ * a distributed one or a custom one we really have to try both: First
for
+ * AP_xxx and if this fails additionally for xxx.
+ *
+ * -- rse
+ */
+
+ /*
+ * Load the file into the Apache address space
*/
if (!(modhandle = os_dl_load(szModuleFile))) {
const char *my_error = os_dl_error();
@@ -252,21 +299,31 @@
aplog_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, NULL,
"loaded module %s", modname);
-#ifdef HIDE
- modname = pstrcat(cmd->pool, "AP_", modname, NULL);
-#endif
+ /*
+ * Create the symbol variant for the case where
+ * we have to load a distributed module compiled with -DHIDE
+ */
+ modname_hidden = pstrcat(cmd->pool, "AP_", modname, NULL);
+ /*
+ * Optionally prefix the symbol with an underscore
+ * for some platforms.
+ */
#ifdef NEED_UNDERSCORE_SYM
+ modname_hidden = pstrcat(cmd->pool, "_", modname_hidden, NULL);
modname = pstrcat(cmd->pool, "_", modname, NULL);
#endif
/*
- * Retrieve the pointer to the module structure
- * through the module name
+ * Retrieve the pointer to the module structure through the module name:
+ * First with the hidden variant (prefix `AP_') and then with the plain
+ * symbol name.
*/
- if (!(modp = (module *)(os_dl_sym (modhandle, modname)))) {
- return pstrcat(cmd->pool, "Can't find module ", modname,
- " in file ", filename, ":", os_dl_error(), NULL);
+ if (!(modp = (module *)(os_dl_sym (modhandle, modname_hidden)))) {
+ if (!(modp = (module *)(os_dl_sym (modhandle, modname)))) {
+ return pstrcat(cmd->pool, "Can't find module ", modname,
+ " in file ", filename, ":", os_dl_error(), NULL);
+ }
}
modi->modp = modp;
modp->dynamic_load_handle = modhandle;