shared library loading flags

Steve Langasek vorlon at debian.org
Thu Dec 6 20:38:50 UTC 2012


On Thu, Dec 06, 2012 at 09:23:55PM +0200, Artur Artamonov wrote:
> Is there some specific explanations why modules is loaded with flags
> RTLD_NOW?

> pam_dynamic.c:67:       return dlopen(mod_path, RTLD_NOW);

Because if you're missing a dependency symbol, you want this to be
discovered and reported at load time, not when you're deep in the middle of
the stack.

> There was issue when i was using myown PAM module that uses others
> shared libraries. I was calling this module from dropbear and there
> allways was some unresolved symbols from shared librarires after i added
> flag RTLD_GLOBAL 

> pam_dynamic.c:67:       return dlopen(mod_path, RTLD_NOW|RTLD_GLOBAL);

> Is there possible that this flag will added in next LinuxPAM realise?

Certainly not.  RTLD_GLOBAL means:

            The symbols defined by this library will be made available for
            symbol resolution of subsequently loaded libraries.

There is no reason that you should need the symbols from the PAM module
dumped into the global namespace; and doing so can cause crashes due to
symbol collisions.

If you find yourself needing this, then you have missing library dependency
declarations somewhere else in your setup.

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slangasek at ubuntu.com                                     vorlon at debian.org




More information about the Pam-list mailing list