Skip to content

rust: keep bindgen layout checks in every build - #607

Merged
RyanTheTide merged 1 commit into
integration/aurorafrom
conv/rust-bindgen-layout-mandatory
Oct 30, 2026
Merged

RyanTheTide merged 1 commit into
integration/aurorafrom
conv/rust-bindgen-layout-mandatory

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

Makes the bindgen layout assertions mandatory on integration/aurora again, as Ryan decided on 2026-10-30 (convergence item L7).

Stock bindgen 0.73.2 loses the alignment of an explicitly aligned empty C struct. With CONFIG_SCHEDSTATS=n, the empty cacheline-aligned sched_statistics shifts the following task_struct fields, and Rust read the wrong pointer as task_struct.mm (a real fault in percpu_counter_add_batch). With --no-layout-tests nothing flags it.

What changes

  • rust/Makefile no longer passes --no-layout-tests; BINDGEN_LAYOUT_TESTS is gone.
  • The top-level Makefile picks tools/aurora-bindgen/build/bin/bindgen when it has been prepared (also for O= builds). An explicit BINDGEN= still wins.
  • tools/aurora-bindgen/build.py defaults to tools/aurora-bindgen/build and publishes build/bin/bindgen only after its compile tests pass.
  • rust/kernel/device.rs: drop the stale expect(dead_code) on Device::parent() (L16).
  • CI: the rust-build job from aurora-wip (Merge integration/aurora 695d9745 into aurora-wip (SEP boot policy change) #585) that prepares the corrected generator and compiles the SEP module. The SEP ABI and recovery-tool checks stay on aurora-wip because they test the held-back v5 enrolment ABI (L6/L18).

The tree content matches aurora-wip for these files (b47f666, 7b563df, b18158c, 2706037), except the workflow, which is the L6-independent part.

Packaging: fedora-aurora kernel-aurora.spec, alarm-aurora linux-aurora/PKGBUILD and nixos-aurora (bindgen/) already build with the corrected 0.73.2, and the fleet recipe passes BINDGEN=.

Testing

  • Full shipping-recipe build (Fedora Asahi base config + asahi.config, Image modules dtbs) on buildbox with the generator prepared by build.py and no BINDGEN=: see the comment below.
  • CI rust-build on this PR.

🤖 Generated with Claude Code

Stock bindgen 0.73.2 drops the alignment of an explicitly aligned empty
C struct. With CONFIG_SCHEDSTATS=n the empty, cacheline-aligned
sched_statistics in task_struct loses its alignment, the following
fields move, and Rust read a scheduler list pointer as task_struct.mm.
The Asahi RSS charge then faulted in percpu_counter_add_batch. With
--no-layout-tests the build gives no sign of this.

Drop --no-layout-tests again so every Rust build checks the size,
alignment and offsets bindgen emits, and select the corrected
generator in tools/aurora-bindgen automatically when it has been
prepared (also for O= builds). build.py now defaults to
tools/aurora-bindgen/build and publishes build/bin/bindgen only after
its compile tests pass. An explicit BINDGEN= still wins. The Fedora,
Arch and NixOS kernel packages and the fleet recipe already build with
the corrected generator.

Drop the stale dead_code expectation on Device::parent(), which made
the WERROR KUnit build fail once a driver uses parent() with
AUXILIARY_BUS=n.

Add the rust-build CI job that prepares the corrected generator and
compiles the SEP module for arm64. The SEP ABI and recovery tests from
aurora-wip stay there until the v5 enrolment ABI lands.

This takes aurora-wip's b47f666, 7b563df, b18158c and
2706037, and the CI step from 5449640, and replaces the
opt-in default from 4c56f9c.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@RyanTheTide
RyanTheTide merged commit b6796c6 into integration/aurora Oct 30, 2026
1 check passed
@RyanTheTide
RyanTheTide deleted the conv/rust-bindgen-layout-mandatory branch October 30, 2026 05:17
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Booted in fleet10 (7.3.0-aurora-fleet10) on the Neo, the M2 and the M1 Pro with no regressions; the shipping-recipe build with the fleet bindgen passed. Details in aurora-ctl reports/fleet10-20261030.

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