diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 02185746bc..47efbda923 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -73,14 +73,11 @@ jobs: - uses: actions/checkout@v2 with: submodules: true - # Note that we use nightly Rust here to get intra-doc links which are a - # nightly-only feature right now. + # Note that we use nightly Rust for the doc_cfg feature (enabled via `nightlydoc` above) + # This version is an older nightly for the new x64 backend (see below) - uses: ./.github/actions/install-rust with: - # TODO (rust-lang/rust#79661): We are seeing an internal compiler error when - # building with the latest (2020-12-06) nightly; pin on a slightly older - # version for now. - toolchain: nightly-2020-11-29 + toolchain: nightly-2020-12-26 - run: cargo doc --no-deps --all --exclude wasmtime-cli --exclude test-programs --exclude cranelift-codegen-meta - run: cargo doc --package cranelift-codegen-meta --document-private-items - uses: actions/upload-artifact@v1 @@ -122,6 +119,7 @@ jobs: - run: cargo check --manifest-path crates/wasmtime/Cargo.toml --features jitdump - run: cargo check --manifest-path crates/wasmtime/Cargo.toml --features cache - run: cargo check --manifest-path crates/wasmtime/Cargo.toml --features async + - run: cargo check --manifest-path crates/wasmtime/Cargo.toml --features uffd # Check some feature combinations of the `wasmtime-c-api` crate - run: cargo check --manifest-path crates/c-api/Cargo.toml --no-default-features @@ -167,7 +165,7 @@ jobs: # flags to rustc. - uses: ./.github/actions/install-rust with: - toolchain: nightly-2020-11-29 + toolchain: nightly - run: cargo install cargo-fuzz --vers "^0.8" - run: cargo fetch working-directory: ./fuzz @@ -224,7 +222,7 @@ jobs: rust: beta - build: nightly os: ubuntu-latest - rust: nightly-2020-11-29 + rust: nightly - build: macos os: macos-latest rust: stable @@ -303,6 +301,15 @@ jobs: env: RUST_BACKTRACE: 1 + # Test uffd functionality on Linux + - run: | + cargo test --features uffd -p wasmtime-runtime instance::allocator::pooling + cargo test --features uffd -p wasmtime-cli pooling_allocator + cargo test --features uffd -p wasmtime-cli wast::Cranelift + if: matrix.os == 'ubuntu-latest' + env: + RUST_BACKTRACE: 1 + # Build and test lightbeam. Note that # Lightbeam tests fail right now, but we don't want to block on that. - run: cargo build --package lightbeam @@ -312,8 +319,10 @@ jobs: RUST_BACKTRACE: 1 # Perform all tests (debug mode) for `wasmtime` with the experimental x64 - # backend. This runs on the nightly channel of Rust (because of issues with - # unifying Cargo features on stable) on Ubuntu. + # backend. This runs on an older nightly of Rust (because of issues with + # unifying Cargo features on stable) on Ubuntu such that it's new enough + # to build Wasmtime, but old enough where the -Z options being used + # haven't been stabilized yet. test_x64: name: Test x64 new backend runs-on: ubuntu-latest @@ -323,7 +332,7 @@ jobs: submodules: true - uses: ./.github/actions/install-rust with: - toolchain: nightly-2020-11-29 + toolchain: nightly-2020-12-26 - uses: ./.github/actions/define-llvm-env # Install wasm32 targets in order to build various tests throughout the @@ -334,7 +343,7 @@ jobs: # Run the x64 CI script. - run: ./ci/run-experimental-x64-ci.sh env: - CARGO_VERSION: "+nightly-2020-11-29" + CARGO_VERSION: "+nightly-2020-12-26" RUST_BACKTRACE: 1 # Build and test the wasi-nn module. @@ -347,7 +356,7 @@ jobs: submodules: true - uses: ./.github/actions/install-rust with: - toolchain: nightly-2020-11-29 + toolchain: nightly - run: rustup target add wasm32-wasi - uses: ./.github/actions/install-openvino - run: ./ci/run-wasi-nn-example.sh diff --git a/Cargo.lock b/Cargo.lock index 21f104be30..24627ff86e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -213,6 +213,25 @@ dependencies = [ "which", ] +[[package]] +name = "bindgen" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd4865004a46a0aafb2a0a5eb19d3c9fc46ee5f063a6cfc605c69ac9ecf5263d" +dependencies = [ + "bitflags", + "cexpr", + "clang-sys", + "lazy_static", + "lazycell", + "peeking_take_while", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", +] + [[package]] name = "bit-set" version = "0.5.2" @@ -1567,6 +1586,19 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0debeb9fcf88823ea64d64e4a815ab1643f33127d995978e099942ce38f25238" +[[package]] +name = "nix" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50e4785f2c3b7589a0d0c1dd60285e1188adac4006e8abd6dd578e1567027363" +dependencies = [ + "bitflags", + "cc", + "cfg-if 0.1.10", + "libc", + "void", +] + [[package]] name = "nom" version = "5.1.2" @@ -1714,7 +1746,7 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fb64bef270a1ff665b0b2e28ebfa213e6205a007ce88223d020730225d6008f" dependencies = [ - "bindgen", + "bindgen 0.55.1", "cmake", ] @@ -2929,6 +2961,30 @@ dependencies = [ "winapi", ] +[[package]] +name = "userfaultfd" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18d8164d4a8198fa546e7553b529f53e82907214a25fafda4a6f90d978b30a5c" +dependencies = [ + "bitflags", + "libc", + "nix", + "thiserror", + "userfaultfd-sys", +] + +[[package]] +name = "userfaultfd-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ada4f4ae167325015f52cc65f9fb6c251b868d8fb3b6dd0ce2d60e497c4870a" +dependencies = [ + "bindgen 0.57.0", + "cc", + "cfg-if 0.1.10", +] + [[package]] name = "vec_map" version = "0.8.2" @@ -2941,6 +2997,12 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" + [[package]] name = "wait-timeout" version = "0.2.0" @@ -3273,6 +3335,7 @@ dependencies = [ "indexmap", "log", "more-asserts", + "region", "serde", "thiserror", "wasmparser", @@ -3398,6 +3461,7 @@ dependencies = [ name = "wasmtime-runtime" version = "0.24.0" dependencies = [ + "anyhow", "backtrace", "cc", "cfg-if 1.0.0", @@ -3408,8 +3472,10 @@ dependencies = [ "memoffset", "more-asserts", "psm", + "rand 0.7.3", "region", "thiserror", + "userfaultfd", "wasmtime-environ", "winapi", ] diff --git a/Cargo.toml b/Cargo.toml index ac76f1eaae..2ac7ce4331 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -91,6 +91,7 @@ jitdump = ["wasmtime/jitdump"] vtune = ["wasmtime/vtune"] wasi-crypto = ["wasmtime-wasi-crypto"] wasi-nn = ["wasmtime-wasi-nn"] +uffd = ["wasmtime/uffd"] # Try the experimental, work-in-progress new x86_64 backend. This is not stable # as of June 2020. diff --git a/README.md b/README.md index 53c268baa6..2095e08ba1 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@
diff --git a/build.rs b/build.rs index 88307adf97..95f1c24be7 100644 --- a/build.rs +++ b/build.rs @@ -111,7 +111,8 @@ fn test_directory( let testsuite = &extract_name(path); for entry in dir_entries.iter() { - write_testsuite_tests(out, entry, testsuite, strategy)?; + write_testsuite_tests(out, entry, testsuite, strategy, false)?; + write_testsuite_tests(out, entry, testsuite, strategy, true)?; } Ok(dir_entries.len()) @@ -148,6 +149,7 @@ fn write_testsuite_tests( path: impl AsRef