Repository navigation
proc/internal/ebpf,build: extend eBPF tracing type support - #4285
Merged
Merged
Conversation
… Docker build Add support for additional Go types in the eBPF tracing backend: - Bool: use BoolType with ByteSize 1 instead of IntType with ByteSize 8 - Int/Uint: use actual DWARF size instead of hardcoded ByteSize 8 - Float32/Float64: synthesize FloatType, detect XMM registers as unreadable - Complex64/Complex128: synthesize ComplexType with XMM detection - Pointer: capture pointer address and dereference pointed-to value via bpf_probe_read_user in eBPF C code - Slice: capture slice header (ptr+len+cap) and dereference element data - Graceful degradation: map, chan, interface, func, struct, and array types now produce specific "not yet supported" errors instead of generic "type not supported by ebpf" Add Unreadable field to RawUProbeParam so the Go-side parser can propagate specific error messages through to Variable display. Update eBPF build infrastructure: - Replace EOL Ubuntu 21.04 base image with Ubuntu 22.04 - Use clang-12 (required: newer clang generates BPF code that fails the kernel verifier with "dereference of modified ctx ptr disallowed") - Update Go from 1.17 to 1.24 - Remove sudo requirement from build-ebpf-builder-img.sh - Add -u flag to Docker run to avoid root-owned output files Co-Authored-By: Claude Opus 4.6 <[email protected]>
Fix a bug in the DWARF type parser where SliceType.ReflectKind was not set (stayed 0/reflect.Invalid). When parsing struct types, the code creates a new StructType, sets ReflectKind on it, then for slices creates a new SliceType and reassigns the pointer — losing the ReflectKind. The String case already had an explicit fix for this (str.ReflectKind = reflect.String), but the Slice case was missing it. This caused the eBPF tracing backend (which uses dt.Common().ReflectKind to determine type kind) to see kind=0 for slice parameters, making them appear as unsupported types. The ptrace backend was unaffected because it uses Go type assertions (case *godwarf.SliceType) instead of ReflectKind. Also addresses PR review feedback: - Add t.Parallel() to TestTraceEBPFTypes subtests - Use regexp matching for pointer/slice address verification - Add content verification for slice test output - Add comment explaining -u flag in build-ebpf-objects.sh - Add comment explaining amd64-only XMM register threshold - Handle CreateCompositeMemory errors in target.go - Remove debug prints from target.go Co-Authored-By: Claude Opus 4.6 <[email protected]>
Add documentation for the eBPF type support pipeline, currently supported types, the canonical test (TestTraceEBPFTypes) for adding new type support, and the clang-12 build constraint. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Clarify that the eBPF probe does capture dereferenced data, but loadValue runs Go-side after the probe returns and cannot follow pointer chains through fake memory addresses. Also remove unicode arrow from XMM register comment. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Explain why we display raw addresses instead of dereferenced values: element type info isn't propagated through the eBPF pipeline, and deref_val is limited to 48 bytes which is insufficient for nested or variable-length types. Co-Authored-By: Claude Opus 4.6 <[email protected]>
aarzilli
reviewed
Mar 13, 2026
| fixtures := protest.FindFixturesDir() | ||
|
|
||
| // Test small integer types (int8, uint16, int32) to verify correct byte sizes | ||
| t.Run("SmallInts", func(t *testing.T) { |
Member
There was a problem hiding this comment.
IMO these could all be a single test run that checks for all three. Otherwise the common code should be in a helper function, at least.
| return false | ||
| } | ||
| for i := 0; i < int(param.n_pieces); i++ { | ||
| if param.reg_nums[i] >= 17 { |
Member
There was a problem hiding this comment.
regnum.AMD64_XMM0 instead of 17
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.
Add support for additional Go types in the eBPF tracing backend:
bpf_probe_read_user in eBPF C code
types now produce specific "not yet supported" errors instead of
generic "type not supported by ebpf"