Page MenuHomeFreeBSD

Add versioning to libnv and libnvpair library symbols
ClosedPublic

Authored by linnemannr_gmail.com on May 19 2022, 9:33 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Nov 17, 2:16 PM
Unknown Object (File)
Sun, Nov 17, 5:51 AM
Unknown Object (File)
Sat, Nov 9, 11:18 AM
Unknown Object (File)
Wed, Nov 6, 1:06 AM
Unknown Object (File)
Wed, Nov 6, 1:06 AM
Unknown Object (File)
Wed, Nov 6, 1:06 AM
Unknown Object (File)
Sun, Nov 3, 7:54 PM
Unknown Object (File)
Sun, Nov 3, 7:50 PM

Details

Summary

libnv and libnvpair have aliased symbols, and as a result a single process which
dlopens a shared object that is dynamically linked to libnv and another to
libnvpair will wind up with a single set of resolved symbols for those in
conflict, which invariably breaks since libnv and libnvpair are not ABI
compatible. This change introduces symbol versioning for both libnv and
libnvpair to provide the necessary distinction in runtime linked symbols.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Add namespacing to libnv, don't export msgio funcs

This looks fine to my eye, though I know Kyle has been tracking this more closely than I have...

I think my biggest concern as of right now is whether I did the Right Thing with the msgio symbols. I deemed them to not be part of the interface and therefore made them local symbols without a namespace prefix.

sys/sys/nv_namespace.h
38

I think I'm pretty happy with this, though let's add some internal padding around (front and end of) the big ol' list of defines.

  • Add whitespace between macros and surrounding ifdef lines

I think this looks good to me, modulo a need to bump shlib versions for both libs (iirc; at least libnv) -- I've requested an exp-run with versions bumped (and appropriate entries added to ObsoleteFiles.inc): https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=264838

exp-run looks good, assuming this is tested to solve the problem run into at Netgate, I think I'm happy with it

This revision is now accepted and ready to land.Jul 6 2022, 8:35 PM

I haven't yet done a full build against main with this patch, but versioning alone solved our linking issues so I don't expect adding differentiation to symbol names to interfere with that. I'll try to get that done today.

jrtc27 added inline comments.
cddl/lib/libnvpair/Symbol.map
1 โ†—(On Diff #106677)

Why do we need to version these? The names don't clash any more. This feels like a relic from the old version-both-the-symbol-sets approach?

cddl/lib/libnvpair/Symbol.map
1 โ†—(On Diff #106677)

Personally I agree, if nobody has any objections I'd be happy to rip the libnvpair symbol versions out.

  • Remove libnvpair symbol versioning, obviated by libnv namespacing and versioning
This revision now requires review to proceed.Jul 7 2022, 11:01 PM
  • Remove orphaned empty line in libnvpair makefile

This works in pfSense as expected, our pfsense and libbe PHP modules, when both loaded, do not hit errors due to symbols from one of libnv or libnvpair being aliased.

  • Remove unwanted leading space in Version.map
This revision was not accepted when it landed; it landed in state Needs Review.Jul 21 2022, 4:37 PM
This revision was automatically updated to reflect the committed changes.