Skip to content

Commit a020531

Browse files
gaojiaqi7jyao1
authored andcommitted
switch to latest stable toolchain 1.83.0
CI script, makefile and docs are updated. Signed-off-by: Jiaqi Gao <[email protected]>
1 parent 69ee626 commit a020531

17 files changed

+66
-99
lines changed

.github/workflows/devtools.yml

+2-8
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ name: Devtools
1111

1212
env:
1313
AS: nasm
14-
STABLE_RUST_TOOLCHAIN: 1.75.0
15-
NIGHTLY_RUST_TOOLCHAIN: nightly-2023-12-31
14+
RUST_TOOLCHAIN: 1.83.0
1615
TOOLCHAIN_PROFILE: minimal
1716

1817
jobs:
@@ -44,12 +43,7 @@ jobs:
4443
- name: Install stable toolchain
4544
uses: dtolnay/rust-toolchain@master
4645
with:
47-
toolchain: ${{ env.STABLE_RUST_TOOLCHAIN }}
48-
49-
- name: Install nightly toolchain
50-
uses: dtolnay/rust-toolchain@master
51-
with:
52-
toolchain: ${{ env.NIGHTLY_RUST_TOOLCHAIN }}
46+
toolchain: ${{ env.RUST_TOOLCHAIN }}
5347

5448
- name: Preparation work
5549
run: make preparation

.github/workflows/format.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ env:
66
AS: nasm
77
AR: llvm-ar
88
CC: clang
9+
RUST_TOOLCHAIN: 1.83.0
910

1011
jobs:
1112
clippy:
@@ -30,7 +31,7 @@ jobs:
3031
- name: Install toolchain with clippy available
3132
uses: dtolnay/rust-toolchain@master
3233
with:
33-
toolchain: nightly-2023-12-31
34+
toolchain: ${{ env.RUST_TOOLCHAIN }}
3435
components: clippy
3536

3637
- name: Add target
@@ -65,7 +66,7 @@ jobs:
6566
- name: Install toolchain with rustfmt available
6667
uses: dtolnay/rust-toolchain@master
6768
with:
68-
toolchain: nightly-2023-12-31
69+
toolchain: ${{ env.RUST_TOOLCHAIN }}
6970
components: rustfmt
7071

7172
- name: Preparation Work

.github/workflows/fuzz.yml

+4-6
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ env:
1313
AS: nasm
1414
AR_x86_64_unknown_none: llvm-ar
1515
CC_x86_64_unknown_none: clang
16-
RUST_TOOLCHAIN: nightly-2023-12-31
16+
RUST_TOOLCHAIN: nightly
1717
TOOLCHAIN_PROFILE: minimal
1818

1919
jobs:
@@ -33,20 +33,18 @@ jobs:
3333
submodules: recursive
3434
- uses: dtolnay/rust-toolchain@stable
3535
with:
36+
toolchain: ${{ env.RUST_TOOLCHAIN }}
3637
components: rust-src, llvm-tools-preview
37-
38-
- name: Run cargo install cargo-xbuild
39-
run: cargo install cargo-xbuild
4038

4139
- name: install NASM
4240
uses: ilammy/setup-nasm@v1
4341

4442
- name: Install AFL (Linux)
45-
run: cargo install cargo-afl
43+
run: cargo +nightly install cargo-afl
4644
if: runner.os == 'Linux'
4745

4846
- name: Install Cargo-Fuzz (Linux)
49-
run: cargo +stable install cargo-fuzz
47+
run: cargo install cargo-fuzz
5048
if: runner.os == 'Linux'
5149

5250
- name: Preparation work

.github/workflows/integration-tdx.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ name: Integration Test on TDX Server
1111

1212
env:
1313
AS: nasm
14-
RUST_TOOLCHAIN: nightly-2023-12-31
14+
RUST_TOOLCHAIN: 1.83.0
1515
TOOLCHAIN_PROFILE: minimal
1616

1717
jobs:
@@ -36,8 +36,8 @@ jobs:
3636
- name: Install toolchain
3737
run: bash sh_script/update_toolchain.sh ${{ env.RUST_TOOLCHAIN }}
3838

39-
- name: Run cargo install cargo-xbuild
40-
run: cargo install cargo-xbuild
39+
- name: Add `x86_64-unknown-none` target
40+
run: rustup target add x86_64-unknown-none
4141

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

