Update to rustix 0.26.2. (#3521)
This pulls in a fix for Android, where Android's seccomp policy on older versions is to make `openat2` irrecoverably crash the process, so we have to do a version check up front rather than relying on `ENOSYS` to determine if `openat2` is supported. And it pulls in the fix for the link errors when multiple versions of rsix/rustix are linked in. And it has updates for two crate renamings: rsix has been renamed to rustix, and unsafe-io has been renamed to io-extras.
This commit is contained in:
@@ -22,7 +22,7 @@ wasmtime-wasi = { path = "../wasi" }
|
||||
wasmtime-wasi-crypto = { path = "../wasi-crypto", optional = true }
|
||||
wasmtime-wasi-nn = { path = "../wasi-nn", optional = true }
|
||||
wasi-cap-std-sync = { path = "../wasi-common/cap-std-sync" }
|
||||
cap-std = "0.19.1"
|
||||
cap-std = "0.21.1"
|
||||
|
||||
[dev-dependencies]
|
||||
wat = "1.0"
|
||||
|
||||
@@ -29,7 +29,7 @@ wat = { version = "1.0.36", optional = true }
|
||||
# Optional dependencies for the `wasi` feature
|
||||
wasi-cap-std-sync = { path = "../wasi-common/cap-std-sync", optional = true }
|
||||
wasmtime-wasi = { path = "../wasi", optional = true }
|
||||
cap-std = { version = "0.19.1", optional = true }
|
||||
cap-std = { version = "0.21.1", optional = true }
|
||||
|
||||
[features]
|
||||
default = ['jitdump', 'wat', 'wasi', 'cache']
|
||||
|
||||
2
crates/cache/Cargo.toml
vendored
2
crates/cache/Cargo.toml
vendored
@@ -24,7 +24,7 @@ zstd = { version = "0.9", default-features = false }
|
||||
winapi = "0.3.7"
|
||||
|
||||
[target.'cfg(not(target_os = "windows"))'.dependencies]
|
||||
rsix = "0.23.0"
|
||||
rustix = "0.26.2"
|
||||
|
||||
[dev-dependencies]
|
||||
filetime = "0.2.7"
|
||||
|
||||
2
crates/cache/src/worker.rs
vendored
2
crates/cache/src/worker.rs
vendored
@@ -256,7 +256,7 @@ impl WorkerThread {
|
||||
|
||||
const NICE_DELTA_FOR_BACKGROUND_TASKS: i32 = 3;
|
||||
|
||||
match rsix::process::nice(NICE_DELTA_FOR_BACKGROUND_TASKS) {
|
||||
match rustix::process::nice(NICE_DELTA_FOR_BACKGROUND_TASKS) {
|
||||
Ok(current_nice) => {
|
||||
debug!("New nice value of worker thread: {}", current_nice);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ edition = "2018"
|
||||
links = "wasmtime-fiber-shims"
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
rsix = "0.23.0"
|
||||
rustix = "0.26.2"
|
||||
|
||||
[target.'cfg(windows)'.dependencies.winapi]
|
||||
version = "0.3.9"
|
||||
|
||||
@@ -47,7 +47,7 @@ impl FiberStack {
|
||||
pub fn new(size: usize) -> io::Result<Self> {
|
||||
// Round up our stack size request to the nearest multiple of the
|
||||
// page size.
|
||||
let page_size = rsix::process::page_size();
|
||||
let page_size = rustix::process::page_size();
|
||||
let size = if size == 0 {
|
||||
page_size
|
||||
} else {
|
||||
@@ -57,17 +57,17 @@ impl FiberStack {
|
||||
unsafe {
|
||||
// Add in one page for a guard page and then ask for some memory.
|
||||
let mmap_len = size + page_size;
|
||||
let mmap = rsix::io::mmap_anonymous(
|
||||
let mmap = rustix::io::mmap_anonymous(
|
||||
ptr::null_mut(),
|
||||
mmap_len,
|
||||
rsix::io::ProtFlags::empty(),
|
||||
rsix::io::MapFlags::PRIVATE,
|
||||
rustix::io::ProtFlags::empty(),
|
||||
rustix::io::MapFlags::PRIVATE,
|
||||
)?;
|
||||
|
||||
rsix::io::mprotect(
|
||||
rustix::io::mprotect(
|
||||
mmap.cast::<u8>().add(page_size).cast(),
|
||||
size,
|
||||
rsix::io::MprotectFlags::READ | rsix::io::MprotectFlags::WRITE,
|
||||
rustix::io::MprotectFlags::READ | rustix::io::MprotectFlags::WRITE,
|
||||
)?;
|
||||
|
||||
Ok(Self {
|
||||
@@ -90,7 +90,7 @@ impl Drop for FiberStack {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if let Some(len) = self.len {
|
||||
let ret = rsix::io::munmap(self.top.sub(len) as _, len);
|
||||
let ret = rustix::io::munmap(self.top.sub(len) as _, len);
|
||||
debug_assert!(ret.is_ok());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,10 +29,10 @@ bincode = "1.2.1"
|
||||
winapi = { version = "0.3.8", features = ["winnt", "impl-default"] }
|
||||
|
||||
[target.'cfg(target_os = "linux")'.dependencies]
|
||||
rsix = { version = "0.23.0", optional = true }
|
||||
rustix = { version = "0.26.2", optional = true }
|
||||
|
||||
[features]
|
||||
jitdump = ['rsix']
|
||||
jitdump = ['rustix']
|
||||
vtune = ['ittapi-rs']
|
||||
|
||||
[badges]
|
||||
|
||||
@@ -57,8 +57,8 @@ impl CodeMemory {
|
||||
#[cfg(all(target_arch = "aarch64", target_os = "linux"))]
|
||||
{
|
||||
// This is a requirement of the `membarrier` call executed by the `publish` method.
|
||||
rsix::process::membarrier(
|
||||
rsix::process::MembarrierCommand::RegisterPrivateExpeditedSyncCore,
|
||||
rustix::process::membarrier(
|
||||
rustix::process::MembarrierCommand::RegisterPrivateExpeditedSyncCore,
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
@@ -171,8 +171,8 @@ impl CodeMemory {
|
||||
#[cfg(all(target_arch = "aarch64", target_os = "linux"))]
|
||||
{
|
||||
// Ensure that no processor has fetched a stale instruction stream.
|
||||
rsix::process::membarrier(
|
||||
rsix::process::MembarrierCommand::PrivateExpeditedSyncCore,
|
||||
rustix::process::membarrier(
|
||||
rustix::process::MembarrierCommand::PrivateExpeditedSyncCore,
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
@@ -176,11 +176,11 @@ impl JitDumpAgent {
|
||||
// To match what some perf examples are doing we keep this `mmap` alive
|
||||
// until this agent goes away.
|
||||
let map_addr = unsafe {
|
||||
let ptr = rsix::io::mmap(
|
||||
let ptr = rustix::io::mmap(
|
||||
ptr::null_mut(),
|
||||
rsix::process::page_size(),
|
||||
rsix::io::ProtFlags::EXEC | rsix::io::ProtFlags::READ,
|
||||
rsix::io::MapFlags::PRIVATE,
|
||||
rustix::process::page_size(),
|
||||
rustix::io::ProtFlags::EXEC | rustix::io::ProtFlags::READ,
|
||||
rustix::io::MapFlags::PRIVATE,
|
||||
&jitdump_file,
|
||||
0,
|
||||
)?;
|
||||
@@ -215,7 +215,7 @@ impl State {
|
||||
// conveniently also uses, but `Instant` doesn't allow us to get access
|
||||
// to nanoseconds as an internal detail, so we calculate the nanoseconds
|
||||
// ourselves here.
|
||||
let ts = rsix::time::clock_gettime(rsix::time::ClockId::Monotonic);
|
||||
let ts = rustix::time::clock_gettime(rustix::time::ClockId::Monotonic);
|
||||
// TODO: What does it mean for either sec or nsec to be negative?
|
||||
(ts.tv_sec * 1_000_000_000 + ts.tv_nsec) as u64
|
||||
}
|
||||
@@ -687,7 +687,7 @@ impl State {
|
||||
impl Drop for State {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
rsix::io::munmap(self.map_addr as *mut _, rsix::process::page_size()).unwrap();
|
||||
rustix::io::munmap(self.map_addr as *mut _, rustix::process::page_size()).unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ anyhow = "1.0.38"
|
||||
mach = "0.3.2"
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
rsix = "0.23.2"
|
||||
rustix = "0.26.2"
|
||||
|
||||
[target.'cfg(target_os = "windows")'.dependencies]
|
||||
winapi = { version = "0.3.7", features = ["winbase", "memoryapi", "errhandlingapi", "handleapi"] }
|
||||
|
||||
@@ -12,7 +12,7 @@ fn decommit(addr: *mut u8, len: usize, protect: bool) -> Result<()> {
|
||||
}
|
||||
|
||||
// On Linux, this is enough to cause the kernel to initialize the pages to 0 on next access
|
||||
rsix::io::madvise(addr as _, len, rsix::io::Advice::LinuxDontNeed)
|
||||
rustix::io::madvise(addr as _, len, rustix::io::Advice::LinuxDontNeed)
|
||||
.context("madvise failed to decommit: {}")?;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
use super::{InstancePool, MemoryPool};
|
||||
use crate::instance::Instance;
|
||||
use anyhow::{bail, Context, Result};
|
||||
use rsix::io::{madvise, Advice};
|
||||
use rustix::io::{madvise, Advice};
|
||||
use std::thread;
|
||||
use userfaultfd::{Event, FeatureFlags, IoctlFlags, Uffd, UffdBuilder};
|
||||
use wasmtime_environ::{DefinedMemoryIndex, EntityRef, MemoryInitialization};
|
||||
|
||||
@@ -10,15 +10,15 @@ fn decommit(addr: *mut u8, len: usize, protect: bool) -> Result<()> {
|
||||
// The new mapping will be to the CoW zero page, so this effectively
|
||||
// zeroes the pages.
|
||||
unsafe {
|
||||
rsix::io::mmap_anonymous(
|
||||
rustix::io::mmap_anonymous(
|
||||
addr as _,
|
||||
len,
|
||||
if protect {
|
||||
rsix::io::ProtFlags::empty()
|
||||
rustix::io::ProtFlags::empty()
|
||||
} else {
|
||||
rsix::io::ProtFlags::READ | rsix::io::ProtFlags::WRITE
|
||||
rustix::io::ProtFlags::READ | rustix::io::ProtFlags::WRITE
|
||||
},
|
||||
rsix::io::MapFlags::PRIVATE | rsix::io::MapFlags::FIXED,
|
||||
rustix::io::MapFlags::PRIVATE | rustix::io::MapFlags::FIXED,
|
||||
)
|
||||
.context("mmap failed to remap pages: {}")?;
|
||||
}
|
||||
|
||||
@@ -63,11 +63,11 @@ impl Mmap {
|
||||
.len();
|
||||
let len = usize::try_from(len).map_err(|_| anyhow!("file too large to map"))?;
|
||||
let ptr = unsafe {
|
||||
rsix::io::mmap(
|
||||
rustix::io::mmap(
|
||||
ptr::null_mut(),
|
||||
len,
|
||||
rsix::io::ProtFlags::READ,
|
||||
rsix::io::MapFlags::PRIVATE,
|
||||
rustix::io::ProtFlags::READ,
|
||||
rustix::io::MapFlags::PRIVATE,
|
||||
&file,
|
||||
0,
|
||||
)
|
||||
@@ -170,11 +170,11 @@ impl Mmap {
|
||||
Ok(if accessible_size == mapping_size {
|
||||
// Allocate a single read-write region at once.
|
||||
let ptr = unsafe {
|
||||
rsix::io::mmap_anonymous(
|
||||
rustix::io::mmap_anonymous(
|
||||
ptr::null_mut(),
|
||||
mapping_size,
|
||||
rsix::io::ProtFlags::READ | rsix::io::ProtFlags::WRITE,
|
||||
rsix::io::MapFlags::PRIVATE,
|
||||
rustix::io::ProtFlags::READ | rustix::io::ProtFlags::WRITE,
|
||||
rustix::io::MapFlags::PRIVATE,
|
||||
)
|
||||
.context(format!("mmap failed to allocate {:#x} bytes", mapping_size))?
|
||||
};
|
||||
@@ -187,11 +187,11 @@ impl Mmap {
|
||||
} else {
|
||||
// Reserve the mapping size.
|
||||
let ptr = unsafe {
|
||||
rsix::io::mmap_anonymous(
|
||||
rustix::io::mmap_anonymous(
|
||||
ptr::null_mut(),
|
||||
mapping_size,
|
||||
rsix::io::ProtFlags::empty(),
|
||||
rsix::io::MapFlags::PRIVATE,
|
||||
rustix::io::ProtFlags::empty(),
|
||||
rustix::io::MapFlags::PRIVATE,
|
||||
)
|
||||
.context(format!("mmap failed to allocate {:#x} bytes", mapping_size))?
|
||||
};
|
||||
@@ -424,7 +424,7 @@ impl Drop for Mmap {
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
fn drop(&mut self) {
|
||||
if self.len != 0 {
|
||||
unsafe { rsix::io::munmap(self.ptr as *mut std::ffi::c_void, self.len) }
|
||||
unsafe { rustix::io::munmap(self.ptr as *mut std::ffi::c_void, self.len) }
|
||||
.expect("munmap failed");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -294,21 +294,21 @@ pub fn lazy_per_thread_init() -> Result<(), Box<Trap>> {
|
||||
let guard_size = page_size;
|
||||
let alloc_size = guard_size + MIN_STACK_SIZE;
|
||||
|
||||
let ptr = rsix::io::mmap_anonymous(
|
||||
let ptr = rustix::io::mmap_anonymous(
|
||||
null_mut(),
|
||||
alloc_size,
|
||||
rsix::io::ProtFlags::empty(),
|
||||
rsix::io::MapFlags::PRIVATE,
|
||||
rustix::io::ProtFlags::empty(),
|
||||
rustix::io::MapFlags::PRIVATE,
|
||||
)
|
||||
.map_err(|_| Box::new(Trap::oom()))?;
|
||||
|
||||
// Prepare the stack with readable/writable memory and then register it
|
||||
// with `sigaltstack`.
|
||||
let stack_ptr = (ptr as usize + guard_size) as *mut std::ffi::c_void;
|
||||
rsix::io::mprotect(
|
||||
rustix::io::mprotect(
|
||||
stack_ptr,
|
||||
MIN_STACK_SIZE,
|
||||
rsix::io::MprotectFlags::READ | rsix::io::MprotectFlags::WRITE,
|
||||
rustix::io::MprotectFlags::READ | rustix::io::MprotectFlags::WRITE,
|
||||
)
|
||||
.expect("mprotect to configure memory for sigaltstack failed");
|
||||
let new_stack = libc::stack_t {
|
||||
@@ -334,7 +334,7 @@ pub fn lazy_per_thread_init() -> Result<(), Box<Trap>> {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
// Deallocate the stack memory.
|
||||
let r = rsix::io::munmap(self.mmap_ptr, self.mmap_size);
|
||||
let r = rustix::io::munmap(self.mmap_ptr, self.mmap_size);
|
||||
debug_assert!(r.is_ok(), "munmap failed during thread shutdown");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ tempfile = "3.1.0"
|
||||
os_pipe = "0.9"
|
||||
anyhow = "1.0.19"
|
||||
wat = "1.0.37"
|
||||
cap-std = "0.19.1"
|
||||
cap-std = "0.21.1"
|
||||
tokio = { version = "1.8.0", features = ["rt-multi-thread"] }
|
||||
|
||||
[features]
|
||||
|
||||
@@ -22,13 +22,13 @@ anyhow = "1.0"
|
||||
thiserror = "1.0"
|
||||
wiggle = { path = "../wiggle", default-features = false, version = "=0.31.0" }
|
||||
tracing = "0.1.19"
|
||||
cap-std = "0.19.1"
|
||||
cap-rand = "0.19.1"
|
||||
cap-std = "0.21.1"
|
||||
cap-rand = "0.21.1"
|
||||
bitflags = "1.2"
|
||||
io-lifetimes = { version = "0.3.1", default-features = false }
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
rsix = "0.23.0"
|
||||
rustix = "0.26.2"
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
winapi = "0.3"
|
||||
|
||||
@@ -15,17 +15,17 @@ include = ["src/**/*", "README.md", "LICENSE" ]
|
||||
wasi-common = { path = "../", version = "=0.31.0" }
|
||||
async-trait = "0.1"
|
||||
anyhow = "1.0"
|
||||
cap-std = "0.19.1"
|
||||
cap-fs-ext = "0.19.1"
|
||||
cap-time-ext = "0.19.1"
|
||||
cap-rand = "0.19.1"
|
||||
fs-set-times = "0.12.0"
|
||||
system-interface = { version = "0.15.0", features = ["cap_std_impls"] }
|
||||
cap-std = "0.21.1"
|
||||
cap-fs-ext = "0.21.1"
|
||||
cap-time-ext = "0.21.1"
|
||||
cap-rand = "0.21.1"
|
||||
fs-set-times = "0.13.1"
|
||||
system-interface = { version = "0.16.0", features = ["cap_std_impls"] }
|
||||
tracing = "0.1.19"
|
||||
io-lifetimes = { version = "0.3.0", default-features = false }
|
||||
io-lifetimes = { version = "0.3.3", default-features = false }
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
rsix = "0.23.0"
|
||||
rustix = "0.26.2"
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
winapi = "0.3"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use cap_std::time::Duration;
|
||||
use io_lifetimes::{AsFd, BorrowedFd};
|
||||
use rsix::io::{PollFd, PollFlags};
|
||||
use rustix::io::{PollFd, PollFlags};
|
||||
use std::convert::TryInto;
|
||||
use wasi_common::{
|
||||
file::WasiFile,
|
||||
@@ -49,9 +49,9 @@ pub async fn poll_oneoff<'a>(poll: &mut Poll<'a>) -> Result<(), Error> {
|
||||
poll_fds = tracing::field::debug(&pollfds),
|
||||
"poll"
|
||||
);
|
||||
match rsix::io::poll(&mut pollfds, poll_timeout) {
|
||||
match rustix::io::poll(&mut pollfds, poll_timeout) {
|
||||
Ok(ready) => break ready,
|
||||
Err(rsix::io::Error::INTR) => continue,
|
||||
Err(rustix::io::Error::INTR) => continue,
|
||||
Err(err) => return Err(err.into()),
|
||||
}
|
||||
};
|
||||
|
||||
@@ -112,7 +112,7 @@ impl TryFrom<std::io::Error> for types::Errno {
|
||||
fn try_from(err: std::io::Error) -> Result<types::Errno, Error> {
|
||||
#[cfg(unix)]
|
||||
fn raw_error_code(err: &std::io::Error) -> Option<types::Errno> {
|
||||
use rsix::io::Error;
|
||||
use rustix::io::Error;
|
||||
match Error::from_io_error(err) {
|
||||
Some(Error::PIPE) => Some(types::Errno::Pipe),
|
||||
Some(Error::PERM) => Some(types::Errno::Perm),
|
||||
|
||||
@@ -15,12 +15,12 @@ wasi-common = { path = "../", version = "=0.31.0" }
|
||||
wasi-cap-std-sync = { path = "../cap-std-sync", version = "=0.31.0" }
|
||||
wiggle = { path = "../../wiggle", version = "=0.31.0" }
|
||||
tokio = { version = "1.8.0", features = [ "rt", "fs", "time", "io-util", "net", "io-std", "rt-multi-thread"] }
|
||||
cap-std = "0.19.1"
|
||||
cap-std = "0.21.1"
|
||||
anyhow = "1"
|
||||
io-lifetimes = { version = "0.3.0", default-features = false }
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
rsix = "0.23.0"
|
||||
rustix = "0.26.2"
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
winapi = "0.3"
|
||||
@@ -30,4 +30,4 @@ lazy_static = "1.4"
|
||||
tempfile = "3.1.0"
|
||||
tokio = { version = "1.8.0", features = [ "macros" ] }
|
||||
anyhow = "1"
|
||||
cap-tempfile = "0.19.1"
|
||||
cap-tempfile = "0.21.1"
|
||||
|
||||
Reference in New Issue
Block a user