Issue #538

use dlopen(file, RTLD_NOW|RTLD_GLOBAL) for the plugin loader

Added by Pavel Šimerda over 7 years ago. Updated over 5 years ago.

Affected version:
No feedback


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());
libstrongswan-973315.patch (8.94 KB) libstrongswan-973315.patch Pavel Šimerda, 04.03.2014 08:44
strongswan-5.1.3-plugins.patch (8.17 KB) strongswan-5.1.3-plugins.patch Fedora patch. Pavel Šimerda, 16.04.2014 19:53
strongswan-5.1.1-plugins.patch (8.3 KB) strongswan-5.1.1-plugins.patch Pavel Šimerda, 26.05.2014 16:50

Related issues

Related to Issue #332: build fails with -Wl,-z,defsClosed


#1 Updated by Pavel Šimerda over 7 years ago

Also, please see:

And the related Fedora patch (attachment).

#2 Updated by Tobias Brunner over 7 years ago

  • Related to Issue #332: build fails with -Wl,-z,defs added

#3 Updated by Tobias Brunner over 7 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 7 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 7 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.

#7 Updated by Pavel Šimerda over 7 years ago

Updated patch. Still trying to get response from the patch author.

#8 Updated by Pavel Šimerda over 7 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 5 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.

Also available in: Atom PDF