.github/workflows/integration.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ jobs:
4747
toolchain: ${{ env.RUST_TOOLCHAIN }}
4848
components: rust-src, llvm-tools-preview
4949

50-
- name: Run cargo install cargo-xbuild
51-
run: cargo install cargo-xbuild
50+
- name: Add `x86_64-unknown-none` target
51+
run: rustup target add x86_64-unknown-none --toolchain ${{ env.RUST_TOOLCHAIN }}
5252

5353
# install QEMU
5454
- name: Install QEMU (Linux)

.github/workflows/library.yml

+5-16
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ name: Library Crates
1111

1212
env:
1313
AS: nasm
14-
STABLE_RUST_TOOLCHAIN: 1.75.0
15-
NIGHTLY_RUST_TOOLCHAIN: nightly-2023-12-31
14+
RUST_TOOLCHAIN: 1.83.0
1615
TOOLCHAIN_PROFILE: minimal
1716

1817
jobs:
@@ -37,15 +36,10 @@ jobs:
3736
- name: install NASM
3837
uses: ilammy/setup-nasm@v1
3938

40-
- name: Install stable toolchain
39+
- name: Install rust toolchain
4140
uses: dtolnay/rust-toolchain@master
4241
with:
43-
toolchain: ${{ env.STABLE_RUST_TOOLCHAIN }}
44-
45-
- name: Install nightly toolchain
46-
uses: dtolnay/rust-toolchain@master
47-
with:
48-
toolchain: ${{ env.NIGHTLY_RUST_TOOLCHAIN }}
42+
toolchain: ${{ env.RUST_TOOLCHAIN }}
4943

5044
- name: Checkout sources
5145
uses: actions/checkout@v4
@@ -82,15 +76,10 @@ jobs:
8276
- name: install NASM
8377
uses: ilammy/setup-nasm@v1
8478

85-
- name: Install stable toolchain
86-
uses: dtolnay/rust-toolchain@master
87-
with:
88-
toolchain: ${{ env.STABLE_RUST_TOOLCHAIN }}
89-
90-
- name: Install nightly toolchain
79+
- name: Install rust toolchain
9180
uses: dtolnay/rust-toolchain@master
9281
with:
93-
toolchain: ${{ env.NIGHTLY_RUST_TOOLCHAIN }}
82+
toolchain: ${{ env.RUST_TOOLCHAIN }}
9483

9584
- name: Checkout sources
9685
uses: actions/checkout@v4

.github/workflows/main.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ env:
1515
CC_x86_64_unknown_linux_gnu: clang
1616
AR_x86_64_unknown_none: llvm-ar
1717
CC_x86_64_unknown_none: clang
18-
RUST_TOOLCHAIN: nightly-2023-12-31
18+
RUST_TOOLCHAIN: 1.83.0
1919
TOOLCHAIN_PROFILE: minimal
2020

2121
jobs:
@@ -51,8 +51,8 @@ jobs:
5151
toolchain: ${{ env.RUST_TOOLCHAIN }}
5252
components: rust-src
5353

54-
- name: Run cargo install cargo-xbuild
55-
run: cargo install cargo-xbuild
54+
- name: Add `x86_64-unknown-none` target
55+
run: rustup target add x86_64-unknown-none
5656

5757
- name: Preparation Work
5858
run: bash sh_script/preparation.sh
@@ -61,10 +61,10 @@ jobs:
6161
run: make test
6262

6363
- name: Build Release TdShim
64-
run: cargo xbuild -p td-shim --target x86_64-unknown-none --release --features=main,tdx
64+
run: cargo build -p td-shim --target x86_64-unknown-none --release --features=main,tdx
6565

6666
- name: Build Debug TdShim
67-
run: cargo xbuild -p td-shim --target x86_64-unknown-none --features=main,tdx --no-default-features
67+
run: cargo build -p td-shim --target x86_64-unknown-none --features=main,tdx --no-default-features
6868

6969
- name: Build td-shim-tools
7070
run: |

.github/workflows/release.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Release TD-shim
22
on: create
33

44
env:
5-
RUST_TOOLCHAIN: nightly-2023-12-31
5+
RUST_TOOLCHAIN: 1.83.0
66
TOOLCHAIN_PROFILE: minimal
77

