Page MenuHomeFreeBSD

Don't try to dlopen() built-in NSS types
ClosedPublic

Authored by trasz on Oct 14 2018, 7:14 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Dec 3, 12:51 PM
Unknown Object (File)
Sun, Nov 24, 5:05 PM
Unknown Object (File)
Sat, Nov 23, 9:22 PM
Unknown Object (File)
Sep 30 2024, 5:06 AM
Unknown Object (File)
Sep 17 2024, 6:13 PM
Unknown Object (File)
Sep 17 2024, 6:13 PM
Unknown Object (File)
Sep 17 2024, 6:13 PM
Unknown Object (File)
Sep 17 2024, 6:13 PM
Subscribers

Details

Summary

Don't call dlopen(3) for the built-in NSS types - "cache", "compat",
"dns", "files", "db", and "nis". It saves some path lookups during
binary startup.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 20200
Build 19680: arc lint + arc unit

Event Timeline

If someone actually created dynamic NSS modules with these names today, would they work? Or is there some reason that would fail? If it works, then this change would break such a configuration, though I'd be surprised if anyone actually does that. At the very least, we should document these names as being reserved by the implementation.

As it is now, I believe they could work in FreeBSD. In Linux, glibc already provides the built-in modules as shared libraries, so it would clash there. I've grepped the ports tree for '\<nss_.*so', and I don't see an example of anyone doing that.

Which is to say: I believe it would be rather silly thing to try install a third-party module with a name of a built-in source.

As it is now, I believe they could work in FreeBSD. In Linux, glibc already provides the built-in modules as shared libraries, so it would clash there. I've grepped the ports tree for '\<nss_.*so', and I don't see an example of anyone doing that.

Which is to say: I believe it would be rather silly thing to try install a third-party module with a name of a built-in source.

I completely agree, but stranger things have happened. I would just suggest adding a sentence to this effect to nsdispatch(3) or nsswitch.conf(5).

This revision is now accepted and ready to land.Oct 14 2018, 10:38 PM
lib/libc/net/nsdispatch.c
491

Sorry, meant to leave this comment with the review: we should use the NSSRC_CACHE, etc. constants defined in nsswitch.conf.

Changes suggested by markj@.

This revision now requires review to proceed.Oct 15 2018, 11:36 AM
This revision is now accepted and ready to land.Oct 15 2018, 12:14 PM
This revision was automatically updated to reflect the committed changes.