Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use dlmopen for modules to clearly separate symbol namespace #4746

Open
jaromil opened this issue Jan 25, 2020 · 6 comments
Open

Use dlmopen for modules to clearly separate symbol namespace #4746

jaromil opened this issue Jan 25, 2020 · 6 comments
Labels
discussion feature A new functionality
Milestone

Comments

@jaromil
Copy link

jaromil commented Jan 25, 2020

Is this the dlopen call for loaded modules?

module->handle = dlopen(load_name, RTLD_NOW | RTLD_LOCAL);

I'm wondering if you are open to a change to the way you load modules, to adopt dlmopen as I've described here redis/redis#6125

This change would allow modules to carry their own symbols without clashing with tarantool's.

For instance modules with their own modified Lua interpreter.

@cyrillos
Copy link
Contributor

Actually it looks tempting to support but we need more time to figure out the details and potential side effects.

@cyrillos cyrillos self-assigned this Jan 27, 2020
@cyrillos
Copy link
Contributor

Thinking more I fear this might break backward compatibility. What if there already present users/modules which relies on global symbol namespace?

@jaromil
Copy link
Author

jaromil commented Jan 28, 2020

Yes, glibc's dlmopen provides complete isolation; but fallback can be handled by the host application.

I see a solution here and I wish also @antirez would consider it for Redis, I'm speaking based on experience made maintaining frei0r and following LADSPA, both large third-party communities of plugin developers.

The solution can be to add metadata that indicates loading options (and more) for plugins.
Such metadata can be either an external file (LADSPA uses rdf) that goes side-by-side with the binary DSO or a function symbol of the DSO to be called after an initial dlopen and returning a struct of options.

Then the flow can be:

  1. read metadata (file load, or dlopen+setup() call)
  2. if setup() returns full isolation option, dlclose() and dlmopen() the DSO
  3. pass the DSO pointer and process

There may be more solutions, in any case I recommend you do consider the isolation flag as a desirable option for plugin developers.

@cyrillos
Copy link
Contributor

Yes, I think of some kind of flag to provide an option for such load, but definitely we won't switch to dlmopen by default.

@kyukhin kyukhin added the feature A new functionality label Mar 6, 2020
@kyukhin kyukhin added this to the wishlist milestone Mar 6, 2020
@jaromil
Copy link
Author

jaromil commented Aug 10, 2021

Ping. Any thoughts about this? A runtime configuration switch?

@cyrillos
Copy link
Contributor

Hi! Sorry but have had no time to think about, -EBUSY :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion feature A new functionality
Projects
None yet
Development

No branches or pull requests

3 participants