From 23758d447ce32668237991b29e2f79601a855b26 Mon Sep 17 00:00:00 2001 From: Jiaqi Gao Date: Mon, 2 Dec 2024 22:31:06 -0500 Subject: [PATCH 1/2] ci: install cargo tools with newer toolchain Signed-off-by: Jiaqi Gao --- .github/workflows/format.yml | 15 +++++++++++---- .github/workflows/fuzz.yml | 26 ++++++++++++++------------ 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 35947b8..e577f26 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -41,16 +41,23 @@ jobs: toolchain: nightly-2023-12-31 override: true components: clippy - + + - name: install stable rust toolchain + uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 + with: + toolchain: 1.78.0 + profile: minimal + override: true + - name: Install required cargo - run: cargo install clippy-sarif sarif-fmt + run: cargo +stable-x86_64-unknown-linux-gnu install clippy-sarif sarif-fmt - name: Preparation Work run: bash sh_script/preparation.sh - name: Run rust-clippy for result collection run: - cargo clippy + cargo +nightly-2023-12-31-x86_64-unknown-linux-gnu clippy --features stack-guard,virtio-vsock,virtio-serial,vmcall-interrupt --message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt continue-on-error: true @@ -62,7 +69,7 @@ jobs: wait-for-processing: true - name: Run rust-clippy - run: cargo clippy --features stack-guard,virtio-vsock,virtio-serial,vmcall-interrupt + run: cargo +nightly-2023-12-31-x86_64-unknown-linux-gnu clippy --features stack-guard,virtio-vsock,virtio-serial,vmcall-interrupt rustfmt: name: Format diff --git a/.github/workflows/fuzz.yml b/.github/workflows/fuzz.yml index e685f2d..0fab967 100644 --- a/.github/workflows/fuzz.yml +++ b/.github/workflows/fuzz.yml @@ -14,6 +14,7 @@ env: AR_x86_64_unknown_none: llvm-ar CC_x86_64_unknown_none: clang RUST_TOOLCHAIN: nightly-2023-12-31 + RUST_STABLE_TOOLCHAIN: 1.78.0 TOOLCHAIN_PROFILE: minimal AFL_NO_AFFINITY: 1 @@ -33,6 +34,13 @@ jobs: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: submodules: recursive + + - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 + with: + toolchain: 1.78.0 + profile: minimal + override: true + - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 with: toolchain: nightly-2023-12-31 @@ -41,26 +49,20 @@ jobs: components: rust-src, llvm-tools-preview - name: Run cargo install cargo-xbuild - uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3 - with: - command: install - args: cargo-xbuild + run: cargo install cargo-xbuild - name: install NASM uses: ilammy/setup-nasm@13cbeb366c45c4379d3478cdcbadd8295feb5028 # v1.5.1 - name: Install AFL - uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3 - with: - command: install - args: cargo-afl + run: cargo install cargo-afl - name: Install Cargo-Fuzz - uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3 - with: - command: install - args: cargo-fuzz + run: cargo +stable-x86_64-unknown-linux-gnu install cargo-fuzz + - name: Select default toolchain + run: rustup default nightly-2023-12-31 + - name: Preparation work run: bash sh_script/preparation.sh From 5f2fc48ebed1d456143a8c79a52bd45fc938297a Mon Sep 17 00:00:00 2001 From: Jiaqi Gao Date: Tue, 3 Dec 2024 03:29:44 -0500 Subject: [PATCH 2/2] migtd: fix dependency `x86_64` version to avoid incompatibility Latest `x86_64` is not compatible with old rust toolchain. Signed-off-by: Jiaqi Gao --- src/crypto/fuzz/Cargo.toml | 1 + src/devices/virtio/fuzz/Cargo.toml | 1 + src/devices/vsock/fuzz/Cargo.toml | 1 + src/migtd/fuzz/Cargo.toml | 1 + src/policy/fuzz/Cargo.toml | 1 + 5 files changed, 5 insertions(+) diff --git a/src/crypto/fuzz/Cargo.toml b/src/crypto/fuzz/Cargo.toml index 0001da7..ef616f2 100644 --- a/src/crypto/fuzz/Cargo.toml +++ b/src/crypto/fuzz/Cargo.toml @@ -14,6 +14,7 @@ afl = { version = "*", optional = true } arbitrary = "=1.1.3" der = { version = "0.7.9", features = ["oid", "alloc"] } serde = "=1.0.198" +x86_64 = "=0.14.11" [dependencies.crypto] path = ".." diff --git a/src/devices/virtio/fuzz/Cargo.toml b/src/devices/virtio/fuzz/Cargo.toml index fd76d3b..2e07e24 100644 --- a/src/devices/virtio/fuzz/Cargo.toml +++ b/src/devices/virtio/fuzz/Cargo.toml @@ -17,6 +17,7 @@ bitmap-allocator = { git = "https://github.com/rcore-os/bitmap-allocator", rev = spin = "0.9.2" arbitrary = "=1.1.3" serde = "=1.0.198" +x86_64 = "=0.14.11" [features] default = ["libfuzzer-sys"] diff --git a/src/devices/vsock/fuzz/Cargo.toml b/src/devices/vsock/fuzz/Cargo.toml index b15c56b..16d1428 100644 --- a/src/devices/vsock/fuzz/Cargo.toml +++ b/src/devices/vsock/fuzz/Cargo.toml @@ -18,6 +18,7 @@ libfuzzer-sys = { version = "0.4", optional = true } afl = {version = "*", optional = true } arbitrary = "=1.1.3" serde = "=1.0.198" +x86_64 = "=0.14.11" [dependencies.vsock] path = ".." diff --git a/src/migtd/fuzz/Cargo.toml b/src/migtd/fuzz/Cargo.toml index 5b01977..5bf2e39 100644 --- a/src/migtd/fuzz/Cargo.toml +++ b/src/migtd/fuzz/Cargo.toml @@ -14,6 +14,7 @@ afl = { version = "*", optional = true } r-efi = "3.2.0" arbitrary = "=1.1.3" serde = "=1.0.198" +x86_64 = "=0.14.11" [patch.crates-io] ring = { path = "../../../deps/td-shim/library/ring" } diff --git a/src/policy/fuzz/Cargo.toml b/src/policy/fuzz/Cargo.toml index e2d241f..d4e7e6e 100644 --- a/src/policy/fuzz/Cargo.toml +++ b/src/policy/fuzz/Cargo.toml @@ -16,6 +16,7 @@ afl = {version = "*", optional = true } arbitrary = "=1.1.3" log = "0.4.13" serde = "=1.0.198" +x86_64 = "=0.14.11" [features] default = ["libfuzzer-sys"]