Skip to content

Commit

Permalink
Merge branch 'main' into loop_contracts_with_free
Browse files Browse the repository at this point in the history
  • Loading branch information
qinheping authored Oct 23, 2024
2 parents 561f79d + 20c3d69 commit 29b394a
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 35 deletions.
48 changes: 24 additions & 24 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ dependencies = [

[[package]]
name = "anyhow"
version = "1.0.89"
version = "1.0.90"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6"
checksum = "37bf3594c4c988a53154954629820791dde498571819ae4ca50ca811e060cc95"

[[package]]
name = "arrayvec"
Expand Down Expand Up @@ -198,9 +198,9 @@ dependencies = [

[[package]]
name = "cc"
version = "1.1.30"
version = "1.1.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b16803a61b81d9eabb7eae2588776c4c1e584b738ede45fdbb4c972cec1e9945"
checksum = "c2e7962b54006dcfcc61cb72735f4d89bb97061dd6a7ed882ec6b8ee53714c6f"
dependencies = [
"shlex",
]
Expand Down Expand Up @@ -281,7 +281,7 @@ dependencies = [
"heck",
"proc-macro2",
"quote",
"syn 2.0.79",
"syn 2.0.82",
]

[[package]]
Expand Down Expand Up @@ -763,7 +763,7 @@ dependencies = [
"shell-words",
"strum",
"strum_macros",
"syn 2.0.79",
"syn 2.0.82",
"tracing",
"tracing-subscriber",
"tracing-tree 0.4.0",
Expand Down Expand Up @@ -836,7 +836,7 @@ dependencies = [
"proc-macro-error2",
"proc-macro2",
"quote",
"syn 2.0.79",
"syn 2.0.82",
]

[[package]]
Expand All @@ -858,9 +858,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"

[[package]]
name = "libc"
version = "0.2.159"
version = "0.2.161"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5"
checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1"

[[package]]
name = "linear-map"
Expand Down Expand Up @@ -900,7 +900,7 @@ version = "0.1.0"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.79",
"syn 2.0.82",
]

[[package]]
Expand Down Expand Up @@ -1190,14 +1190,14 @@ dependencies = [
"proc-macro-error-attr2",
"proc-macro2",
"quote",
"syn 2.0.79",
"syn 2.0.82",
]

[[package]]
name = "proc-macro2"
version = "1.0.87"
version = "1.0.88"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a"
checksum = "7c3a7fc5db1e57d5a779a352c8cdb57b29aa4c40cc69c3a68a7fedc815fbf2f9"
dependencies = [
"unicode-ident",
]
Expand Down Expand Up @@ -1362,9 +1362,9 @@ dependencies = [

[[package]]
name = "rustversion"
version = "1.0.17"
version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6"
checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248"

[[package]]
name = "ryu"
Expand Down Expand Up @@ -1434,14 +1434,14 @@ checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.79",
"syn 2.0.82",
]

[[package]]
name = "serde_json"
version = "1.0.128"
version = "1.0.132"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8"
checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03"
dependencies = [
"indexmap",
"itoa",
Expand Down Expand Up @@ -1581,7 +1581,7 @@ dependencies = [
"proc-macro2",
"quote",
"rustversion",
"syn 2.0.79",
"syn 2.0.82",
]

[[package]]
Expand All @@ -1597,9 +1597,9 @@ dependencies = [

[[package]]
name = "syn"
version = "2.0.79"
version = "2.0.82"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590"
checksum = "83540f837a8afc019423a8edb95b52a8effe46957ee402287f4292fae35be021"
dependencies = [
"proc-macro2",
"quote",
Expand Down Expand Up @@ -1648,7 +1648,7 @@ checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.79",
"syn 2.0.82",
]

[[package]]
Expand Down Expand Up @@ -1745,7 +1745,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.79",
"syn 2.0.82",
]

[[package]]
Expand Down Expand Up @@ -2156,5 +2156,5 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.79",
"syn 2.0.82",
]
2 changes: 1 addition & 1 deletion docs/src/reference/experimental/coverage.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Fortunately, Kani is able to report a coverage metric for each proof harness.
In the `first-steps-v2` directory, try running:

```
cargo kani --coverage -Z line-coverage --harness verify_success
cargo kani --coverage -Z source-coverage --harness verify_success
```

which verifies the harness, then prints coverage information for each line.
Expand Down
2 changes: 1 addition & 1 deletion docs/src/tutorial-real-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ A first proof will likely start in the following form:
Running Kani on this simple starting point will help figure out:

1. What unexpected constraints might be needed on your inputs (using `kani::assume`) to avoid "expected" failures.
2. Whether you're over-constrained. Check the coverage report using `--coverage -Z line-coverage`. Ideally you'd see 100% coverage, and if not, it's usually because you've assumed too much (thus over-constraining the inputs).
2. Whether you're over-constrained. Check the coverage report using `--coverage -Z source-coverage`. Ideally you'd see 100% coverage, and if not, it's usually because you've assumed too much (thus over-constraining the inputs).
3. Whether Kani will support all the Rust features involved.
4. Whether you've started with a tractable problem.
(Remember to try setting `#[kani::unwind(1)]` to force early termination and work up from there.)
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# SPDX-License-Identifier: Apache-2.0 OR MIT

[toolchain]
channel = "nightly-2024-10-20"
channel = "nightly-2024-10-23"
components = ["llvm-tools", "rustc-dev", "rust-src", "rustfmt"]
20 changes: 13 additions & 7 deletions tests/expected/loop-contract/small_slice_eq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,25 @@
// Modifications Copyright Kani Contributors
// See GitHub history for details.

// kani-flags: -Z loop-contracts --enable-unstable --cbmc-args --arrays-uf-always --no-standard-checks --object-bits 8
// kani-flags: -Z loop-contracts -Z mem-predicates --enable-unstable --cbmc-args --object-bits 8

//! Check if loop contracts are correctly applied. The flag --no-standard-checks should be
//! removed once same_object predicate is supported in loop contracts.
//! Check if loop contracts are correctly applied.

#![feature(stmt_expr_attributes)]
#![feature(proc_macro_hygiene)]
#![feature(ptr_sub_ptr)]

extern crate kani;

use kani::mem::same_allocation;

unsafe fn small_slice_eq(x: &[u8], y: &[u8]) -> bool {
debug_assert_eq!(x.len(), y.len());
unsafe {
let (mut px, mut py) = (x.as_ptr(), y.as_ptr());
let (pxend, pyend) = (px.add(x.len() - 4), py.add(y.len() - 4));
#[kani::loop_invariant( px as isize >= x.as_ptr() as isize
#[kani::loop_invariant( same_allocation(x.as_ptr(), px) && same_allocation(y.as_ptr(), py)
&& px as isize >= x.as_ptr() as isize
&& py as isize >= y.as_ptr() as isize
&& px as isize - x.as_ptr() as isize == (py as isize - y.as_ptr() as isize))]
while px < pxend {
Expand All @@ -39,9 +44,10 @@ unsafe fn small_slice_eq(x: &[u8], y: &[u8]) -> bool {

#[kani::proof]
fn small_slice_eq_harness() {
let mut a = [1; 2000];
let mut b = [1; 2000];
const ARR_SIZE: usize = 2000;
let x: [u8; ARR_SIZE] = kani::any();
let y: [u8; ARR_SIZE] = kani::any();
unsafe {
small_slice_eq(&mut a, &mut b);
small_slice_eq(&x, &y);
}
}
2 changes: 1 addition & 1 deletion tests/perf/s2n-quic
Submodule s2n-quic updated 49 files
+12 −4 .github/actions/duvet/README.md
+7 −7 .github/actions/duvet/action.yml
+4 −3 .github/workflows/book.yml
+23 −21 .github/workflows/ci.yml
+25 −17 .github/workflows/qns.yml
+15 −6 .github/workflows/release.yml
+10 −3 .github/workflows/tshark.yml
+1 −1 README.md
+1 −1 common/s2n-codec/Cargo.toml
+5 −4 dc/s2n-quic-dc/Cargo.toml
+10 −12 dc/s2n-quic-dc/src/credentials.rs
+7 −2 dc/s2n-quic-dc/src/fixed_map.rs
+1 −0 dc/s2n-quic-dc/src/lib.rs
+10 −0 dc/s2n-quic-dc/src/path/secret.rs
+38 −6 dc/s2n-quic-dc/src/path/secret/map.rs
+12 −7 dc/s2n-quic-dc/src/path/secret/map/test.rs
+1 −0 dc/s2n-quic-dc/src/stream.rs
+4 −0 dc/s2n-quic-dc/src/stream/client.rs
+121 −0 dc/s2n-quic-dc/src/stream/client/tokio.rs
+2 −5 dc/s2n-quic-dc/src/stream/endpoint.rs
+23 −11 dc/s2n-quic-dc/src/stream/environment/tokio.rs
+2 −5 dc/s2n-quic-dc/src/stream/send/state.rs
+1 −0 dc/s2n-quic-dc/src/stream/server.rs
+7 −0 dc/s2n-quic-dc/src/stream/server/tokio.rs
+143 −0 dc/s2n-quic-dc/src/stream/server/tokio/accept.rs
+103 −0 dc/s2n-quic-dc/src/stream/server/tokio/stats.rs
+596 −0 dc/s2n-quic-dc/src/stream/server/tokio/tcp.rs
+148 −0 dc/s2n-quic-dc/src/stream/server/tokio/udp.rs
+5 −0 dc/s2n-quic-dc/src/sync.rs
+318 −0 dc/s2n-quic-dc/src/sync/channel.rs
+168 −0 dc/s2n-quic-dc/src/sync/ring_deque.rs
+160 −0 dc/s2n-quic-dc/src/sync/ring_deque/tests.rs
+2 −2 quic/s2n-quic-core/Cargo.toml
+18 −0 quic/s2n-quic-core/src/crypto/tls.rs
+4 −0 quic/s2n-quic-core/src/crypto/tls/testing.rs
+4 −0 quic/s2n-quic-core/src/dc.rs
+9 −0 quic/s2n-quic-core/src/event.rs
+3 −3 quic/s2n-quic-crypto/Cargo.toml
+3 −3 quic/s2n-quic-platform/Cargo.toml
+4 −4 quic/s2n-quic-rustls/Cargo.toml
+11 −0 quic/s2n-quic-rustls/src/session.rs
+4 −4 quic/s2n-quic-tls-default/Cargo.toml
+4 −4 quic/s2n-quic-tls/Cargo.toml
+10 −0 quic/s2n-quic-tls/src/session.rs
+3 −3 quic/s2n-quic-transport/Cargo.toml
+9 −9 quic/s2n-quic/Cargo.toml
+2 −0 quic/s2n-quic/src/tests.rs
+128 −0 quic/s2n-quic/src/tests/chain.rs
+3 −3 tools/xdp/s2n-quic-xdp/Cargo.toml

0 comments on commit 29b394a

Please sign in to comment.