From 1382bbeb4a16d319df509258815f6638de9cf870 Mon Sep 17 00:00:00 2001 From: Alex Huszagh Date: Mon, 18 Jul 2022 12:48:10 -0500 Subject: [PATCH 1/4] Fix SELinux labels to allow shared use. Ensure that the volumes are not mounted as private, unshared volumes since we might mount with the host filesystem. This also fixes permissions issues with reading data from a mounted volume using a rootless container engine. --- .changes/962.json | 5 +++++ src/docker/local.rs | 14 +++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) create mode 100644 .changes/962.json diff --git a/.changes/962.json b/.changes/962.json new file mode 100644 index 000000000..cbff84ca1 --- /dev/null +++ b/.changes/962.json @@ -0,0 +1,5 @@ +{ + "description": "fix SELinux labels to allow use in multiple containers and/or the host filesystem.", + "type": "fixed", + "issues": [961] +} diff --git a/src/docker/local.rs b/src/docker/local.rs index 2d86d3d07..ed65f0b59 100644 --- a/src/docker/local.rs +++ b/src/docker/local.rs @@ -39,21 +39,21 @@ pub(crate) fn run( docker_user_id(&mut docker, engine.kind); docker - .args(&["-v", &format!("{}:/xargo:Z", dirs.xargo.to_utf8()?)]) - .args(&["-v", &format!("{}:/cargo:Z", dirs.cargo.to_utf8()?)]) + .args(&["-v", &format!("{}:/xargo:z", dirs.xargo.to_utf8()?)]) + .args(&["-v", &format!("{}:/cargo:z", dirs.cargo.to_utf8()?)]) // Prevent `bin` from being mounted inside the Docker container. .args(&["-v", "/cargo/bin"]); if mount_volumes { docker.args(&[ "-v", - &format!("{}:{}:Z", dirs.host_root.to_utf8()?, dirs.mount_root), + &format!("{}:{}:z", dirs.host_root.to_utf8()?, dirs.mount_root), ]); } else { - docker.args(&["-v", &format!("{}:/project:Z", dirs.host_root.to_utf8()?)]); + docker.args(&["-v", &format!("{}:/project:z", dirs.host_root.to_utf8()?)]); } docker - .args(&["-v", &format!("{}:/rust:Z,ro", dirs.sysroot.to_utf8()?)]) - .args(&["-v", &format!("{}:/target:Z", dirs.target.to_utf8()?)]); + .args(&["-v", &format!("{}:/rust:z,ro", dirs.sysroot.to_utf8()?)]) + .args(&["-v", &format!("{}:/target:z", dirs.target.to_utf8()?)]); docker_cwd(&mut docker, &paths, mount_volumes)?; // When running inside NixOS or using Nix packaging we need to add the Nix @@ -61,7 +61,7 @@ pub(crate) fn run( if let Some(ref nix_store) = dirs.nix_store { docker.args(&[ "-v", - &format!("{}:{}:Z", nix_store.to_utf8()?, nix_store.as_posix()?), + &format!("{}:{}:z", nix_store.to_utf8()?, nix_store.as_posix()?), ]); } From 7d593d77a1fb13d3b82ccc8fde335dc633cc69a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Fri, 3 Feb 2023 23:14:14 +0100 Subject: [PATCH 2/4] remove dev-version from release config --- Cargo.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 10eeeb09e..64e5d09ed 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -66,7 +66,6 @@ once_cell = "1" walkdir = "2" [package.metadata.release] -dev-version = false push = false publish = false tag = false From 6983a921debadf027d4edcd1ee8dc5707bc6d466 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Fri, 3 Feb 2023 23:14:48 +0100 Subject: [PATCH 3/4] changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 55b47a683..2c3ee3f0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] - ReleaseDate +## Fixed + +- #962 - fix SELinux labels to allow use in multiple containers and/or the host filesystem. + ## [v0.2.4] - 2022-07-10 ## Fixed From 5b0bf5ce486789e21f065231e5d11be1d578bb1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Fri, 3 Feb 2023 23:18:03 +0100 Subject: [PATCH 4/4] Release v0.2.5 --- CHANGELOG.md | 6 +++++- Cargo.lock | 2 +- Cargo.toml | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c3ee3f0a..c63e47aa4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] - ReleaseDate +## [v0.2.5] - 2023-02-03 + ## Fixed - #962 - fix SELinux labels to allow use in multiple containers and/or the host filesystem. @@ -368,7 +370,9 @@ This project adheres to [Semantic Versioning](http://semver.org/). -[Unreleased]: https://github.com/cross-rs/cross/compare/v0.2.4...HEAD +[Unreleased]: https://github.com/cross-rs/cross/compare/v0.2.5...HEAD + +[v0.2.5]: https://github.com/cross-rs/cross/compare/v0.2.4...v0.2.5 [v0.2.4]: https://github.com/cross-rs/cross/compare/v0.2.3...v0.2.4 diff --git a/Cargo.lock b/Cargo.lock index 0ca6781d1..a95faa1ec 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -150,7 +150,7 @@ checksum = "fb58b6451e8c2a812ad979ed1d83378caa5e927eef2622017a45f251457c2c9d" [[package]] name = "cross" -version = "0.2.4" +version = "0.2.5" dependencies = [ "atty", "clap", diff --git a/Cargo.toml b/Cargo.toml index 64e5d09ed..d2c8f7b0d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ keywords = ["cross", "compilation", "testing", "tool"] license = "MIT OR Apache-2.0" name = "cross" repository = "https://github.com/cross-rs/cross" -version = "0.2.4" +version = "0.2.5" edition = "2021" include = [ "src/**/*",