Skip to content

fix(init): pass the VFIO version ioctl request as the libc's type - #2007

Closed
daniel-noland wants to merge 1 commit into
mainfrom
pr/daniel-noland/vfio-ioctl-musl
Closed

daniel-noland wants to merge 1 commit into
mainfrom
pr/daniel-noland/vfio-ioctl-musl

Conversation

@daniel-noland

Copy link
Copy Markdown
Collaborator

Main currently fails the aarch64 musl cross test build, so every merge-queue run fails in cross/dataplane/bluefield3/musl. For example, #1949's run 40460815582:

error[E0308]: mismatched types
   --> ./init/src/vfio.rs:612:17
612 |                 VFIO_GET_API_VERSION,
    |                 ^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `u64`

a0f211c (#2003) added a container-node test that passes VFIO_GET_API_VERSION to libc::ioctl as a c_ulong. That is the request type on glibc, but musl's ioctl takes a c_int.

The fix casts at the call site with as _, as dataplane/src/drivers/kernel/offload.rs does for SIOCETHTOOL. The value (0x3b64) fits either type. The truncation lint fires only on musl, so it is allowed rather than expected.

Verified locally:

  • cargo check -p dataplane-init --tests --target x86_64-unknown-linux-musl -Zbuild-std reproduces E0308 without the fix and passes with it.
  • cargo clippy -p dataplane-init --tests -- -D warnings is clean on both gnu and musl.
  • cargo fmt --check passes.

🤖 Generated with Claude Code

The container-node test passed VFIO_GET_API_VERSION to libc::ioctl as a
c_ulong. That is the request type on glibc, but musl's ioctl takes a
c_int, so the aarch64 musl cross test build failed with E0308 and every
merge-queue run since a0f211c has failed in cross/dataplane/bluefield3/musl.

Cast at the call site, as kernel/offload.rs does for SIOCETHTOOL. The
value (0x3b64) fits either type; the truncation lint only fires on musl,
so it is allowed rather than expected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Daniel Noland <daniel@githedgehog.com>
@daniel-noland
daniel-noland requested a review from a team as a code owner October 27, 2026 07:32
@daniel-noland daniel-noland added the ci:+merge-ready Run all checks which will be run in the merge queue regardless of label status label Oct 27, 2026
@daniel-noland
daniel-noland requested review from sergeymatov and a balanced review from Copilot and removed request for a team October 27, 2026 07:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: d0b90297-a568-49bb-93ae-6aedd6632087
Commits

Reviewing files that changed from the base of the PR and between 2a9e355 and f49f019.

Files selected for processing: 1
  • init/src/vfio.rs

Included review availability: This review used your included allowance. 2 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.

Walkthrough

The VFIO API-version test now casts VFIO_GET_API_VERSION to the ioctl argument type. A comment explains the glibc and musl type difference and notes that the value fits either type.

Changes: VFIO ioctl compatibility

Layer / File(s) Summary
VFIO API-version test
init/src/vfio.rs
The test permits the possible-truncation lint and casts VFIO_GET_API_VERSION to the ioctl argument type. A comment describes the glibc and musl request types.

Possibly related PRs

  • githedgehog/dataplane#2004: Changes the declared type of VFIO_GET_API_VERSION, which relates to the ioctl request type handled here.

Priority: Low

Merge Risk: Minimal · up to f49f0

The platform-specific ioctl request type is handled by the cast, with no remaining merge-blocking concern.

Pre-merge checks: Passed 5
Check name Status Explanation
Description check Passed The description clearly explains the musl build failure, the ioctl type mismatch, the cast-based fix, and the reported verification steps. It is directly related to the changeset.
Title check Passed The title clearly and concisely identifies the main change: passing the VFIO version ioctl request using the type expected by libc.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within survi…
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 1 files.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@codecov

codecov Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@daniel-noland

Copy link
Copy Markdown
Collaborator Author

closed in favor of #2004

auto-merge was automatically disabled October 27, 2026 18:06

Pull request was closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:+merge-ready Run all checks which will be run in the merge queue regardless of label status

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants