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)
Mar 4 2024, 8:11 AM
Unknown Object (File)
Feb 18 2024, 7:20 AM
Unknown Object (File)
Feb 8 2024, 8:16 PM
Unknown Object (File)
Dec 23 2023, 1:51 AM
Unknown Object (File)
Sep 20 2023, 6:54 AM
Unknown Object (File)
Sep 15 2023, 8:47 PM
Unknown Object (File)
Sep 2 2023, 3:48 PM
Unknown Object (File)
Sep 2 2023, 3:46 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 Not Applicable
Unit
Tests Not Applicable

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 ↗(On Diff #49142)

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.