Skip to content

Commit

Permalink
remove nightly features and switch to stable toolchain
Browse files Browse the repository at this point in the history
Signed-off-by: Jiaqi Gao <[email protected]>
  • Loading branch information
gaojiaqi7 committed Dec 26, 2024
1 parent 2efdd71 commit f8618a8
Show file tree
Hide file tree
Showing 17 changed files with 37 additions and 64 deletions.
18 changes: 6 additions & 12 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ env:
AS: nasm
AR: llvm-ar
CC: clang
RUST_TOOLCHAIN: 1.83.0

permissions:
contents: read
Expand Down Expand Up @@ -38,26 +39,19 @@ jobs:
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7
with:
profile: minimal
toolchain: nightly-2023-12-31
toolchain: ${{ env.RUST_TOOLCHAIN }}
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 +stable-x86_64-unknown-linux-gnu install clippy-sarif sarif-fmt
run: cargo install clippy-sarif sarif-fmt

- name: Preparation Work
run: bash sh_script/preparation.sh

- name: Run rust-clippy for result collection
run:
cargo +nightly-2023-12-31-x86_64-unknown-linux-gnu clippy
cargo 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
Expand All @@ -69,7 +63,7 @@ jobs:
wait-for-processing: true

- name: Run rust-clippy
run: cargo +nightly-2023-12-31-x86_64-unknown-linux-gnu clippy --features stack-guard,virtio-vsock,virtio-serial,vmcall-interrupt
run: cargo clippy --features stack-guard,virtio-vsock,virtio-serial,vmcall-interrupt

rustfmt:
name: Format
Expand All @@ -95,7 +89,7 @@ jobs:
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7
with:
profile: minimal
toolchain: nightly-2023-12-31
toolchain: ${{ env.RUST_TOOLCHAIN }}
override: true
components: rustfmt

Expand Down
18 changes: 4 additions & 14 deletions .github/workflows/fuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ env:
AS: nasm
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
RUST_TOOLCHAIN: nightly
TOOLCHAIN_PROFILE: minimal
AFL_NO_AFFINITY: 1

Expand All @@ -37,19 +36,10 @@ jobs:

- 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
toolchain: ${{ env.RUST_TOOLCHAIN }}
profile: minimal
override: true
components: rust-src, llvm-tools-preview

- name: Run cargo install cargo-xbuild
run: cargo install cargo-xbuild

- name: install NASM
uses: ilammy/setup-nasm@13cbeb366c45c4379d3478cdcbadd8295feb5028 # v1.5.1
Expand All @@ -58,10 +48,10 @@ jobs:
run: cargo install cargo-afl

- name: Install Cargo-Fuzz
run: cargo +stable-x86_64-unknown-linux-gnu install cargo-fuzz
run: cargo install cargo-fuzz

- name: Select default toolchain
run: rustup default nightly-2023-12-31
run: rustup default ${{ env.RUST_TOOLCHAIN }}

- name: Preparation work
run: bash sh_script/preparation.sh
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration-tdx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ name: Integration Test on TDX Server

env:
AS: nasm
RUST_TOOLCHAIN: nightly-2023-12-31
RUST_TOOLCHAIN: 1.83.0
TOOLCHAIN_PROFILE: minimal

permissions:
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/library.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ env:
AS: nasm
AR: llvm-ar
CC: clang
NIGHTLY_RUST_TOOLCHAIN: nightly-2023-12-31
RUST_TOOLCHAIN: 1.83.0
TOOLCHAIN_PROFILE: minimal

permissions:
Expand Down Expand Up @@ -43,14 +43,17 @@ jobs:
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7
with:
profile: ${{ env.TOOLCHAIN_PROFILE }}
toolchain: ${{ env.NIGHTLY_RUST_TOOLCHAIN }}
toolchain: ${{ env.RUST_TOOLCHAIN }}
override: true

- name: Checkout sources
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
submodules: recursive

- name: Add `x86_64-unknown-none` target
run: rustup target add x86_64-unknown-none

- name: Preparation work
run: bash sh_script/preparation.sh

Expand Down
16 changes: 5 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ name: main

env:
AS: nasm
RUST_TOOLCHAIN: nightly-2023-12-31
RUST_TOOLCHAIN: 1.83.0
TOOLCHAIN_PROFILE: minimal

permissions:
Expand Down Expand Up @@ -50,11 +50,8 @@ jobs:
override: true
components: rust-src

- name: Run cargo install cargo-xbuild
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3
with:
command: install
args: cargo-xbuild
- name: Add `x86_64-unknown-none` target
run: rustup target add x86_64-unknown-none

- name: Preparation Work
run: bash sh_script/preparation.sh
Expand Down Expand Up @@ -103,11 +100,8 @@ jobs:
override: true
components: rust-src

- name: Run cargo install cargo-xbuild
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3
with:
command: install
args: cargo-xbuild
- name: Add `x86_64-unknown-none` target
run: rustup target add x86_64-unknown-none

- name: Preparation Work
run: bash sh_script/preparation.sh
Expand Down
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@ This package is the sample code to show the concept of Migration TD in TDX Migra

