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 +413 −1073
  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. 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.
    03d302c2c6
  3. 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.
    e0ef6fd65a
  4. 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

    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.

    <!--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-10-23 16:08:59</sup>

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

    Concept ACK

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

    cc @0xB10C

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

  8. 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)?


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-10-24 17:51 UTC

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