feat(cardwire-ebpf): send event on manual mode and make force_gpu works - #174
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughSummary by CodeRabbit
WalkthroughExecution events now carry smart or manual mode values. eBPF enforcement uses mode-specific GPU mapping behavior. The daemon applies the mode in ChangesMode-aware GPU enforcement
VM test matrix
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant EBPF as eBPF tracepoint
participant Event as ExecEvent
participant Analyzer as CardwireAnalyzer
participant Enforcement as is_inode_blocked
participant Launch as GPU launch
EBPF->>Event: Emit process ID and mode
Event->>Analyzer: Deliver execution event
Analyzer->>Analyzer: Apply environment overrides
Enforcement->>Enforcement: Check inode state and forced GPU mappings
Launch->>Launch: Set CARDWIRE_FORCE_GPU and DRI_PRIME
Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/cardwire-ebpf/src/helpers.rs`:
- Around line 60-80: Update the manual-mode branch around the `MANUAL` check to
consult `CW_ALLOWED_PID` for the current PID and its PPID before performing the
`CW_FORCED_PID` lookup. If either process is explicitly allowed, preserve the
allow-and-exit behavior used by smart mode; otherwise retain the existing
forced-GPU matching and default blocking logic.
In `@crates/cardwire-ebpf/src/maps.rs`:
- Around line 76-78: The ExecEvent definitions in
crates/cardwire-ebpf/src/maps.rs:76-78,
crates/cardwire-ebpf/src/main.rs:469-473, and
crates/cardwire-daemon/src/analyzer/models.rs:22-24 must use #[repr(C)] with a
reserved [u8; 3] field so the wire layout remains 8 bytes; initialize reserved
before each ring_buf.write(event) in the eBPF producer.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 95ca5ef6-7af1-4e3f-adf9-d4cc4348b9dc
📒 Files selected for processing (4)
crates/cardwire-daemon/src/analyzer/models.rscrates/cardwire-ebpf/src/helpers.rscrates/cardwire-ebpf/src/main.rscrates/cardwire-ebpf/src/maps.rs
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/cicd.yml:
- Line 142: Update the actions/checkout step in the vm-test job to set
persist-credentials to false, ensuring the checkout token is not retained in
.git/config; leave credential provisioning to any future step that explicitly
requires Git authentication.
In `@nix/ci-2gpu.nix`:
- Around line 82-88: Update the “Test Dynamic Analysis ENV Flags” subtest to
replace the shell builtin `:` with an actual executable child process for each
CARDWIRE_ALLOW and CARDWIRE_FORCE_DGPU case. Ensure the child receives the
override environment and delays its `/dev/dri/renderD129` access until dynamic
analysis has completed, while preserving the existing succeed/fail expectations
for values 1 and 0.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 1ed3697e-4c62-437c-9c9f-fbcd2d129a99
📒 Files selected for processing (13)
.github/workflows/cicd.ymlcrates/cardwire-daemon/src/analyzer/models.rscrates/cardwire-daemon/src/core/gpu/display.rscrates/cardwire-daemon/src/interface/gpu.rscrates/cardwire-daemon/src/interface/mode.rscrates/cardwire-ebpf-userspace/src/lib.rscrates/cardwire-ebpf/src/helpers.rscrates/cardwire-ebpf/src/main.rscrates/cardwire-ebpf/src/maps.rsflake.nixnix/ci-15gpu.nixnix/ci-2gpu.nixnix/ci-3gpu.nix
Description
Please include a summary of the changes and if applicable, a related issue.
If this PR introduce a new feature, explain your motivations
Fixes # (issue)
TODO
Checklist: