fix(agent): resolve typedef-wrapped structs in BTF preflight so fix_setuid attaches (JEF-924) - #340
Merged
thejefflarson merged 2 commits intoSep 2, 2026
Conversation
…d_t) so fix_setuid attaches
The BTF preflight disabled the fix_setuid probe (security_task_fix_setuid,
setuid->root escalation) on every node, arm64 and amd64 alike: agents reported
loaded=7 total=8. It logged kuid_t.val expected=0 actual=None and fail-closed.
actual=None means the field was not found, not that the offset moved. The struct
lookup matched only a KIND_STRUCT named kuid_t, but the kernel declares it as
`typedef struct { uid_t val; } kuid_t;` -- an anonymous struct whose name lives
on the typedef -- so the by-name scan found nothing. The baked offset (0) is
correct; the probe would work.
Resolve a struct name that is itself a typedef/see-through to its target
aggregate (aggregate_id), reusing the same resolve_to_aggregate the module
already applies to anonymous members. Adds a regression test for the kuid_t
shape. After deploy, agents should report loaded=8 total=8.
Closes JEF-924
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
thejefflarson
enabled auto-merge (squash)
September 2, 2026 02:25
…id-kuid_t-typedef
thejefflarson
deleted the
thejefflarson/jef-924-btf-preflight-fix_setuid-kuid_t-typedef
branch
September 2, 2026 02:47
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.
Closes JEF-924
What was wrong
Every agent — arm64 (
-raspi) and amd64 (-generic) alike — reportedloaded=7 total=8: thefix_setuidprobe (security_task_fix_setuid, the setuid→root privilege-escalation signal) was disabled fleet-wide. Privilege-escalation corroboration has been silently inert.Root cause — a preflight false-positive
The BTF preflight logged
kuid_t.val expected=0 actual=Noneand fail-closed the probe.actual=Nonemeans the field wasn't found, not that its offset moved. The struct lookup (preflight/btf.rs) matched only aKIND_STRUCTnamedkuid_t— but the kernel declares it as:There is no struct literally named
kuid_t, so the by-name scan found nothing. The baked offset (0) is correct and the probe would work — it was being disabled by a blind spot for typedef-wrapped structs.Fix
Add
aggregate_id: resolve a struct name that is itself a typedef/see-through to its target aggregate, reusing the sameresolve_to_aggregatethe module already applies to anonymous members.struct_field_offsetnow routes through it. Adds a regression test for the exactkuid_tshape (typedef → anonymous struct { val@0 }→Some(0)).Verified
Agent workspace: fmt clean · clippy clean · 75 tests pass (incl. the new
resolves_a_struct_name_that_is_itself_a_typedef). After this ships, agents should reportloaded=8 total=8andfix_setuidattaches.How it was found
Live fleet inspection (
kubectl logsacross all agents) — every node showed the same single disabled probe and the samekuid_t.valmismatch, which is what pinned it to a preflight resolution bug rather than a real per-kernel offset change.🤖 Generated with Claude Code