Skip to content

Commit c47751c

Browse files
authored
Merge branch 'main' into unsafe-finder-tool
2 parents 3856e98 + 195e1b6 commit c47751c

File tree

1,348 files changed

+834534
-19341
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,348 files changed

+834534
-19341
lines changed

.github/workflows/flux.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Flux
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [main]
7+
pull_request:
8+
branches: [main]
9+
10+
env:
11+
FIXPOINT_VERSION: "556104ba5508891c357b0bdf819ce706e93d9349"
12+
FLUX_VERSION: "b0cec81c42bc6e210f675b46dd5b4b16774b0d0e"
13+
14+
jobs:
15+
check-flux-on-core:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
submodules: true
21+
22+
- name: Local Binaries
23+
run: |
24+
mkdir -p ~/.local/bin
25+
echo ~/.cargo/bin >> $GITHUB_PATH
26+
echo ~/.local/bin >> $GITHUB_PATH
27+
28+
- name: Cache fixpoint
29+
uses: actions/cache@v4
30+
id: cache-fixpoint
31+
with:
32+
path: ~/.local/bin/fixpoint
33+
key: fixpoint-bin-${{ runner.os }}-${{ env.FIXPOINT_VERSION }}
34+
35+
- name: Install Haskell
36+
if: steps.cache-fixpoint.outputs.cache-hit != 'true'
37+
uses: haskell-actions/[email protected]
38+
with:
39+
enable-stack: true
40+
stack-version: "2.15.7"
41+
42+
- name: Install fixpoint
43+
if: steps.cache-fixpoint.outputs.cache-hit != 'true'
44+
run: |
45+
git clone https://github.com/ucsd-progsys/liquid-fixpoint.git
46+
cd liquid-fixpoint
47+
git checkout $FIXPOINT_VERSION
48+
stack install --fast --flag liquid-fixpoint:-link-z3-as-a-library
49+
50+
- name: Install Z3
51+
uses: cda-tum/[email protected]
52+
with:
53+
version: 4.12.1
54+
platform: linux
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
58+
- name: Clone Flux
59+
run: |
60+
git clone https://github.com/flux-rs/flux.git
61+
cd flux
62+
git checkout $FLUX_VERSION
63+
64+
- name: Rust Cache
65+
uses: Swatinem/[email protected]
66+
with:
67+
workspaces: flux
68+
69+
- name: Install Flux
70+
run: |
71+
cd flux
72+
cargo x install
73+
74+
- name: Verify Core
75+
run: |
76+
cd library
77+
FLUXFLAGS="-Ftimings" cargo flux -p core

.github/workflows/kani-metrics.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,17 @@ defaults:
1111

1212
jobs:
1313
update-kani-metrics:
14+
if: github.repository == 'model-checking/verify-rust-std'
1415
runs-on: ubuntu-latest
1516

1617
steps:
18+
- name: Remove unnecessary software to free up disk space
19+
run: |
20+
# inspired by https://github.com/easimon/maximize-build-space/blob/master/action.yml
21+
df -h
22+
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /usr/local/.ghcup
23+
df -h
24+
1725
- name: Checkout Repository
1826
uses: actions/checkout@v4
1927
with:
@@ -26,7 +34,9 @@ jobs:
2634
python-version: '3.x'
2735

2836
- name: Compute Kani Metrics
29-
run: ./scripts/run-kani.sh --run metrics --with-autoharness --path ${{github.workspace}}
37+
run: |
38+
./scripts/run-kani.sh --run metrics --with-autoharness --path ${{github.workspace}}
39+
rm kani-list.json
3040
3141
- name: Create Pull Request
3242
uses: peter-evans/create-pull-request@v7

.github/workflows/kani.yml

Lines changed: 218 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ jobs:
3737
WORKER_TOTAL: 4
3838

3939
steps:
40+
- name: Remove unnecessary software to free up disk space
41+
if: matrix.os == 'ubuntu-latest'
42+
run: |
43+
# inspired by https://github.com/easimon/maximize-build-space/blob/master/action.yml
44+
df -h
45+
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /usr/local/.ghcup
46+
df -h
47+
4048
# Step 1: Check out the repository
4149
- name: Checkout Repository
4250
uses: actions/checkout@v4
@@ -53,7 +61,7 @@ jobs:
5361
- name: Run Kani Verification
5462
run: head/scripts/run-kani.sh --path ${{github.workspace}}/head
5563

