fix(plugins/container): link libresolv on Linux so the plugin loads on glibc < 2.34 - #1501
Open
ManuelFCastillo wants to merge 1 commit into
Open
Conversation
…n glibc < 2.34 The go-worker library's cgo resolver references res_search from libresolv (Go >= 1.20), but the resolv link dependency was only declared for macOS. The shipped libcontainer.so therefore carries an undefined __res_search with no DT_NEEDED entry for libresolv.so.2. On glibc >= 2.34 the symbol resolves through libc's compat exports, masking the problem; on older glibc (Debian 11, RHEL/Rocky/Alma 8, Ubuntu 20.04) dlopen fails with 'undefined symbol: __res_search', and since the default Falco ruleset requires the container plugin, Falco cannot start at all on those hosts. Two changes: - go-worker.cmake: set WORKER_DEP to resolv on Linux, mirroring the existing APPLE branch - CMakeLists.txt: link the worker archive before its dependencies; with the previous order GNU ld processes -lresolv before anything references its symbols and discards it (ld64 is order-insensitive, which is why the macOS branch works as-is) Verified by rebuilding v0.7.1 in debian:bullseye: the .so gains NEEDED: libresolv.so.2, loads and runs with stock Falco 0.44.1 on Debian 11 (glibc 2.31), and behaves identically on Ubuntu 24.04 (glibc 2.39). aarch64 builds clean with the same result. Fixes falcosecurity#1500 Signed-off-by: Manuel Castillo <manuel.franklin.castillo@gmail.com>
Contributor
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: ManuelFCastillo The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Contributor
|
Welcome @ManuelFCastillo! It looks like this is your first PR to falcosecurity/plugins 🎉 |
ManuelFCastillo
added a commit
to ManuelFCastillo/portfolio
that referenced
this pull request
Aug 27, 2026
Second interactive essay: tracing a Falco container-plugin load failure on old-glibc distros to a missing -lresolv in the plugin's link line, with a step-through GNU ld simulation (swap the link order, flip the mode to ld64) and the two-line fix now submitted upstream as falcosecurity/plugins#1501. Also: per-post card art on the blog index (full-bleed right panel, generated isometric illustrations) and matching hero banners at the top of both posts.
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.
What type of PR is this?
/kind bug
Any specific area of the project related to this PR?
/area plugins
What this PR does / why we need it:
Makes
libcontainer.soloadable on hosts with glibc < 2.34 (Debian 11, RHEL/Rocky/AlmaLinux 8, Ubuntu 20.04, ...), where it currently fails withundefined symbol: __res_search— which, combined with the default Falco ruleset requiring the container plugin, prevents stock Falco from starting at all on those distros.The go-worker library's cgo resolver references
res_searchfrom libresolv (Go >= 1.20), but the resolv link dependency was only declared in theif(APPLE)branch ofgo-worker.cmake. The shipped Linux.sotherefore has an undefined__res_searchand noDT_NEEDEDentry forlibresolv.so.2. On glibc >= 2.34 the symbol resolves via libc's compat exports, masking the bug on modern hosts; on older glibc it lives only inlibresolv.so.2, which is never loaded.Two changes (both linkage-only, no code changes):
cmake/modules/go-worker.cmake: setWORKER_DEPtoresolvon Linux, mirroring the existing APPLE branch.libresolv.so.2exists on all glibc versions (real library before 2.34, compat stub after), so the added dependency is safe everywhere.CMakeLists.txt: link${WORKER_LIB} ${WORKER_DEP}(archive before its dependencies). With the previous order, GNU ld processes-lresolvbefore anything references its symbols and discards it, so change (1) alone silently has no effect. ld64 is order-insensitive, which is why the macOS branch works as-is.Also bumps the plugin version to 0.7.2.
Verification performed (details and full logs in the linked issue):
debian:bullseye(the release CI baseline): the.sogainsNEEDED: libresolv.so.2and the symbol becomes properly versioned (__res_search@GLIBC_2.2.5on x86_64,@GLIBC_2.17on aarch64).LD_PRELOAD=libresolv.so.2experiment in the issue independently confirms the missing-DT_NEEDED mechanism on the shipped binary.Which issue(s) this PR fixes:
Fixes #1500
(Also addresses the symptoms previously reported in falcosecurity/falco#3719 and falcosecurity/falco#3728, which went stale.)
Special notes for your reviewer:
The link-order half of the fix is easy to lose: if
-lresolvis added but placed before the go-worker archive, GNU ld silently drops it and the resulting.sois byte-for-byte as broken as before.readelf -d libcontainer.so | grep resolvis the quick check that the fix actually took.