build(xtask): remap Rust paths in firmware builds - #1029
Open
haitaohuang wants to merge 1 commit into
Open
Conversation
Append stable path remapping flags to the td-shim and MigTD cargo builds so native xtask images do not embed checkout or tool home paths. Preserve caller-provided RUSTFLAGS while normalizing the project, Cargo, and Rustup roots. Signed-off-by: Haitao Huang <haitaohuang@microsoft.com> Assisted-by: GitHub Copilot CLI:GPT-5.6-Sol [migtd-review]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--remap-path-prefixflags to the td-shim and MigTD builds launched by xtaskRUSTFLAGSCARGO_HOME, andRUSTUP_HOMEwithout changing profiles, LTO, C toolchain flags, Docker, or build outputs other than embedded pathsWhy this is needed
The build container masks path variance by cloning MigTD at
/root/MigTDwith fixed/root/.cargoand/root/.rustuphomes. However, the documentedcargo imageflow and the main CI image matrix both build natively, where those absolute paths depend on the checkout and user.Before this change, identical default builds from two absolute checkout roots produced different TDVF image SHA-256 values:
f43a483ce8ab833ff86bce493f639f7a4146b590ec136c9736490fbd271ca11f90f67e2daa56d2d1955964e7a7e156f23fe77336921e70f5a8aa68b348f79328The MigTD ELF contained 86 checkout-root, 22 Cargo-home, and 9 Rustup-home string occurrences. This patch removes those Rust path inputs independently of Docker. The default production image also links vendored C objects containing source paths; that separate source of variance is intentionally outside this Rust-only change, so this PR does not claim complete native production-image reproducibility.
Two-path reproducibility check
To isolate the xtask Rust pipeline, I built the documented native debug IGVM test configuration from two independent absolute checkout roots:
Both checkouts produced:
f36187a44249ca9da688d0dbcddea0591ce22dcb164f08fee30d763de58e5f35SERVTD_INFO_HASH:aa3103a2f30df203bf6d230d3ac42ac084c4cdaa917fef42bd7904b3c66f33e6bc031b48871cdc9873125df8f569413f695e42fbe2d9b0901c8a46fb853f406fe5d1b03b72ededbc0eb9702fc955e9f5The IGVM images and measurement files compared byte-identical, and the resulting MigTD ELF contained zero occurrences of either checkout root, the original Cargo home, or the original Rustup home.
Validation
cargo fmt --checkcargo test -p xtask