Skip to content

bpf: skip compat hooks when !IA32_EMULATION#297

Merged
kxxt merged 1 commit into
mainfrom
ebpf-32bit
Jul 18, 2026
Merged

bpf: skip compat hooks when !IA32_EMULATION#297
kxxt merged 1 commit into
mainfrom
ebpf-32bit

Conversation

@kxxt

@kxxt kxxt commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Bug Fixes

    • Improved compatibility syscall hook handling on x86_64 systems.
    • Prevented unsupported compatibility hooks from loading when the kernel lacks required configuration.
    • Added clearer handling for environments where kernel configuration cannot be read.
  • Tests

    • Added coverage for enabled, disabled, and unavailable compatibility configuration scenarios.
    • Updated compatibility execution-event tests to skip when the required hooks are unavailable.

@vercel

vercel Bot commented Jul 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
tracexec Ready Ready Preview, Comment Jul 18, 2026 2:49pm

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 32705941-0edb-4093-95f5-db893a89f3aa

📥 Commits

Reviewing files that changed from the base of the PR and between 939083b and 2836a0d.

📒 Files selected for processing (4)
  • crates/tracexec-backend-ebpf/src/bin/verifier_complexity.rs
  • crates/tracexec-backend-ebpf/src/probe.rs
  • crates/tracexec-backend-ebpf/src/tracer.rs
  • crates/tracexec-backend-ebpf/tests/exec_events.rs

Walkthrough

Changes

The PR adds x86_64 kernel-configuration detection for CONFIG_IA32_EMULATION and applies it to compat syscall hook autoloading, verifier cases, and execution-event tests.

Compat syscall hook gating

Layer / File(s) Summary
Kernel configuration decision
crates/tracexec-backend-ebpf/src/probe.rs
Adds and tests should_load_compat_syscall_hooks, including enabled, absent, and unavailable configuration cases.
Runtime and verifier gating
crates/tracexec-backend-ebpf/src/tracer.rs, crates/tracexec-backend-ebpf/src/bin/verifier_complexity.rs
Disables compat program autoloading and skips compat fentry cases when CONFIG_IA32_EMULATION is unavailable.
Compat event test gating
crates/tracexec-backend-ebpf/tests/exec_events.rs
Skips the compat execution-event test when compat hooks should not load.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant EbpfTracer
  participant KernelConfig
  participant CompatHooks
  participant ExecEventsTest
  EbpfTracer->>KernelConfig: check CONFIG_IA32_EMULATION
  KernelConfig-->>EbpfTracer: loading decision
  EbpfTracer->>CompatHooks: disable autoload when unavailable
  ExecEventsTest->>KernelConfig: check CONFIG_IA32_EMULATION
  KernelConfig-->>ExecEventsTest: test decision
Loading

Possibly related issues

Possibly related PRs

  • kxxt/tracexec#206 — Modifies the same x86_64 compat syscall handling components, including verifier and tracer behavior.
  • kxxt/tracexec#268 — Modifies compat syscall execution-event tests with conditional skipping.

Suggested labels: full-ci

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: conditionally skipping compat BPF hooks when IA32_EMULATION is absent.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ebpf-32bit

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces conditional loading of compat syscall hooks based on the kernel configuration (CONFIG_IA32_EMULATION) on x86_64 platforms, preventing load failures when legacy 32-bit emulation is disabled. Feedback on the changes suggests explicitly disabling these compat programs on all non-x86_64 architectures (such as aarch64 or riscv64) in both the tracer and the verifier complexity tool to avoid load failures on those platforms. Additionally, it is recommended to replace Option::is_none_or with map_or to maintain compatibility with older Rust toolchains.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread crates/tracexec-backend-ebpf/src/tracer.rs
Comment thread crates/tracexec-backend-ebpf/src/bin/verifier_complexity.rs
pub fn should_load_compat_syscall_hooks(kconfig: Option<&HashMap<String, ConfigSetting>>) -> bool {
// procfs omits `# CONFIG_IA32_EMULATION is not set`, so the option is absent
// from a successfully read configuration when support is disabled.
kconfig.is_none_or(|configs| configs.contains_key("CONFIG_IA32_EMULATION"))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Option::is_none_or was stabilized in Rust 1.82.0. To maintain compatibility with older Rust toolchains (MSRV), we can use map_or(true, ...) which is functionally identical and supported since Rust 1.0.0.

Suggested change
kconfig.is_none_or(|configs| configs.contains_key("CONFIG_IA32_EMULATION"))
kconfig.map_or(true, |configs| configs.contains_key("CONFIG_IA32_EMULATION"))

@codecov

codecov Bot commented Jul 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 48.48485% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.21%. Comparing base (939083b) to head (2836a0d).

Files with missing lines Patch % Lines
...acexec-backend-ebpf/src/bin/verifier_complexity.rs 0.00% 13 Missing ⚠️
crates/tracexec-backend-ebpf/src/tracer.rs 33.33% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #297      +/-   ##
==========================================
- Coverage   82.25%   82.21%   -0.05%     
==========================================
  Files          84       84              
  Lines       21026    21057      +31     
==========================================
+ Hits        17295    17311      +16     
- Misses       3731     3746      +15     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kxxt
kxxt merged commit 04c54fb into main Jul 18, 2026
23 of 25 checks passed
@kxxt
kxxt deleted the ebpf-32bit branch July 18, 2026 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant