Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 128 additions & 0 deletions SPECS-EXTENDED/tardev-snapshotter/rustix-remove-rustc-attrs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
From 091d765c17cedc6d0f1828c74f001718e256ab35 Mon Sep 17 00:00:00 2001
From: Kavya Sree Kaitepalli <kkaitepalli@microsoft.com>
Date: Thu, 10 Sep 2026 15:49:19 +0000
Subject: [PATCH] Backport upstream rustix#1663 to remove rustc_attrs

Rust removed support for the internal rustc_layout_scalar_valid_range_start
/_end and rustc_nonnull_optimization_guaranteed attributes for external
crates starting around rustc 1.97 (rust-lang/rust#155433,
rust-lang/rust#156510), as part of an in-progress migration to pattern
types. tardev-snapshotter's Makefile builds with RUSTC_BOOTSTRAP=1, which
lets this crate's build.rs probe (use_feature_or_nothing("rustc_attrs"))
successfully detect #![feature(rustc_attrs)] support and enable the
rustc_attrs cfg, activating the now-forbidden attributes on Errno,
BorrowedFd, and OwnedFd:

error: attributes starting with `rustc` are reserved for use by the
`rustc` compiler
error: cannot find attribute `rustc_layout_scalar_valid_range_start` in
this scope

- build.rs: remove the rustc_attrs feature probe
- src/lib.rs: remove the now-unreachable feature(rustc_attrs) gate
- src/backend/linux_raw/io/errno.rs: unconditionally allow
unused_unsafe, and comment out the two scalar-valid-range attributes
on Errno
- src/io/fd/owned.rs: comment out the scalar-valid-range /
nonnull-optimization attributes on BorrowedFd and OwnedFd

This only forgoes niche-layout optimizations on these three internal
types and has no other functional effect.

Upstream Patch Reference: https://github.com/bytecodealliance/rustix/commit/aab946409792a9363cbac644c2fd0f7b2762f071.patch
---
.../rustix-0.37.27/build.rs | 1 -
.../rustix-0.37.27/src/backend/linux_raw/io/errno.rs | 6 +++---
.../rustix-0.37.27/src/io/fd/owned.rs | 12 ++++++------
.../rustix-0.37.27/src/lib.rs | 1 -
4 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/registry/src/index.crates.io-1949cf8c6b5b557f/rustix-0.37.27/build.rs b/registry/src/index.crates.io-1949cf8c6b5b557f/rustix-0.37.27/build.rs
index 320b305..41df155 100644
--- a/registry/src/index.crates.io-1949cf8c6b5b557f/rustix-0.37.27/build.rs
+++ b/registry/src/index.crates.io-1949cf8c6b5b557f/rustix-0.37.27/build.rs
@@ -11,7 +11,6 @@ fn main() {
// the rustc version.
println!("cargo:rerun-if-changed=build.rs");

- use_feature_or_nothing("rustc_attrs");

// Features only used in no-std configurations.
#[cfg(not(feature = "std"))]
diff --git a/registry/src/index.crates.io-1949cf8c6b5b557f/rustix-0.37.27/src/backend/linux_raw/io/errno.rs b/registry/src/index.crates.io-1949cf8c6b5b557f/rustix-0.37.27/src/backend/linux_raw/io/errno.rs
index a6d30ca..f0da63f 100644
--- a/registry/src/index.crates.io-1949cf8c6b5b557f/rustix-0.37.27/src/backend/linux_raw/io/errno.rs
+++ b/registry/src/index.crates.io-1949cf8c6b5b557f/rustix-0.37.27/src/backend/linux_raw/io/errno.rs
@@ -8,7 +8,7 @@
//! Linux uses error codes in `-4095..0`; we use rustc attributes to describe
//! this restricted range of values.
#![allow(unsafe_code)]
-#![cfg_attr(not(rustc_attrs), allow(unused_unsafe))]
+#![allow(unused_unsafe)]

use super::super::c;
use crate::backend::fd::RawFd;
@@ -25,8 +25,8 @@ use linux_raw_sys::errno;
#[derive(Eq, PartialEq, Hash, Copy, Clone)]
// Linux returns negated error codes, and we leave them in negated form, so
// error codes are in `-4095..0`.
-#[cfg_attr(rustc_attrs, rustc_layout_scalar_valid_range_start(0xf001))]
-#[cfg_attr(rustc_attrs, rustc_layout_scalar_valid_range_end(0xffff))]
+//#[rustc_layout_scalar_valid_range_start(0xf001)]
+//#[rustc_layout_scalar_valid_range_end(0xffff)]
pub struct Errno(u16);

impl Errno {
diff --git a/registry/src/index.crates.io-1949cf8c6b5b557f/rustix-0.37.27/src/io/fd/owned.rs b/registry/src/index.crates.io-1949cf8c6b5b557f/rustix-0.37.27/src/io/fd/owned.rs
index 2b9238c..f0d7414 100644
--- a/registry/src/index.crates.io-1949cf8c6b5b557f/rustix-0.37.27/src/io/fd/owned.rs
+++ b/registry/src/index.crates.io-1949cf8c6b5b557f/rustix-0.37.27/src/io/fd/owned.rs
@@ -29,13 +29,13 @@ use core::mem::forget;
/// descriptor, which is then borrowed under the same lifetime.
#[derive(Copy, Clone)]
#[repr(transparent)]
-#[cfg_attr(rustc_attrs, rustc_layout_scalar_valid_range_start(0))]
+//#[rustc_layout_scalar_valid_range_start(0)]
// libstd/os/raw/mod.rs assures me that every libstd-supported platform has a
// 32-bit c_int. Below is -2, in two's complement, but that only works out
// because c_int is 32 bits.
-#[cfg_attr(rustc_attrs, rustc_layout_scalar_valid_range_end(0xFF_FF_FF_FE))]
+//#[rustc_layout_scalar_valid_range_end(0xFF_FF_FF_FE)]
#[cfg_attr(staged_api, unstable(feature = "io_safety", issue = "87074"))]
-#[cfg_attr(rustc_attrs, rustc_nonnull_optimization_guaranteed)]
+//#[rustc_nonnull_optimization_guaranteed]
pub struct BorrowedFd<'fd> {
fd: RawFd,
_phantom: PhantomData<&'fd OwnedFd>,
@@ -50,13 +50,13 @@ pub struct BorrowedFd<'fd> {
/// passed as a consumed argument or returned as an owned value, and it never
/// has the value `-1`.
#[repr(transparent)]
-#[cfg_attr(rustc_attrs, rustc_layout_scalar_valid_range_start(0))]
+//#[rustc_layout_scalar_valid_range_start(0)]
// libstd/os/raw/mod.rs assures me that every libstd-supported platform has a
// 32-bit c_int. Below is -2, in two's complement, but that only works out
// because c_int is 32 bits.
-#[cfg_attr(rustc_attrs, rustc_layout_scalar_valid_range_end(0xFF_FF_FF_FE))]
+//#[rustc_layout_scalar_valid_range_end(0xFF_FF_FF_FE)]
#[cfg_attr(staged_api, unstable(feature = "io_safety", issue = "87074"))]
-#[cfg_attr(rustc_attrs, rustc_nonnull_optimization_guaranteed)]
+//#[rustc_nonnull_optimization_guaranteed]
pub struct OwnedFd {
fd: RawFd,
}
diff --git a/registry/src/index.crates.io-1949cf8c6b5b557f/rustix-0.37.27/src/lib.rs b/registry/src/index.crates.io-1949cf8c6b5b557f/rustix-0.37.27/src/lib.rs
index 3316c50..356ffb7 100644
--- a/registry/src/index.crates.io-1949cf8c6b5b557f/rustix-0.37.27/src/lib.rs
+++ b/registry/src/index.crates.io-1949cf8c6b5b557f/rustix-0.37.27/src/lib.rs
@@ -98,7 +98,6 @@
#![deny(missing_docs)]
#![allow(stable_features)]
#![cfg_attr(linux_raw, deny(unsafe_code))]
-#![cfg_attr(rustc_attrs, feature(rustc_attrs))]
#![cfg_attr(doc_cfg, feature(doc_cfg))]
#![cfg_attr(all(wasi_ext, target_os = "wasi", feature = "std"), feature(wasi_ext))]
#![cfg_attr(
--
2.45.4

12 changes: 10 additions & 2 deletions SPECS-EXTENDED/tardev-snapshotter/tardev-snapshotter.spec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Summary: Tardev Snapshotter for containerd
Name: tardev-snapshotter
Version: 3.2.0.tardev1
Release: 10%{?dist}
Release: 11%{?dist}
License: ASL 2.0
Group: Tools/Container
Vendor: Microsoft Corporation
Expand All @@ -13,6 +13,8 @@ Source0:https://github.com/microsoft/kata-containers/archive/refs/tags/%{version
# Note: the %%{name}-%%{name}-%%{version}-cargo.tar.gz file contains a cache created by capturing the contents downloaded into $CARGO_HOME.
# To update the cache run regenerate-archives.sh
Source1: %{_distro_sources_url}/%{name}-%{version}-cargo.tar.gz
# Backports upstream bytecodealliance/rustix#1663 to the cached rustix 0.37.27 sources (Source1); applied manually below since it's outside the main source tree.
Patch0: rustix-remove-rustc-attrs.patch

%{?systemd_requires}

Expand All @@ -36,7 +38,10 @@ pushd $HOME
tar xf %{SOURCE1} --no-same-owner
popd

%autosetup -p1
%autosetup -p1 -N

# Apply Patch0 to the cached rustix sources (not part of the main source tree, so %%autosetup can't apply it).
patch -p1 -d "$HOME/.cargo" < %{PATCH0}

%build
export CARGO_NET_OFFLINE=true
Expand Down Expand Up @@ -67,6 +72,9 @@ fi
%config(noreplace) %{_unitdir}/%{name}.service

%changelog
* Thu Sep 10 2026 Kavya Sree Kaitepalli <kkaitepalli@microsoft.com> - 3.2.0.tardev1-11
- Backport upstream bytecodealliance/rustix#1663 to rebuild with rust

* Wed Aug 19 2026 Kavya Sree Kaitepalli <kkaitepalli@microsoft.com> - 3.2.0.tardev1-10
- Bump release to rebuild with rust

Expand Down
6 changes: 5 additions & 1 deletion SPECS/kata-containers-cc/kata-containers-cc.spec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

Name: kata-containers-cc
Version: 3.15.0.aks0
Release: 20%{?dist}
Release: 21%{?dist}
Summary: Kata Confidential Containers package developed for Confidential Containers on AKS
License: ASL 2.0
URL: https://github.com/microsoft/kata-containers
Expand All @@ -27,6 +27,7 @@ Patch10: CVE-2026-55969.patch
Patch11: CVE-2026-50540.patch
Patch12: CVE-2026-44210.patch
Patch13: rust-fix-unstable-name-collisions.patch
Patch14: rustix-remove-rustc-attrs.patch
ExclusiveArch: x86_64

BuildRequires: azurelinux-release
Expand Down Expand Up @@ -162,6 +163,9 @@ fi
%{tools_pkg}/tools/osbuilder/node-builder/azure-linux/agent-install/usr/lib/systemd/system/kata-agent.service

%changelog
* Thu Sep 10 2026 Kavya Sree Kaitepalli <kkaitepalli@microsoft.com> - 3.15.0.aks0-21
- Backport upstream rustix#1663 to build with latest rust

* Wed Aug 26 2026 Kavya Sree Kaitepalli <kkaitepalli@microsoft.com> - 3.15.0.aks0-20
- Fix unstable_name_collisions rust build errors in kata-sys-util mount.rs

Expand Down
151 changes: 151 additions & 0 deletions SPECS/kata-containers-cc/rustix-remove-rustc-attrs.patch

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions SPECS/rust-bootstrap/rust-bootstrap.signatures.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"Signatures": {
"cargo-1.95.0-x86_64-unknown-linux-gnu.tar.xz": "e74edd2cf7d0f1f1383b4f00eb90c843750bc489e2ccf7214e6476678a907425",
"rustc-1.95.0-x86_64-unknown-linux-gnu.tar.xz": "8426a3d170a5879f5682f5fbdd024a1779b3951e7baba685af2d6dc32a6dfc15",
"rust-std-1.95.0-x86_64-unknown-linux-gnu.tar.xz": "047ea7098803d3500fa1072e9cee5392697e21525559e4458128a2bf874aa382",
"cargo-1.95.0-aarch64-unknown-linux-gnu.tar.xz": "7c070aeba9bbf12073646995a03f36c346bb5f541d0078ba6d9dc2a7adaaf6af",
"rustc-1.95.0-aarch64-unknown-linux-gnu.tar.xz": "0fe3689eeaed603e5ef24572d11597d3edadaefd2cb181674ad621260f2501d2",
"rust-std-1.95.0-aarch64-unknown-linux-gnu.tar.xz": "3a21b271b1ff973b94d69b25e7a39992f9fbcae1ab6d9475844a23e6ad3908ac"
"cargo-1.97.1-aarch64-unknown-linux-gnu.tar.xz": "8f70bcaccea5ba4db187c3fd4d64e24592b4e16af513497201f5909d61691dbe",
"cargo-1.97.1-x86_64-unknown-linux-gnu.tar.xz": "e1be5f5ff7f7f80ca506fb65770b759edbdc6d303781ed71c5de8ec8a8394779",
"rust-std-1.97.1-aarch64-unknown-linux-gnu.tar.xz": "46aed8e63186350004d8ec6afca798811e6530b514352e5a8a26f3dc4939b3be",
"rust-std-1.97.1-x86_64-unknown-linux-gnu.tar.xz": "1c1e704ae80126b7de34f72ea2825f7fd01736dec20732faed47374b95282fba",
"rustc-1.97.1-aarch64-unknown-linux-gnu.tar.xz": "b344b81f0cd4c2246c7da8b197fe7a339d7dd02bb15cb69b2524115d9c75224c",
"rustc-1.97.1-x86_64-unknown-linux-gnu.tar.xz": "9819d0a32d56bd339585319c80260e332779f5541fd66838ab7e016d6c814819"
}
}
}
4 changes: 2 additions & 2 deletions SPECS/rust-bootstrap/rust-bootstrap.spec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Summary: Prebuilt stage0 bootstrap toolchain used to build rust
Name: rust-bootstrap
Version: 1.95.0
Version: 1.97.1
Release: 1%{?dist}
License: (ASL 2.0 OR MIT) AND BSD AND CC-BY-3.0
Vendor: Microsoft Corporation
Expand All @@ -14,7 +14,7 @@ BuildArch: noarch
# consumed by rust.spec to bootstrap-compile a new toolchain from source.
# - When bumping "stage0_version"/"release_date" in rust.spec, bump the same
# values here (Version and %{release_date}) and rebuild this package first.
%define release_date 2026-04-16
%define release_date 2026-07-16

Source0: https://static.rust-lang.org/dist/%{release_date}/cargo-%{version}-x86_64-unknown-linux-gnu.tar.xz
Source1: https://static.rust-lang.org/dist/%{release_date}/rustc-%{version}-x86_64-unknown-linux-gnu.tar.xz
Expand Down
Loading
Loading