88
jobs:
@@ -33,8 +33,8 @@ jobs:
3333
toolchain: ${{ env.RUST_TOOLCHAIN }}
3434
components: rust-src
3535

36-
- name: Run cargo install cargo-xbuild
37-
run: cargo install cargo-xbuild
36+
- name: Add `x86_64-unknown-none` target
37+
run: rustup target add x86_64-unknown-none
3838

3939
- name: Preparation Work
4040
run: make preparation

Makefile

+11-25
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export CARGO=cargo
2-
export STABLE_TOOLCHAIN:=1.75.0
2+
export STABLE_TOOLCHAIN:=1.83.0
33
export NIGHTLY_TOOLCHAIN:=nightly-2023-12-31
44
export BUILD_TYPE:=release
55
export PREFIX:=/usr/local
@@ -11,8 +11,7 @@ else
1111
export BUILD_TYPE_FLAG=
1212
endif
1313

14-
GENERIC_LIB_CRATES = td-layout td-logger td-shim-interface td-loader cc-measurement
15-
NIGHTLY_LIB_CRATES = td-exception td-paging tdx-tdcall
14+
LIB_CRATES = td-layout td-logger td-shim-interface td-loader cc-measurement td-exception td-paging tdx-tdcall
1615
SHIM_CRATES = td-shim td-payload
1716
TEST_CRATES = test-td-exception test-td-paging
1817
TOOL_CRATES = td-shim-tools
@@ -51,7 +50,7 @@ uninstall-devtools: uninstall-subdir-devtools $(TOOL_CRATES:%=uninstall-devtool-
5150
.PHONY: tools-devtools
5251
tools-devtools: tools-subdir-devtools
5352

54-
install-devtool-%: nightly-build-%
53+
install-devtool-%:
5554
mkdir -p ${TOPDIR}/devtools/bin
5655
${CARGO} install --bins --target-dir ${TOPDIR}/devtools/bin/ --path $(patsubst install-devtool-%,%,$@)
5756

@@ -71,13 +70,13 @@ afl-test: afl_test
7170
libfuzzer-test: libfuzzer_test
7271

7372
# Targets for library crates
74-
lib-build: $(GENERIC_LIB_CRATES:%=build-%) $(NIGHTLY_LIB_CRATES:%=nightly-build-%)
73+
lib-build: $(LIB_CRATES:%=build-%)
7574

76-
lib-check: $(GENERIC_LIB_CRATES:%=check-%) $(NIGHTLY_LIB_CRATES:%=nightly-check-%)
75+
lib-check: $(LIB_CRATES:%=check-%)
7776

78-
lib-test: $(GENERIC_LIB_CRATES:%=test-%) $(NIGHTLY_LIB_CRATES:%=nightly-test-%)
77+
lib-test: $(LIB_CRATES:%=test-%)
7978

80-
lib-clean: $(GENERIC_LIB_CRATES:%=clean-%) $(NIGHTLY_LIB_CRATES:%=nightly-clean-%)
79+
lib-clean: $(LIB_CRATES:%=clean-%)
8180

8281
# Targets for integration test crates
8382
integration-build: $(TEST_CRATES:%=integration-build-%)
@@ -90,13 +89,13 @@ integration-clean: $(TEST_CRATES:%=integration-clean-%)
9089

9190
# Target for crates which should be compiled with `x86_64-unknown-none` target
9291
none-build-%:
93-
${CARGO} +${NIGHTLY_TOOLCHAIN} xbuild --target x86_64-unknown-none -p $(patsubst none-build-%,%,$@) ${BUILD_TYPE_FLAG}
92+
${CARGO} +${STABLE_TOOLCHAIN} build --target x86_64-unknown-none -p $(patsubst none-build-%,%,$@) ${BUILD_TYPE_FLAG}
9493

9594
none-check-%:
96-
${CARGO} +${NIGHTLY_TOOLCHAIN}xcheck --target x86_64-unknown-none -p $(patsubst none-check-%,%,$@) ${BUILD_TYPE_FLAG}
95+
${CARGO} +${STABLE_TOOLCHAIN} check --target x86_64-unknown-none -p $(patsubst none-check-%,%,$@) ${BUILD_TYPE_FLAG}
9796

9897
none-clean-%:
99-
${CARGO} +${NIGHTLY_TOOLCHAIN} clean --target x86_64-unknown-none -p $(patsubst none-clean-%,%,$@) ${BUILD_TYPE_FLAG}
98+
${CARGO} +${STABLE_TOOLCHAIN} clean --target x86_64-unknown-none -p $(patsubst none-clean-%,%,$@) ${BUILD_TYPE_FLAG}
10099

101100
# Target for integration test crates which should be compiled with `x86_64-custom.json` target
102101
integration-build-%:
@@ -122,20 +121,7 @@ clean-%:
122121
${CARGO} +${STABLE_TOOLCHAIN} clean -p $(patsubst clean-%,%,$@) ${BUILD_TYPE_FLAG}
123122

124123
test-%:
125-
${CARGO} +${NIGHTLY_TOOLCHAIN} test -p $(patsubst test-%,%,$@) ${BUILD_TYPE_FLAG}
126-
127-
# Targets for normal library/binary crates
128-
nightly-build-%:
129-
${CARGO} +${NIGHTLY_TOOLCHAIN} build -p $(patsubst nightly-build-%,%,$@) ${BUILD_TYPE_FLAG}
130-
131-
nightly-check-%:
132-
${CARGO} +${NIGHTLY_TOOLCHAIN} check -p $(patsubst nightly-check-%,%,$@) ${BUILD_TYPE_FLAG}
133-
134-
nightly-clean-%:
135-
${CARGO} +${NIGHTLY_TOOLCHAIN} clean -p $(patsubst nightly-clean-%,%,$@) ${BUILD_TYPE_FLAG}
136-
137-
nightly-test-%:
138-
${CARGO} +${NIGHTLY_TOOLCHAIN} test -p $(patsubst nightly-test-%,%,$@) ${BUILD_TYPE_FLAG}
124+
${CARGO} +${STABLE_TOOLCHAIN} test -p $(patsubst test-%,%,$@) ${BUILD_TYPE_FLAG}
139125

140126
# Targets for subdirectories
141127
build-subdir-%:

README.md

+7-12
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,13 @@ The threat model analysis is at [td-shim threat model](doc/threat_model.md).
5757

5858
1. Install [RUST](https://www.rust-lang.org/)
5959

60-
please use nightly-2023-12-31.
61-
62-
NOTE: We need install nightly version because we use cargo-xbuild.
63-
64-
1.1. Install xbuild
60+
please use 1.83.0.
6561

6662
```
67-
cargo install cargo-xbuild
63+
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.83.0
64+
rustup target add x86_64-unknown-none
6865
```
6966

70-
Please reinstall cargo-xbuild, after you update the rust toolchain.
71-
7267
2. Install [NASM](https://www.nasm.us/)
7368

7469
Please make sure nasm can be found in PATH.
@@ -121,27 +116,27 @@ cargo image --example-payload --release
121116
Build TdShim to launch a payload support Linux Boot Protocol
122117

123118
```
124-
cargo xbuild -p td-shim --target x86_64-unknown-none --release --features=main,tdx
119+
cargo build -p td-shim --target x86_64-unknown-none --release --features=main,tdx
125120
cargo run -p td-shim-tools --bin td-shim-ld --features=linker -- target/x86_64-unknown-none/release/ResetVector.bin target/x86_64-unknown-none/release/td-shim -o target/release/final.bin
126121
```
127122

128123
Build TdShim to launch a executable payload
129124

130125
```
131-
cargo xbuild -p td-shim --target x86_64-unknown-none --release --features=main,tdx --no-default-features
126+
cargo build -p td-shim --target x86_64-unknown-none --release --features=main,tdx --no-default-features
132127
```
133128

134129
Build Elf format payload
135130

136131
```
137-
cargo xbuild -p td-payload --target x86_64-unknown-none --release --bin example --features=tdx,start,cet-shstk,stack-guard
132+
cargo build -p td-payload --target x86_64-unknown-none --release --bin example --features=tdx,start,cet-shstk,stack-guard
138133
cargo run -p td-shim-tools --bin td-shim-ld -- target/x86_64-unknown-none/release/ResetVector.bin target/x86_64-unknown-none/release/td-shim -t executable -p target/x86_64-unknown-none/release/example -o target/release/final-elf.bin
139134
```
140135

141136
To build the debug TdShim, please use `dev-opt` profile to build `td-shim` binary. For example:
142137

143138
```
144-
cargo xbuild -p td-shim --target x86_64-unknown-none --profile dev-opt --features=main,tdx
139+
cargo build -p td-shim --target x86_64-unknown-none --profile dev-opt --features=main,tdx
145140
cargo run -p td-shim-tools --bin td-shim-ld --features=linker -- target/x86_64-unknown-none/dev-opt/ResetVector.bin target/x86_64-unknown-none/dev-opt/td-shim -o target/debug/final.bin
146141
```
147142

devtools/Makefile

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
build:
22
${CARGO} +${STABLE_TOOLCHAIN} build ${BUILD_TYPE_FLAG} -p td-layout-config
3-
${CARGO} +${NIGHTLY_TOOLCHAIN} build ${BUILD_TYPE_FLAG} -p td-benchmark
4-
${CARGO} +${NIGHTLY_TOOLCHAIN} build ${BUILD_TYPE_FLAG} -p test-runner-client
3+
${CARGO} +${STABLE_TOOLCHAIN} build ${BUILD_TYPE_FLAG} -p td-benchmark
4+
${CARGO} +${STABLE_TOOLCHAIN} build ${BUILD_TYPE_FLAG} -p test-runner-client
55
${CARGO} +${STABLE_TOOLCHAIN} build ${BUILD_TYPE_FLAG} -p test-runner-server
66

77
check:
88
${CARGO} +${STABLE_TOOLCHAIN} check ${BUILD_TYPE_FLAG} -p td-layout-config
9-
${CARGO} +${NIGHTLY_TOOLCHAIN} check ${BUILD_TYPE_FLAG} -p td-benchmark
10-
${CARGO} +${NIGHTLY_TOOLCHAIN} check ${BUILD_TYPE_FLAG} -p test-runner-client
9+
${CARGO} +${STABLE_TOOLCHAIN} check ${BUILD_TYPE_FLAG} -p td-benchmark
10+
${CARGO} +${STABLE_TOOLCHAIN} check ${BUILD_TYPE_FLAG} -p test-runner-client
1111
${CARGO} +${STABLE_TOOLCHAIN} check ${BUILD_TYPE_FLAG} -p test-runner-server
1212

1313
clean:
1414
${CARGO} +${STABLE_TOOLCHAIN} clean ${BUILD_TYPE_FLAG} -p td-layout-config
15-
${CARGO} +${NIGHTLY_TOOLCHAIN} clean ${BUILD_TYPE_FLAG} -p td-benchmark
16-
${CARGO} +${NIGHTLY_TOOLCHAIN} clean ${BUILD_TYPE_FLAG} -p test-runner-client
15+
${CARGO} +${STABLE_TOOLCHAIN} clean ${BUILD_TYPE_FLAG} -p td-benchmark
16+
${CARGO} +${STABLE_TOOLCHAIN} clean ${BUILD_TYPE_FLAG} -p test-runner-client
1717
${CARGO} +${STABLE_TOOLCHAIN} clean ${BUILD_TYPE_FLAG} -p test-runner-server
1818

1919
install:

devtools/dev_container/Dockerfile

+2-4
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,16 @@ RUN apt-get update && \
1717
&& apt-get clean && rm -rf /var/lib/apt/lists/*
1818

1919
# Install rustup and a fixed version of Rust.
20-
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain nightly-2023-12-31
21-
RUN rustup toolchain install 1.75.0
20+
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.83.0
2221
RUN rustup component add rust-src
2322
RUN rustup component add llvm-tools-preview
2423
COPY cargo_config /root/.cargo/config
2524
RUN cargo install cargo-xbuild
2625

2726
# Install fuzzing tools
28-
# The rust version used now is nightly-2021-08-20, the latest cargo-fuzz needs to be upgraded to the rust version, and nightly-2021-08-20 can use cargo-fuzz 0.10.2 .
2927
# For more information, please see doc/fuzzing.md.
3028
RUN cargo install cargo-afl
31-
RUN cargo install cargo-fuzz --version 0.10.2
29+
RUN cargo install cargo-fuzz --version 0.12.0
3230

3331
# Install rudra
3432
RUN rustup component add rustc-dev

0 commit comments

Comments
 (0)