Issue #538
use dlopen(file, RTLD_NOW|RTLD_GLOBAL) for the plugin loader
Description
I have noticed a patch in Fedora doing exactly that. I have no detailed information but I will get them when needed.
diff -urNp strongswan-5.1.1-patched/src/libstrongswan/plugins/plugin_loader.c strongswan-5.1.1-current/src/libstrongswan/plugins/plugin_loader.c --- strongswan-5.1.1-patched/src/libstrongswan/plugins/plugin_loader.c 2013-11-01 13:12:06.046927153 -0400 +++ strongswan-5.1.1-current/src/libstrongswan/plugins/plugin_loader.c 2013-11-01 13:16:59.680916657 -0400 @@ -353,7 +353,7 @@ static plugin_entry_t *load_plugin(priva return NULL; } } - handle = dlopen(file, RTLD_LAZY); + handle = dlopen(file, RTLD_NOW|RTLD_GLOBAL); if (handle == NULL) { DBG1(DBG_LIB, "plugin '%s' failed to load: %s", name, dlerror());
Related issues
History
#1 Updated by Pavel Šimerda over 11 years ago
Also, please see:
https://bugzilla.redhat.com/show_bug.cgi?id=973315
And the related Fedora patch (attachment).
#2 Updated by Tobias Brunner over 11 years ago
- Related to Issue #332: build fails with -Wl,-z,defs added
#3 Updated by Tobias Brunner over 11 years ago
- Status changed from New to Feedback
- Assignee set to Tobias Brunner
Are both patches needed? Or does it work if only one of them is applied?
The RTLD_GLOBAL
fix would be minimal and since we prefix global functions with the plugin name there should be no name clashes (they would conflict with --enable-monolithic anyway). But if RTLD_GLOBAL
is not needed it would avoid any issues with third-party plugins or future changes.
Linking the plugins to the libraries they use would also be fine, but doing so properly for all plugins is some work. Is it enough to just do this, or is RTLD_GLOBAL
still required if this is done?
#4 Updated by Pavel Šimerda over 11 years ago
I'm trying to get more information from the co-maintainer. Currently I don't have more information that you can find in the linked bug report. I'll be happy to drop any of the patches as appropriate.
#5 Updated by Pavel Šimerda over 11 years ago
This new patch is a fusion of the two patches previously used in Fedora. I'm still trying to get the author's response.
#6 Updated by Pavel Šimerda over 11 years ago
#7 Updated by Pavel Šimerda over 11 years ago
Updated patch. Still trying to get response from the patch author.
#8 Updated by Pavel Šimerda over 11 years ago
Sorry for the changed version number in the patch filename. Still the last submitted patch is also the newest.
#9 Updated by Tobias Brunner over 9 years ago
- Category set to libstrongswan
- Status changed from Feedback to Closed
- Resolution set to No feedback
Closing old issues. If this is still a problem, please reopen.