sys: also try loading kadm5 libraries by SONAME#435
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves runtime dynamic loading of kadm5 libraries by preferring the libraries’ ELF SONAMEs (discovered at build time) before falling back to path-based and unversioned .so names, reducing the need for dev-package symlinks at runtime (notably on Debian/Ubuntu).
Changes:
- Build-time SONAME discovery via
goblinand embedding intoKADMIN_BUILD_*_SONAMESenv vars. - Runtime loader updated to try discovered SONAMEs first, then existing path/unversioned fallbacks.
- Added
goblin(and transitive deps) for build script ELF parsing.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
build.rs |
Discovers SONAMEs from unversioned .so and exports them as build-time env vars. |
src/sys.rs |
Tries SONAME-based dlopen first in find_library, keeping existing fallbacks. |
Cargo.toml |
Adds goblin as a build-dependency for SONAME parsing. |
Cargo.lock |
Locks goblin and its transitive dependencies. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
rissson
approved these changes
May 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Adds reading the SONAME from each library's unversioned
.sosymlink at build time viagoblin, embeds the SONAMEs asKADMIN_BUILD_*_SONAMESenv vars, and tries them first infind_library.SONAME lookups go through the ldconfig cache, which resolves against the runtime packages without needing the dev-package symlinks.
The existing path-based and unversioned-name fallbacks are kept, so any setup that works today keeps working.
Why?
To avoid requiring dev packages at runtime.
Why? (longer)
find_libraryconstructs dlopen paths asformat!("{}/lib{}.so", path, library)and the fallback path uses the unversionedlib*.sodirectly.On Debian/Ubuntu those unversioned
.sofiles ship *only in the dev packages:krb5-multidevandheimdal-multidev.The runtime packages (
libkadm5clnt-mit12,libkadm5clnt7t64-heimdal, ...) ship only the SONAME-versioned files (libkadm5clnt_mit.so.12,libkadm5clnt.so.7, ...)Verification notes
I ran through these to make sure everything works, noting them here if needed in the future, feel free to skip reading.
docker run -it --rm ubuntu:24.04 bashapt install krb5-multidev heimdal-multidev libkrb5-devcargo build --features log 2>&1and check the SONAMEs are discovered:cargo test --features log --no-runRUST_LOG=trace target/debug/deps/kadmin-* --nocapture sys::tests:: 2>&1 | grep -v DEBUGapt-get purge -y krb5-multidev heimdal-multidev libkrb5-dev, removing the unversioned.sofilesRUST_LOG=trace target/debug/deps/kadmin-* --nocapture sys::tests:: 2>&1 | grep -v DEBUG