Hello Bastian,
I will check the sl and tm code to get the collision fixed, it is better
to avoid it, but I am afraid that other modules will have this problem
(db ones especially...). Also, RTLD_GLOBAL should be used only if
necessary, I don't think that all symbols should become available.
Your proposed options are pretty much ok, I am thinking to get it in a
way easy for administrators. You can use your patch for now to continue
the development. It might be adjusted to give the flags separately, not
in module's path, or we go for a solution to hide completely those flags.
Thanks for your update,
Daniel
On 11/24/06 10:38, Bastian Friedrich wrote:
Hi,
Am Mittwoch, 15. November 2006 18:17 schrieb Bastian Friedrich:
In a nutshell: With RTLD_LOCAL (default behavior on linux), perl segfaults.
With RTLD_GLOBAL, t_relay segfaults :((
I've dug deeper into the topic:
* Yes, a shared library that is dlopen'ed and linked against perl needs
RTLD_GLOBAL. See
http://groups.google.com/group/comp.lang.perl.misc/msg/a2877cf7e0c656fe
* If all modules but sl.so are loaded with RTLD_GLOBAL, everything is fine
* If sl.so is loaded with RTLD_GLOBAL, a segfault occurs in tm.so's code
(huh???). At least, my gdb says so ;)
I was (yet) unable to find the reason for the segfault. Thus, I'd like to
propose some options:
* Introduce a flag that lets the user configure whether RTLD_GLOBAL should be
set. See attached patch: If the user configures
'loadmodule "/my/module.so"', everything stays at it is. By appending a "G",
RTLD_GLOBAL is configured: 'loadmodule "/my/module.so G"'
* Set RTLD_GLOBAL, and fix the segfault... I expect some symbol collision, but
was unable to locate it :(
* Add an optional parameter to load_module(), plus a
| LOADMODULE STRING COMMA NUMBER
path in the config parser. You'd 'loadmodule "/my/module.so", 1' then.
* Best, but a little more difficult: open module regularly. Try to call a
function "getflags()" or something similar in that module. If it exists,
close library again and re-open it with the new flags.
Looking forward to read about your opinions!
Thx,
Bastian
------------------------------------------------------------------------
--- sr_module.c.ori 2006-11-22 14:19:17.000000000 +0100
+++ sr_module.c 2006-11-24 09:36:08.000000000 +0100
@@ -199,12 +199,30 @@
char* error;
struct module_exports* exp;
struct sr_module* t;
+ int flags;
+ int pathlen;
#ifndef RTLD_NOW
/* for openbsd */
#define RTLD_NOW DL_LAZY
#endif
- handle=dlopen(path, RTLD_NOW); /* resolve all symbols now */
+
+ flags = RTLD_NOW; /* resolve all symbols now */
+
+#ifdef RTLD_GLOBAL
+/* May be unavailable on some systems, thus ifdef'd */
+
+ pathlen = strlen(path);
+ if (pathlen > 2) {
+ if ((path[pathlen-2] == ' ') && (path[pathlen-1] == 'G')) {
+ flags |= RTLD_GLOBAL;
+ path[pathlen-2] = 0; path[pathlen-1] = 0;
+ }
+ }
+#endif
+
+ handle=dlopen(path, flags);
+
if (handle==0){
LOG(L_ERR, "ERROR: load_module: could not open module <%s>:
%s\n",
path, dlerror() );
------------------------------------------------------------------------
_______________________________________________
Devel mailing list
[email protected]
http://openser.org/cgi-bin/mailman/listinfo/devel
_______________________________________________
Devel mailing list
[email protected]
http://openser.org/cgi-bin/mailman/listinfo/devel