56-
kani-autoharness:
64+
kani_autoharness:
5765
name: Verify std library using autoharness
5866
runs-on: ${{ matrix.os }}
5967
strategy:
@@ -67,6 +75,14 @@ jobs:
6775
fail-fast: false
6876

6977
steps:
78+
- name: Remove unnecessary software to free up disk space
79+
if: matrix.os == 'ubuntu-latest'
80+
run: |
81+
# inspired by https://github.com/easimon/maximize-build-space/blob/master/action.yml
82+
df -h
83+
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /usr/local/.ghcup
84+
df -h
85+
7086
# Step 1: Check out the repository
7187
- name: Checkout Repository
7288
uses: actions/checkout@v4
@@ -78,12 +94,76 @@ jobs:
7894
# possible functions as that may take a lot longer than expected. Instead,
7995
# explicitly list all functions (or prefixes thereof) the proofs of which
8096
# are known to pass.
97+
# Notes:
98+
# - core_arch::x86::__m128d::as_f64x2 is just one example of hundreds of
99+
# core_arch::x86:: functions that are known to verify successfully.
81100
- name: Run Kani Verification
82101
run: |
83102
scripts/run-kani.sh --run autoharness --kani-args \
103+
--include-pattern "<(.+)[[:space:]]as[[:space:]](.+)>::disjoint_bitor" \
104+
--include-pattern "<(.+)[[:space:]]as[[:space:]](.+)>::unchecked_disjoint_bitor" \
105+
--include-pattern "<(.+)[[:space:]]as[[:space:]]iter::range::Step>::backward_unchecked" \
106+
--include-pattern "<(.+)[[:space:]]as[[:space:]]iter::range::Step>::forward_unchecked" \
107+
--include-pattern alloc::__default_lib_allocator:: \
84108
--include-pattern alloc::layout::Layout::from_size_align \
85109
--include-pattern ascii::ascii_char::AsciiChar::from_u8 \
86110
--include-pattern char::convert::from_u32_unchecked \
111+
--include-pattern core_arch::x86::__m128d::as_f64x2 \
112+
--include-pattern "convert::num::<impl.convert::From<num::nonzero::NonZero<" \
113+
--include-pattern "num::<impl.i8>::unchecked_add" \
114+
--include-pattern "num::<impl.i16>::unchecked_add" \
115+
--include-pattern "num::<impl.i32>::unchecked_add" \
116+
--include-pattern "num::<impl.i64>::unchecked_add" \
117+
--include-pattern "num::<impl.i128>::unchecked_add" \
118+
--include-pattern "num::<impl.isize>::unchecked_add" \
119+
--include-pattern "num::<impl.u8>::unchecked_add" \
120+
--include-pattern "num::<impl.u16>::unchecked_add" \
121+
--include-pattern "num::<impl.u32>::unchecked_add" \
122+
--include-pattern "num::<impl.u64>::unchecked_add" \
123+
--include-pattern "num::<impl.u128>::unchecked_add" \
124+
--include-pattern "num::<impl.usize>::unchecked_add" \
125+
--include-pattern "num::<impl.i8>::unchecked_neg" \
126+
--include-pattern "num::<impl.i16>::unchecked_neg" \
127+
--include-pattern "num::<impl.i32>::unchecked_neg" \
128+
--include-pattern "num::<impl.i64>::unchecked_neg" \
129+
--include-pattern "num::<impl.i128>::unchecked_neg" \
130+
--include-pattern "num::<impl.isize>::unchecked_neg" \
131+
--include-pattern "num::<impl.i8>::unchecked_sh" \
132+
--include-pattern "num::<impl.i16>::unchecked_sh" \
133+
--include-pattern "num::<impl.i32>::unchecked_sh" \
134+
--include-pattern "num::<impl.i64>::unchecked_sh" \
135+
--include-pattern "num::<impl.i128>::unchecked_sh" \
136+
--include-pattern "num::<impl.isize>::unchecked_sh" \
137+
--include-pattern "num::<impl.u8>::unchecked_sh" \
138+
--include-pattern "num::<impl.u16>::unchecked_sh" \
139+
--include-pattern "num::<impl.u32>::unchecked_sh" \
140+
--include-pattern "num::<impl.u64>::unchecked_sh" \
141+
--include-pattern "num::<impl.u128>::unchecked_sh" \
142+
--include-pattern "num::<impl.usize>::unchecked_sh" \
143+
--include-pattern "num::<impl.i8>::unchecked_sub" \
144+
--include-pattern "num::<impl.i16>::unchecked_sub" \
145+
--include-pattern "num::<impl.i32>::unchecked_sub" \
146+
--include-pattern "num::<impl.i64>::unchecked_sub" \
147+
--include-pattern "num::<impl.i128>::unchecked_sub" \
148+
--include-pattern "num::<impl.isize>::unchecked_sub" \
149+
--include-pattern "num::<impl.u8>::unchecked_sub" \
150+
--include-pattern "num::<impl.u16>::unchecked_sub" \
151+
--include-pattern "num::<impl.u32>::unchecked_sub" \
152+
--include-pattern "num::<impl.u64>::unchecked_sub" \
153+
--include-pattern "num::<impl.u128>::unchecked_sub" \
154+
--include-pattern "num::<impl.usize>::unchecked_sub" \
155+
--include-pattern "num::<impl.i8>::wrapping_sh" \
156+
--include-pattern "num::<impl.i16>::wrapping_sh" \
157+
--include-pattern "num::<impl.i32>::wrapping_sh" \
158+
--include-pattern "num::<impl.i64>::wrapping_sh" \
159+
--include-pattern "num::<impl.i128>::wrapping_sh" \
160+
--include-pattern "num::<impl.isize>::wrapping_sh" \
161+
--include-pattern "num::<impl.u8>::wrapping_sh" \
162+
--include-pattern "num::<impl.u16>::wrapping_sh" \
163+
--include-pattern "num::<impl.u32>::wrapping_sh" \
164+
--include-pattern "num::<impl.u64>::wrapping_sh" \
165+
--include-pattern "num::<impl.u128>::wrapping_sh" \
166+
--include-pattern "num::<impl.usize>::wrapping_sh" \
87167
--include-pattern "num::nonzero::NonZero::<i8>::count_ones" \
88168
--include-pattern "num::nonzero::NonZero::<i16>::count_ones" \
89169
--include-pattern "num::nonzero::NonZero::<i32>::count_ones" \
@@ -122,14 +202,143 @@ jobs:
122202
--exclude-pattern time::Duration::from_secs_f \
123203
--include-pattern unicode::unicode_data::conversions::to_ \
124204
--exclude-pattern ::precondition_check \
125-
--harness-timeout 5m \
205+
--harness-timeout 10m \
126206
--default-unwind 1000 \
127-
--jobs=3 --output-format=terse
207+
--jobs=3 --output-format=terse | tee autoharness-verification.log
208+
gzip autoharness-verification.log
209+
210+
- name: Upload Autoharness Verification Log
211+
uses: actions/upload-artifact@v4
212+
with:
213+
name: ${{ matrix.os }}-autoharness-verification.log.gz
214+
path: autoharness-verification.log.gz
215+
if-no-files-found: error
216+
# Aggressively short retention: we don't really need these
217+
retention-days: 3
218+
219+
run_kani_metrics:
220+
name: Kani Metrics
221+
runs-on: ${{ matrix.os }}
222+
strategy:
223+
matrix:
224+
os: [ubuntu-latest, macos-latest]
225+
include:
226+
- os: ubuntu-latest
227+
base: ubuntu
228+
- os: macos-latest
229+
base: macos
230+
fail-fast: true
231+
232+
steps:
233+
- name: Remove unnecessary software to free up disk space
234+
if: matrix.os == 'ubuntu-latest'
235+
run: |
236+
# inspired by https://github.com/easimon/maximize-build-space/blob/master/action.yml
237+
df -h
238+
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /usr/local/.ghcup
239+
df -h
240+
241+
# Step 1: Check out the repository
242+
- name: Checkout Repository
243+
uses: actions/checkout@v4
244+
with:
245+
submodules: true
246+
247+
# The Kani metrics collection uses a Python script (kani_std_analysis.py), so make sure Python is installed
248+
- name: Set up Python
249+
uses: actions/setup-python@v4
250+
with:
251+
python-version: '3.x'
252+
253+
# Step 2: Run list on the std library
254+
- name: Run Kani Metrics
255+
run: |
256+
scripts/run-kani.sh --run metrics --with-autoharness
257+
pushd /tmp/std_lib_analysis
258+
tar czf results.tar.gz results
259+
popd
260+
261+
- name: Upload kani-list.json
262+
uses: actions/upload-artifact@v4
263+
with:
264+
name: ${{ matrix.os }}-kani-list.json
265+
path: kani-list.json
266+
if-no-files-found: error
267+
# Aggressively short retention: we don't really need these
268+
retention-days: 3
269+
270+
- name: Upload scanner results
271+
uses: actions/upload-artifact@v4
272+
with:
273+
name: ${{ matrix.os }}-results.tar.gz
274+
path: /tmp/std_lib_analysis/results.tar.gz
275+
if-no-files-found: error
276+
# Aggressively short retention: we don't really need these
277+
retention-days: 3
278+
279+
run-log-analysis:
280+
name: Build JSON from logs
281+
needs: [run_kani_metrics, kani_autoharness]
282+
runs-on: ${{ matrix.os }}
283+
strategy:
284+
matrix:
285+
os: [ubuntu-latest, macos-latest]
286+
include:
287+
- os: ubuntu-latest
288+
base: ubuntu
289+
- os: macos-latest
290+
base: macos
291+
fail-fast: false
292+
293+
steps:
294+
- name: Checkout Repository
295+
uses: actions/checkout@v4
296+
with:
297+
submodules: false
298+
299+
- name: Download log
300+
uses: actions/download-artifact@v4
301+
with:
302+
name: ${{ matrix.os }}-autoharness-verification.log.gz
303+
304+
- name: Download kani-list.json
305+
uses: actions/download-artifact@v4
306+
with:
307+
name: ${{ matrix.os }}-kani-list.json
308+
309+
- name: Download scanner results
310+
uses: actions/download-artifact@v4
311+
with:
312+
name: ${{ matrix.os }}-results.tar.gz
313+
314+
- name: Run log parser
315+
run: |
316+
gunzip autoharness-verification.log.gz
317+
tar xzf results.tar.gz
318+
python3 scripts/kani-std-analysis/log_parser.py \
319+
--kani-list-file kani-list.json \
320+
--analysis-results-dir results/ \
321+
autoharness-verification.log \
322+
-o results.json
323+
324+
- name: Upload JSON
325+
uses: actions/upload-artifact@v4
326+
with:
327+
name: ${{ matrix.os }}-results.json
328+
path: results.json
329+
if-no-files-found: error
128330