* Install [Rust](https://www.rust-lang.org/tools/install):
```
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.83.0
```
* Install toolchain and components required by MigTD:
* Add Rust target required by MigTD:
```
rustup toolchain install nightly-2023-12-31
rustup component add --toolchain nightly-2023-12-31 rust-src
cargo install cargo-xbuild
rustup target add x86_64-unknown-none
```

2. [clang](https://releases.llvm.org/download.html#13.0.1)
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[toolchain]
channel = "nightly-2023-12-31"
channel = "1.83.0"
10 changes: 5 additions & 5 deletions sh_script/build_final.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ function final_test_td_payload() {
cleanup

pushd tests
cargo xbuild -p test-td-payload --target x86_64-unknown-none --release --features=main,tdx --no-default-features
cargo build -p test-td-payload --target x86_64-unknown-none --release --features=main,tdx --no-default-features
popd

pushd deps/td-shim
cargo xbuild -p td-shim --target x86_64-unknown-none --release --features=main,tdx --no-default-features
cargo build -p td-shim --target x86_64-unknown-none --release --features=main,tdx --no-default-features

set_cc
cargo run -p td-shim-tools --bin td-shim-strip-info -- -n test-td-payload -w ../../ --target x86_64-unknown-none
Expand Down Expand Up @@ -245,20 +245,20 @@ function final_migtd() {
}

function build_migtd() {
cargo xbuild -p migtd --target x86_64-unknown-none --release --features=${MIGTD_FEATURE}
cargo build -p migtd --target x86_64-unknown-none --release --features=${MIGTD_FEATURE}
check_file_exist "./target/x86_64-unknown-none/release/migtd"
}

function build_tdshim() {
pushd deps/td-shim
cargo xbuild -p td-shim --target x86_64-unknown-none --release --features=main,tdx --no-default-features
cargo build -p td-shim --target x86_64-unknown-none --release --features=main,tdx --no-default-features
check_file_exist "./target/x86_64-unknown-none/release/td-shim"
popd
}

function build_tdshim_sb() {
pushd deps/td-shim
cargo xbuild -p td-shim --target x86_64-unknown-none --release --features=main,tdx,secure-boot --no-default-features
cargo build -p td-shim --target x86_64-unknown-none --release --features=main,tdx,secure-boot --no-default-features
check_file_exist "./target/x86_64-unknown-none/release/td-shim"
popd
}
Expand Down
1 change: 0 additions & 1 deletion src/attestation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// SPDX-License-Identifier: BSD-2-Clause-Patent

#![no_std]
#![feature(naked_functions)]

extern crate alloc;

Expand Down
1 change: 0 additions & 1 deletion src/devices/virtio_serial/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// SPDX-License-Identifier: BSD-2-Clause-Patent

#![cfg_attr(not(test), no_std)]
#![feature(naked_functions)]

extern crate alloc;

Expand Down
1 change: 0 additions & 1 deletion src/devices/vsock/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// SPDX-License-Identifier: BSD-2-Clause-Patent

#![cfg_attr(not(test), no_std)]
#![feature(naked_functions)]

extern crate alloc;
use alloc::vec::Vec;
Expand Down
2 changes: 1 addition & 1 deletion src/migtd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ virtio = { path="../devices/virtio" }
vsock = { path="../devices/vsock" }
virtio_serial = { path="../devices/virtio_serial", optional = true }
x86 = "0.47.0"
x86_64 = "0.14.9"
x86_64 = { version = "0.14", default-features = false, features = ["instructions"] }
zerocopy = { version = "0.7", features = ["derive"] }

minicov = { version = "0.2", default-features = false, optional = true }
Expand Down
2 changes: 0 additions & 2 deletions src/migtd/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

#![cfg_attr(not(test), no_std)]
#![cfg_attr(not(test), no_main)]
#![feature(alloc_error_handler)]
#![feature(naked_functions)]

#[cfg_attr(feature = "main", macro_use)]
extern crate alloc;
Expand Down
2 changes: 1 addition & 1 deletion src/std-support/sys_time/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ edition = "2018"

[dependencies]
lazy_static = { version = "1.4.0", features = ["spin_no_std"] }
x86_64 = "0.14"
x86_64 = { version = "0.14", default-features = false, features = ["instructions"] }
time = { version = "0.3", default-features = false }
1 change: 0 additions & 1 deletion tests/test-td-payload/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#![no_std]
#![no_main]
#![allow(unused)]
#![feature(alloc_error_handler)]
#[macro_use]

mod testattestation;
Expand Down
2 changes: 1 addition & 1 deletion xtask/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ impl BuildArgs {
sh.set_var("CC_x86_64_unknown_none", "clang");
sh.set_var("AR_x86_64_unknown_none", "llvm-ar");

cmd!(sh, "cargo xbuild -p migtd --target x86_64-unknown-none")
cmd!(sh, "cargo build -p migtd --target x86_64-unknown-none")
.args(["--features", self.features().as_str()])
.args(["--profile", self.profile()])
.run()?;
Expand Down

0 comments on commit f8618a8

Please sign in to comment.