mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 10:08:38 +00:00
tracing: run USDT tests without BPF privileges #36627
No reviewers
Labels
No labels
Android
Backport
Block storage
Brainstorming
Bug
Build system
CI failed
Consensus
Data corruption
Descriptors
Docs
DrahtBot Guix build requested
Feature
Fuzzing
GUI
Good First Review
IPC
Insufficient Review
Kernel
Linux/Unix
Mempool
Mining
Needs Backport (31.x)
Needs Backport (32.x)
Needs Benchmark
Needs Conceptual Review
Needs backport (30.x)
Needs rebase
Needs release note
Net
P2P
PSBT
Privacy
Private Broadcast
Questions and Help
RPC/REST/ZMQ
Refactoring
Resource usage
Review club
Scripts and tools
Settings
TX fees and policy
Tests
Tracking Issue
UTXO Db and Indexes
Up for grabs
Upstream
Utils/log/libs
Validation
Waiting for author
Wallet
Windows
good first issue
interfaces
macOS
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin/bitcoin!36627
Loading…
Reference in a new issue
No description provided.
Delete branch "tracing-no-sudo"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The USDT functional tests currently use BCC to attach eBPF programs to Bitcoin Core’s tracepoints. This requires BCC, matching kernel headers, and elevated BPF permissions, making the tests awkward to run locally and
requiring a privileged container in CI.
Replace the BCC consumers with GDB. Each tested node runs as a debugger child, allowing the tests to enable the real USDT probes and inspect their arguments when execution reaches the probe location. This continues to test
the parts of the USDT interface provided by Bitcoin Core:
All five tests can run with GDB and
binutils, without BCC or matching kernel headers. The ASan CI job no longer needs a privileged container and usesSYS_PTRACEinstead. This also removes the embedded BPF programs fromthe tests, reducing their size and maintenance burden. Overall, the change removes roughly 660 lines of test and CI code.
Tradeoffs
those components would no longer be detected here.
ptrace. Other sanitizer checks remain enabled.The remaining coverage is focused on Bitcoin Core’s side of the USDT interface. Testing the general BCC, eBPF, and kernel uprobe is left to those consumers and the kernel.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
External sites
Reviews
See the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste
<!--meta-tag:bot-skip-->into the comment that the bot should ignore.Conflicts
Reviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
LLM Linter (✨ experimental)
Possible places where comparison-specific test macros should replace generic comparisons:
test/functional/interface_usdt_utxocache.py:assert event.memory > 0→ Preferassert_greater_than(event.memory, 0).test/functional/interface_usdt_utxocache.py:assert event.duration > 0→ Preferassert_greater_than(event.duration, 0).2026-11-05 15:31:11
Concept ACK
cc @0xB10C
🔵 Suggestion · GDB capture does not assert integer argument types
Value-preserving width changes can pass the USDT tests because capture converts arguments to Python integers without checking the documented widths or signedness.
Location:
test/functional/test_framework/usdt.py:103(head).🔵 Suggestion · Runtime probe enabling is no longer exercised
Enabling every probe before daemon initialization leaves the USDT tests unable to detect regressions specific to consumers attaching to an already-running node.
Location:
test/functional/test_framework/usdt.py:38(head).🔵 Suggestion · readelf fallback conflates multiple locations of a probe
If a probe has multiple compiled locations with different operands, the byte-register fallback can record incorrect arguments by using one location's layout for every hit.
Location:
test/functional/test_framework/usdt.py:109(head).🔵 Suggestion · USDT prerequisite check misses denied child tracing
When local ptrace policy denies GDB tracing its child, the USDT prerequisite check passes and the tests fail during node startup instead of skipping.
Location:
test/functional/test_framework/test_framework.py:1025(head).Review coverage was incomplete.
Reviewed:
ad73514cc77a· Full review report · Previous reportspermalink
I beefed up the tradeoffs section here as I think it may have been undersold in its previous form.
Concept ACK.
Nice, I didn't know this was possible. I think it's a nice simplification and agree that we should test our interface, and not bcc which might or might not break from time to time. I plan to review this in more detail.
Does this also make the tests work aarch64 ref https://github.com/bitcoin/bitcoin/issues/35142#issuecomment-4959156870?
How does this fit into the large picture in https://github.com/bitcoin/bitcoin/issues/35142 ?
remove the comment?
bump, like all other sanitizer tests?
🐙 This pull request conflicts with the target branch and needs rebase.
Sorry meant to reply here sooner but got distracted.
Of course the value to us of this patchset depends somewhat on whether we opt to keep tracing in-repo (vs as an external patchset). If we want to drop it, then this change is moot.
With b10c and the FIBRE team both using tracing actively it seems both would (naturally) prefer to keep it in-tree if possible. This seems fine to me, and I see this patchset as reducing the maintenance burden (to us) of keeping it here in its current form as it:
done in
89e34fbc37done in
89e34fbc37Pushed to take one ralph finding.
The other suggestion does highlight a possible limitation, but I don't think it affects anything. The current binary has one site per probe name, so the fallback selects the correct layout.
Concept ACK