tracing: run USDT tests without BPF privileges #36627

pull willcl-ark wants to merge 2 commits into bitcoin:master from willcl-ark:tracing-no-sudo changing 12 files +415 −1075
  1. willcl-ark commented at 4:08 PM on October 23, 2026: member

    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:

    • the probe metadata is present and understood;
    • the probes can be enabled and are reached in the expected scenarios; and
    • their arguments have the expected values, sizes, and lifetimes.

    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 uses SYS_PTRACE instead. This also removes the embedded BPF programs from the tests, reducing their size and maintenance burden. Overall, the change removes roughly 660 lines of test and CI code.

    Tradeoffs

    • These tests no longer exercise the consumer-side eBPF path, including BCC compilation, kernel BPF verification and loading, uprobe attachment, BPF-side argument decoding, and perf-buffer delivery. Problems confined to those components would no longer be detected here.
    • LeakSanitizer is disabled for nodes run under GDB because it cannot operate under 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.

  2. DrahtBot commented at 4:08 PM on October 23, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    External sites

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process.

    Type Reviewers
    Concept ACK fanquake, 0xB10C, w0xlt

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #36540 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36540.svg"></sub> (mempool: remove time-based transaction expiry by ismaelsadeeq)
    • #36257 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36257.svg"></sub> (qa: assert_equals -> assert_true/assert_false by hodlinator)
    • #34405 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/34405.svg"></sub> (wallet: skip APS when no partial spend exists by 8144225309)

    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.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

    LLM Linter (✨ experimental)

    Possible places where comparison-specific test macros should replace generic comparisons:

    • test/functional/interface_usdt_utxocache.py: assert event.memory > 0 → Prefer assert_greater_than(event.memory, 0).
    • test/functional/interface_usdt_utxocache.py: assert event.duration > 0 → Prefer assert_greater_than(event.duration, 0).

    <sup>2026-11-05 15:31:11</sup>

  3. fanquake commented at 4:13 PM on October 23, 2026: member

    Concept ACK

  4. fanquake commented at 4:13 PM on October 23, 2026: member

    cc @0xB10C

  5. willcl-ark commented at 7:32 PM on October 23, 2026: member

    I beefed up the tradeoffs section here as I think it may have been undersold in its previous form.

  6. 0xB10C commented at 8:02 PM on October 23, 2026: contributor

    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 #35142 (comment)?

  7. in .github/workflows/ci.yml:428 in e0ef6fd65a


    maflcko commented at 10:41 AM on October 26, 2026:

    remove the comment?


    willcl-ark commented at 3:07 PM on November 5, 2026:

    done in 89e34fbc3789077b30fe9a5f38b5b0426ba76f0f

  8. in ci/test/00_setup_env_native_asan.sh:9 in e0ef6fd65a
       7 | @@ -8,18 +8,10 @@ export LC_ALL=C.UTF-8
       8 |  
       9 |  export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:24.04"
    


    maflcko commented at 10:41 AM on October 26, 2026:

    bump, like all other sanitizer tests?


    willcl-ark commented at 3:07 PM on November 5, 2026:

    done in 89e34fbc3789077b30fe9a5f38b5b0426ba76f0f

  9. maflcko commented at 10:43 AM on October 26, 2026: member

    How does this fit into the large picture in #35142 ?

  10. DrahtBot added the label Needs rebase on Nov 5, 2026
  11. willcl-ark force-pushed on Nov 5, 2026
  12. willcl-ark commented at 3:07 PM on November 5, 2026: member

    How does this fit into the large picture in #35142 ?

    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:

    • removes BCC, root, and host-kernel requirements from functional testing
    • preserves the USDT probes and existing production eBPF consumers.
  13. test: Capture USDT probes with GDB
    Launch traced nodes as GDB children so the existing probe scenarios can
    run without BCC, BPF privileges, or matching host kernel headers.
    
    - Copy probe arguments while stopped and drain complete records in the
      test process, including events emitted during node shutdown and
      restart.
    - Follow the bitcoin launcher through exec before registering probes.
    - Handle a GDB parser failure for GCC byte-register operands in usdt.py.
    - Disable LeakSanitizer only for traced children because it cannot
      operate under ptrace; keep other sanitizer checks remain enabled.
    1013741834
  14. ci: Run tracing tests without BPF dependencies
    The USDT tests now launch nodes under GDB, so the ASan job no longer needs
    BCC, matching host kernel headers, or a privileged container. Install GDB
    and binutils and retain SYS_PTRACE for debugger and sanitizer operation.
    Remove the host-kernel package refresh and BCC workflow toggle along with
    the dependencies they supported.
    ad73514cc7
  15. willcl-ark force-pushed on Nov 5, 2026
  16. willcl-ark commented at 3:31 PM on November 5, 2026: member

    Pushed 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.

  17. DrahtBot added the label CI failed on Nov 5, 2026
  18. DrahtBot removed the label Needs rebase on Nov 5, 2026
  19. DrahtBot removed the label CI failed on Nov 5, 2026
  20. w0xlt commented at 8:50 PM on November 11, 2026: contributor

    Concept ACK


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-11-13 23:51 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me