Prevent unsoundness in environments with broken madvise(MADV_DONTNEED) (#11722)

* Prevend unsoundness in environments with broken `madvise(MADV_DONTNEED)`

* Add the `std` feature to `rustix` dependency

Apparently not having this breaks compilation on non-nightly toolchains.

* Autodetect the page size when checking whether `madvise` works

* Only make sure that the madvice check doesn't return `Err`
This commit is contained in:
Koute
2022-06-28 15:54:56 +09:00
committed by GitHub
parent bced5732bf
commit 3d89fa3605
4 changed files with 187 additions and 14 deletions
@@ -32,6 +32,10 @@ sp-runtime-interface = { version = "6.0.0", path = "../../../primitives/runtime-
sp-sandbox = { version = "0.10.0-dev", path = "../../../primitives/sandbox" }
sp-wasm-interface = { version = "6.0.0", features = ["wasmtime"], path = "../../../primitives/wasm-interface" }
[target.'cfg(target_os = "linux")'.dependencies]
rustix = { version = "0.35.6", default-features = false, features = ["std", "mm", "fs", "param"] }
once_cell = "1.12.0"
[dev-dependencies]
wat = "1.0"
sc-runtime-test = { version = "2.0.0", path = "../runtime-test" }