diff options
| author | Alexander Kanavin <alex@linutronix.de> | 2024-05-21 14:50:38 +0200 | 
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2024-12-23 05:46:32 -0800 | 
| commit | 52a2a1101a4edb50760143e358868f4d706d26cc (patch) | |
| tree | db2b2a2d74b84fd2fbfba25cce91028c63946259 | |
| parent | c75016dcf38e9d8b18a78687f0e3bb250282a0e1 (diff) | |
| download | poky-52a2a1101a4edb50760143e358868f4d706d26cc.tar.gz | |
rust: add reproducibility patch to eliminate host leakage
[YOCTO #15185]
(From OE-Core rev: 01423828248b75e1f5afe2e5959ccd971df875cd)
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 924df18b47e9a69fa295bafe37bdb39d8eaea2bb)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
| -rw-r--r-- | meta/recipes-devtools/rust/files/0001-cargo-do-not-write-host-information-into-compilation.patch | 51 | ||||
| -rw-r--r-- | meta/recipes-devtools/rust/rust-source.inc | 1 | 
2 files changed, 52 insertions, 0 deletions
| diff --git a/meta/recipes-devtools/rust/files/0001-cargo-do-not-write-host-information-into-compilation.patch b/meta/recipes-devtools/rust/files/0001-cargo-do-not-write-host-information-into-compilation.patch new file mode 100644 index 0000000000..a6ee867605 --- /dev/null +++ b/meta/recipes-devtools/rust/files/0001-cargo-do-not-write-host-information-into-compilation.patch | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | From 065d7c263091118437465d714d8a29dbb6296921 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Alexander Kanavin <alex@linutronix.de> | ||
| 3 | Date: Mon, 13 May 2024 14:57:54 +0200 | ||
| 4 | Subject: [PATCH] cargo: do not write host information into compilation unit | ||
| 5 | hashes | ||
| 6 | |||
| 7 | This breaks reproducibility in cross-builds where the cross-target | ||
| 8 | can be the same, but build hosts are different, as seen with | ||
| 9 | "rustc --version -v": | ||
| 10 | ... | ||
| 11 | host: x86_64-unknown-linux-gnu | ||
| 12 | |||
| 13 | vs. | ||
| 14 | |||
| 15 | host: aarch64-unknown-linux-gnu | ||
| 16 | |||
| 17 | This can possibly be improved by only hashing host info if the build | ||
| 18 | is a native one (e.g. there's no --target option passed to cargo | ||
| 19 | invocation) but I'm not sure how. | ||
| 20 | |||
| 21 | Upstream-Status: Inappropriate [reported at https://github.com/rust-lang/cargo/issues/13922] | ||
| 22 | Signed-off-by: Alexander Kanavin <alex@linutronix.de> | ||
| 23 | --- | ||
| 24 | .../src/cargo/core/compiler/context/compilation_files.rs | 4 ++-- | ||
| 25 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
| 26 | |||
| 27 | diff --git a/src/tools/cargo/src/cargo/core/compiler/context/compilation_files.rs b/src/tools/cargo/src/cargo/core/compiler/context/compilation_files.rs | ||
| 28 | index d83dbf10c..b2ad8d9f3 100644 | ||
| 29 | --- a/src/tools/cargo/src/cargo/core/compiler/context/compilation_files.rs | ||
| 30 | +++ b/src/tools/cargo/src/cargo/core/compiler/context/compilation_files.rs | ||
| 31 | @@ -652,7 +652,7 @@ fn hash_rustc_version(bcx: &BuildContext<'_, '_>, hasher: &mut StableHasher) { | ||
| 32 | if vers.pre.is_empty() || bcx.config.cli_unstable().separate_nightlies { | ||
| 33 | // For stable, keep the artifacts separate. This helps if someone is | ||
| 34 | // testing multiple versions, to avoid recompiles. | ||
| 35 | - bcx.rustc().verbose_version.hash(hasher); | ||
| 36 | + //bcx.rustc().verbose_version.hash(hasher); | ||
| 37 | return; | ||
| 38 | } | ||
| 39 | // On "nightly"/"beta"/"dev"/etc, keep each "channel" separate. Don't hash | ||
| 40 | @@ -665,7 +665,7 @@ fn hash_rustc_version(bcx: &BuildContext<'_, '_>, hasher: &mut StableHasher) { | ||
| 41 | // Keep "host" since some people switch hosts to implicitly change | ||
| 42 | // targets, (like gnu vs musl or gnu vs msvc). In the future, we may want | ||
| 43 | // to consider hashing `unit.kind.short_name()` instead. | ||
| 44 | - bcx.rustc().host.hash(hasher); | ||
| 45 | + //bcx.rustc().host.hash(hasher); | ||
| 46 | // None of the other lines are important. Currently they are: | ||
| 47 | // binary: rustc <-- or "rustdoc" | ||
| 48 | // commit-hash: 38114ff16e7856f98b2b4be7ab4cd29b38bed59a | ||
| 49 | -- | ||
| 50 | 2.39.2 | ||
| 51 | |||
| diff --git a/meta/recipes-devtools/rust/rust-source.inc b/meta/recipes-devtools/rust/rust-source.inc index 8a8e48b8ca..55ea1b77e6 100644 --- a/meta/recipes-devtools/rust/rust-source.inc +++ b/meta/recipes-devtools/rust/rust-source.inc | |||
| @@ -13,6 +13,7 @@ SRC_URI += "https://static.rust-lang.org/dist/rustc-${RUST_VERSION}-src.tar.xz;n | |||
| 13 | file://target-build-value.patch;patchdir=${RUSTSRC} \ | 13 | file://target-build-value.patch;patchdir=${RUSTSRC} \ | 
| 14 | file://0001-Handle-vendored-sources-when-remapping-paths.patch;patchdir=${RUSTSRC} \ | 14 | file://0001-Handle-vendored-sources-when-remapping-paths.patch;patchdir=${RUSTSRC} \ | 
| 15 | file://repro-issue-fix-with-v175.patch;patchdir=${RUSTSRC} \ | 15 | file://repro-issue-fix-with-v175.patch;patchdir=${RUSTSRC} \ | 
| 16 | file://0001-cargo-do-not-write-host-information-into-compilation.patch;patchdir=${RUSTSRC} \ | ||
| 16 | " | 17 | " | 
| 17 | SRC_URI[rust.sha256sum] = "4526f786d673e4859ff2afa0bab2ba13c918b796519a25c1acce06dba9542340" | 18 | SRC_URI[rust.sha256sum] = "4526f786d673e4859ff2afa0bab2ba13c918b796519a25c1acce06dba9542340" | 
| 18 | 19 | ||