129331
run-kani-list:
130332
name: Kani List
131333
runs-on: ubuntu-latest
132334
steps:
335+
- name: Remove unnecessary software to free up disk space
336+
run: |
337+
# inspired by https://github.com/easimon/maximize-build-space/blob/master/action.yml
338+
df -h
339+
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /usr/local/.ghcup
340+
df -h
341+
133342
# Step 1: Check out the repository
134343
- name: Checkout Repository
135344
uses: actions/checkout@v4
@@ -176,12 +385,14 @@ jobs:
176385
# Step 3: Add output to job summary
177386
- name: Add Autoharness Analyzer output to job summary
178387
run: |
388+
pushd scripts/autoharness_analyzer
179389
echo "# Autoharness Failure Summary" >> "$GITHUB_STEP_SUMMARY"
180390
echo "## Crate core, all functions" >> "$GITHUB_STEP_SUMMARY"
181-
cat autoharness_analyzer/core_autoharness_data.md >> "$GITHUB_STEP_SUMMARY"
391+
cat core_autoharness_data.md >> "$GITHUB_STEP_SUMMARY"
182392
echo "## Crate core, unsafe functions" >> "$GITHUB_STEP_SUMMARY"
183-
cat autoharness_analyzer/core_autoharness_data.md >> "$GITHUB_STEP_SUMMARY"
393+
cat core_autoharness_data.md >> "$GITHUB_STEP_SUMMARY"
184394
echo "## Crate std, all functions" >> "$GITHUB_STEP_SUMMARY"
185-
cat autoharness_analyzer/std_autoharness_data.md >> "$GITHUB_STEP_SUMMARY"
395+
cat std_autoharness_data.md >> "$GITHUB_STEP_SUMMARY"
186396
echo "## Crate std, unsafe functions" >> "$GITHUB_STEP_SUMMARY"
187-
cat autoharness_analyzer/std_unsafe_autoharness_data.md >> "$GITHUB_STEP_SUMMARY"
397+
cat std_unsafe_autoharness_data.md >> "$GITHUB_STEP_SUMMARY"
398+
popd

0 commit comments

Comments
 (0)