Use rsix to make system calls in Wasmtime. (#3355)
* Use rsix to make system calls in Wasmtime. `rsix` is a system call wrapper crate that we use in `wasi-common`, which can provide the following advantages in the rest of Wasmtime: - It eliminates some `unsafe` blocks in Wasmtime's code. There's still an `unsafe` block in the library, but this way, the `unsafe` is factored out and clearly scoped. - And, it makes error handling more consistent, factoring out code for checking return values and `io::Error::last_os_error()`, and code that does `errno::set_errno(0)`. This doesn't cover *all* system calls; `rsix` doesn't implement signal-handling APIs, and this doesn't cover calls made through `std` or crates like `userfaultfd`, `rand`, and `region`.
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.0"
|
||||
cap-std = "0.19.1"
|
||||
|
||||
[dev-dependencies]
|
||||
wat = "1.0"
|
||||
|
||||
@@ -30,7 +30,7 @@ wat = { version = "1.0.36", optional = true }
|
||||
wasi-common = { path = "../wasi-common", optional = true }
|
||||
wasi-cap-std-sync = { path = "../wasi-common/cap-std-sync", optional = true }
|
||||
wasmtime-wasi = { path = "../wasi", optional = true }
|
||||
cap-std = { version = "0.19.0", optional = true }
|
||||
cap-std = { version = "0.19.1", optional = true }
|
||||
|
||||
[features]
|
||||
default = ['jitdump', 'wat', 'wasi', 'cache']
|
||||
|
||||
3
crates/cache/Cargo.toml
vendored
3
crates/cache/Cargo.toml
vendored
@@ -24,8 +24,7 @@ zstd = { version = "0.9", default-features = false }
|
||||
winapi = "0.3.7"
|
||||
|
||||
[target.'cfg(not(target_os = "windows"))'.dependencies]
|
||||
errno = "0.2.4"
|
||||
libc = "0.2.60"
|
||||
rsix = "0.23.0"
|
||||
|
||||
[dev-dependencies]
|
||||
filetime = "0.2.7"
|
||||
|
||||
22
crates/cache/src/worker.rs
vendored
22
crates/cache/src/worker.rs
vendored
@@ -256,19 +256,15 @@ impl WorkerThread {
|
||||
|
||||
const NICE_DELTA_FOR_BACKGROUND_TASKS: i32 = 3;
|
||||
|
||||
errno::set_errno(errno::Errno(0));
|
||||
let current_nice = unsafe { libc::nice(NICE_DELTA_FOR_BACKGROUND_TASKS) };
|
||||
let errno_val = errno::errno().0;
|
||||
|
||||
if errno_val != 0 {
|
||||
warn!(
|
||||
"Failed to lower worker thread priority. It might affect application performance. \
|
||||
errno: {}",
|
||||
errno_val
|
||||
);
|
||||
} else {
|
||||
debug!("New nice value of worker thread: {}", current_nice);
|
||||
}
|
||||
match rsix::process::nice(NICE_DELTA_FOR_BACKGROUND_TASKS) {
|
||||
Ok(current_nice) => {
|
||||
debug!("New nice value of worker thread: {}", current_nice);
|
||||
}
|
||||
Err(err) => {
|
||||
warn!(
|
||||
"Failed to lower worker thread priority ({:?}). It might affect application performance.", err);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/// Increases the usage counter and recompresses the file
|
||||
|
||||
@@ -14,7 +14,7 @@ edition = "2018"
|
||||
links = "wasmtime-fiber-shims"
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
libc = "0.2.80"
|
||||
rsix = "0.23.0"
|
||||
|
||||
[target.'cfg(windows)'.dependencies.winapi]
|
||||
version = "0.3.9"
|
||||
|
||||
@@ -45,38 +45,30 @@ pub struct FiberStack {
|
||||
|
||||
impl FiberStack {
|
||||
pub fn new(size: usize) -> io::Result<Self> {
|
||||
unsafe {
|
||||
// Round up our stack size request to the nearest multiple of the
|
||||
// page size.
|
||||
let page_size = libc::sysconf(libc::_SC_PAGESIZE) as usize;
|
||||
let size = if size == 0 {
|
||||
page_size
|
||||
} else {
|
||||
(size + (page_size - 1)) & (!(page_size - 1))
|
||||
};
|
||||
// Round up our stack size request to the nearest multiple of the
|
||||
// page size.
|
||||
let page_size = rsix::process::page_size();
|
||||
let size = if size == 0 {
|
||||
page_size
|
||||
} else {
|
||||
(size + (page_size - 1)) & (!(page_size - 1))
|
||||
};
|
||||
|
||||
unsafe {
|
||||
// Add in one page for a guard page and then ask for some memory.
|
||||
let mmap_len = size + page_size;
|
||||
let mmap = libc::mmap(
|
||||
let mmap = rsix::io::mmap_anonymous(
|
||||
ptr::null_mut(),
|
||||
mmap_len,
|
||||
libc::PROT_NONE,
|
||||
libc::MAP_ANON | libc::MAP_PRIVATE,
|
||||
-1,
|
||||
0,
|
||||
);
|
||||
if mmap == libc::MAP_FAILED {
|
||||
return Err(io::Error::last_os_error());
|
||||
}
|
||||
rsix::io::ProtFlags::NONE,
|
||||
rsix::io::MapFlags::PRIVATE,
|
||||
)?;
|
||||
|
||||
if libc::mprotect(
|
||||
rsix::io::mprotect(
|
||||
mmap.cast::<u8>().add(page_size).cast(),
|
||||
size,
|
||||
libc::PROT_READ | libc::PROT_WRITE,
|
||||
) != 0
|
||||
{
|
||||
return Err(io::Error::last_os_error());
|
||||
}
|
||||
rsix::io::MprotectFlags::READ | rsix::io::MprotectFlags::WRITE,
|
||||
)?;
|
||||
|
||||
Ok(Self {
|
||||
top: mmap.cast::<u8>().add(mmap_len),
|
||||
@@ -98,8 +90,8 @@ impl Drop for FiberStack {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if let Some(len) = self.len {
|
||||
let ret = libc::munmap(self.top.sub(len) as _, len);
|
||||
debug_assert!(ret == 0);
|
||||
let ret = rsix::io::munmap(self.top.sub(len) as _, len);
|
||||
debug_assert!(ret.is_ok());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,15 +25,17 @@ gimli = { version = "0.25.0", default-features = false, features = ["std", "read
|
||||
object = { version = "0.26.0", default-features = false, features = ["std", "read_core", "elf"] }
|
||||
serde = { version = "1.0.94", features = ["derive"] }
|
||||
addr2line = { version = "0.16.0", default-features = false }
|
||||
libc = { version = "0.2.60", default-features = false, optional = true }
|
||||
ittapi-rs = { version = "0.1.5", optional = true }
|
||||
bincode = "1.2.1"
|
||||
|
||||
[target.'cfg(target_os = "windows")'.dependencies]
|
||||
winapi = { version = "0.3.8", features = ["winnt", "impl-default"] }
|
||||
|
||||
[target.'cfg(target_os = "linux")'.dependencies]
|
||||
rsix = { version = "0.23.0", optional = true }
|
||||
|
||||
[features]
|
||||
jitdump = ['libc']
|
||||
jitdump = ['rsix']
|
||||
vtune = ['ittapi-rs']
|
||||
|
||||
[badges]
|
||||
|
||||
@@ -16,9 +16,7 @@ use anyhow::Result;
|
||||
use object::{Object, ObjectSection};
|
||||
use std::fmt::Debug;
|
||||
use std::fs::{File, OpenOptions};
|
||||
use std::io;
|
||||
use std::io::Write;
|
||||
use std::os::unix::prelude::*;
|
||||
use std::ptr;
|
||||
use std::sync::Mutex;
|
||||
use std::{borrow, mem, process};
|
||||
@@ -177,17 +175,14 @@ 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 = libc::mmap(
|
||||
let ptr = rsix::io::mmap(
|
||||
ptr::null_mut(),
|
||||
libc::sysconf(libc::_SC_PAGESIZE) as usize,
|
||||
libc::PROT_EXEC | libc::PROT_READ,
|
||||
libc::MAP_PRIVATE,
|
||||
jitdump_file.as_raw_fd(),
|
||||
rsix::process::page_size(),
|
||||
rsix::io::ProtFlags::EXEC | rsix::io::ProtFlags::READ,
|
||||
rsix::io::MapFlags::PRIVATE,
|
||||
&jitdump_file,
|
||||
0,
|
||||
);
|
||||
if ptr == libc::MAP_FAILED {
|
||||
return Err(io::Error::last_os_error().into());
|
||||
}
|
||||
)?;
|
||||
ptr as usize
|
||||
};
|
||||
let mut state = State {
|
||||
@@ -216,16 +211,9 @@ 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.
|
||||
unsafe {
|
||||
let mut ts = mem::MaybeUninit::zeroed();
|
||||
assert_eq!(
|
||||
libc::clock_gettime(libc::CLOCK_MONOTONIC, ts.as_mut_ptr()),
|
||||
0
|
||||
);
|
||||
let ts = ts.assume_init();
|
||||
// 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
|
||||
}
|
||||
let ts = rsix::time::clock_gettime(rsix::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
|
||||
}
|
||||
|
||||
/// Returns the ELF machine architecture.
|
||||
@@ -649,10 +637,7 @@ impl State {
|
||||
impl Drop for State {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
libc::munmap(
|
||||
self.map_addr as *mut _,
|
||||
libc::sysconf(libc::_SC_PAGESIZE) as usize,
|
||||
);
|
||||
rsix::io::munmap(self.map_addr as *mut _, rsix::process::page_size()).unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,9 @@ anyhow = "1.0.38"
|
||||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
mach = "0.3.2"
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
rsix = "0.23.2"
|
||||
|
||||
[target.'cfg(target_os = "windows")'.dependencies]
|
||||
winapi = { version = "0.3.7", features = ["winbase", "memoryapi", "errhandlingapi", "handleapi"] }
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use anyhow::{bail, Context, Result};
|
||||
use anyhow::{Context, Result};
|
||||
|
||||
fn decommit(addr: *mut u8, len: usize, protect: bool) -> Result<()> {
|
||||
if len == 0 {
|
||||
@@ -12,12 +12,8 @@ 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
|
||||
if libc::madvise(addr as _, len, libc::MADV_DONTNEED) != 0 {
|
||||
bail!(
|
||||
"madvise failed to decommit: {}",
|
||||
std::io::Error::last_os_error()
|
||||
);
|
||||
}
|
||||
rsix::io::madvise(addr as _, len, rsix::io::Advice::LinuxDontNeed)
|
||||
.context("madvise failed to decommit: {}")?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
use super::{InstancePool, MemoryPool};
|
||||
use crate::instance::Instance;
|
||||
use anyhow::{bail, Context, Result};
|
||||
use rsix::io::{madvise, Advice};
|
||||
use std::thread;
|
||||
use userfaultfd::{Event, FeatureFlags, IoctlFlags, Uffd, UffdBuilder};
|
||||
use wasmtime_environ::{DefinedMemoryIndex, EntityRef, MemoryInitialization};
|
||||
@@ -50,12 +51,7 @@ fn decommit(addr: *mut u8, len: usize) -> Result<()> {
|
||||
// and the user fault handler will receive the event.
|
||||
// If the pages are not monitored by uffd, the kernel will zero the page on next access,
|
||||
// as if it were mmap'd for the first time.
|
||||
if libc::madvise(addr as _, len, libc::MADV_DONTNEED) != 0 {
|
||||
bail!(
|
||||
"madvise failed to decommit: {}",
|
||||
std::io::Error::last_os_error()
|
||||
);
|
||||
}
|
||||
madvise(addr as _, len, Advice::LinuxDontNeed).context("madvise failed to decommit")?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use anyhow::{bail, Context, Result};
|
||||
use anyhow::{Context, Result};
|
||||
|
||||
fn decommit(addr: *mut u8, len: usize, protect: bool) -> Result<()> {
|
||||
if len == 0 {
|
||||
@@ -9,25 +9,18 @@ fn decommit(addr: *mut u8, len: usize, protect: bool) -> Result<()> {
|
||||
// mapping for the pages in the given range.
|
||||
// The new mapping will be to the CoW zero page, so this effectively
|
||||
// zeroes the pages.
|
||||
if unsafe {
|
||||
libc::mmap(
|
||||
unsafe {
|
||||
rsix::io::mmap_anonymous(
|
||||
addr as _,
|
||||
len,
|
||||
if protect {
|
||||
libc::PROT_NONE
|
||||
rsix::io::ProtFlags::NONE
|
||||
} else {
|
||||
libc::PROT_READ | libc::PROT_WRITE
|
||||
rsix::io::ProtFlags::READ | rsix::io::ProtFlags::WRITE
|
||||
},
|
||||
libc::MAP_PRIVATE | libc::MAP_ANON | libc::MAP_FIXED,
|
||||
-1,
|
||||
0,
|
||||
) as *mut u8
|
||||
} != addr
|
||||
{
|
||||
bail!(
|
||||
"mmap failed to remap pages: {}",
|
||||
std::io::Error::last_os_error()
|
||||
);
|
||||
rsix::io::MapFlags::PRIVATE | rsix::io::MapFlags::FIXED,
|
||||
)
|
||||
.context("mmap failed to remap pages: {}")?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
@@ -2,11 +2,10 @@
|
||||
//! of memory.
|
||||
|
||||
use anyhow::anyhow;
|
||||
use anyhow::{bail, Context, Result};
|
||||
use anyhow::{Context, Result};
|
||||
use more_asserts::assert_le;
|
||||
use std::convert::TryFrom;
|
||||
use std::fs::File;
|
||||
use std::io;
|
||||
use std::ops::Range;
|
||||
use std::path::Path;
|
||||
use std::ptr;
|
||||
@@ -57,8 +56,6 @@ impl Mmap {
|
||||
pub fn from_file(path: &Path) -> Result<Self> {
|
||||
#[cfg(unix)]
|
||||
{
|
||||
use std::os::unix::prelude::*;
|
||||
|
||||
let file = File::open(path).context("failed to open file")?;
|
||||
let len = file
|
||||
.metadata()
|
||||
@@ -66,19 +63,16 @@ impl Mmap {
|
||||
.len();
|
||||
let len = usize::try_from(len).map_err(|_| anyhow!("file too large to map"))?;
|
||||
let ptr = unsafe {
|
||||
libc::mmap(
|
||||
rsix::io::mmap(
|
||||
ptr::null_mut(),
|
||||
len,
|
||||
libc::PROT_READ,
|
||||
libc::MAP_PRIVATE,
|
||||
file.as_raw_fd(),
|
||||
rsix::io::ProtFlags::READ,
|
||||
rsix::io::MapFlags::PRIVATE,
|
||||
&file,
|
||||
0,
|
||||
)
|
||||
.context(format!("mmap failed to allocate {:#x} bytes", len))?
|
||||
};
|
||||
if ptr as isize == -1_isize {
|
||||
return Err(io::Error::last_os_error())
|
||||
.context(format!("mmap failed to allocate {:#x} bytes", len));
|
||||
}
|
||||
|
||||
Ok(Self {
|
||||
ptr: ptr as usize,
|
||||
@@ -90,6 +84,7 @@ impl Mmap {
|
||||
#[cfg(windows)]
|
||||
{
|
||||
use std::fs::OpenOptions;
|
||||
use std::io;
|
||||
use std::os::windows::prelude::*;
|
||||
use winapi::um::handleapi::*;
|
||||
use winapi::um::memoryapi::*;
|
||||
@@ -175,22 +170,14 @@ impl Mmap {
|
||||
Ok(if accessible_size == mapping_size {
|
||||
// Allocate a single read-write region at once.
|
||||
let ptr = unsafe {
|
||||
libc::mmap(
|
||||
rsix::io::mmap_anonymous(
|
||||
ptr::null_mut(),
|
||||
mapping_size,
|
||||
libc::PROT_READ | libc::PROT_WRITE,
|
||||
libc::MAP_PRIVATE | libc::MAP_ANON,
|
||||
-1,
|
||||
0,
|
||||
rsix::io::ProtFlags::READ | rsix::io::ProtFlags::WRITE,
|
||||
rsix::io::MapFlags::PRIVATE,
|
||||
)
|
||||
.context(format!("mmap failed to allocate {:#x} bytes", mapping_size))?
|
||||
};
|
||||
if ptr as isize == -1_isize {
|
||||
bail!(
|
||||
"mmap failed to allocate {:#x} bytes: {}",
|
||||
mapping_size,
|
||||
io::Error::last_os_error()
|
||||
);
|
||||
}
|
||||
|
||||
Self {
|
||||
ptr: ptr as usize,
|
||||
@@ -200,22 +187,14 @@ impl Mmap {
|
||||
} else {
|
||||
// Reserve the mapping size.
|
||||
let ptr = unsafe {
|
||||
libc::mmap(
|
||||
rsix::io::mmap_anonymous(
|
||||
ptr::null_mut(),
|
||||
mapping_size,
|
||||
libc::PROT_NONE,
|
||||
libc::MAP_PRIVATE | libc::MAP_ANON,
|
||||
-1,
|
||||
0,
|
||||
rsix::io::ProtFlags::NONE,
|
||||
rsix::io::MapFlags::PRIVATE,
|
||||
)
|
||||
.context(format!("mmap failed to allocate {:#x} bytes", mapping_size))?
|
||||
};
|
||||
if ptr as isize == -1_isize {
|
||||
bail!(
|
||||
"mmap failed to allocate {:#x} bytes: {}",
|
||||
mapping_size,
|
||||
io::Error::last_os_error()
|
||||
);
|
||||
}
|
||||
|
||||
let mut result = Self {
|
||||
ptr: ptr as usize,
|
||||
@@ -237,6 +216,8 @@ impl Mmap {
|
||||
/// must be native page-size multiples.
|
||||
#[cfg(target_os = "windows")]
|
||||
pub fn accessible_reserved(accessible_size: usize, mapping_size: usize) -> Result<Self> {
|
||||
use anyhow::bail;
|
||||
use std::io;
|
||||
use winapi::um::memoryapi::VirtualAlloc;
|
||||
use winapi::um::winnt::{MEM_COMMIT, MEM_RESERVE, PAGE_NOACCESS, PAGE_READWRITE};
|
||||
|
||||
@@ -316,6 +297,8 @@ impl Mmap {
|
||||
/// `self`'s reserved memory.
|
||||
#[cfg(target_os = "windows")]
|
||||
pub fn make_accessible(&mut self, start: usize, len: usize) -> Result<()> {
|
||||
use anyhow::bail;
|
||||
use std::io;
|
||||
use winapi::ctypes::c_void;
|
||||
use winapi::um::memoryapi::VirtualAlloc;
|
||||
use winapi::um::winnt::{MEM_COMMIT, PAGE_READWRITE};
|
||||
@@ -398,6 +381,7 @@ impl Mmap {
|
||||
// we don't want our modifications to go back to the original file.
|
||||
#[cfg(windows)]
|
||||
{
|
||||
use std::io;
|
||||
use winapi::um::memoryapi::*;
|
||||
use winapi::um::winnt::*;
|
||||
|
||||
@@ -440,8 +424,8 @@ impl Drop for Mmap {
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
fn drop(&mut self) {
|
||||
if self.len != 0 {
|
||||
let r = unsafe { libc::munmap(self.ptr as *mut libc::c_void, self.len) };
|
||||
assert_eq!(r, 0, "munmap failed: {}", io::Error::last_os_error());
|
||||
unsafe { rsix::io::munmap(self.ptr as *mut std::ffi::c_void, self.len) }
|
||||
.expect("munmap failed");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
use crate::traphandlers::{tls, wasmtime_longjmp, Trap};
|
||||
use std::cell::RefCell;
|
||||
use std::convert::TryInto;
|
||||
use std::io;
|
||||
use std::mem::{self, MaybeUninit};
|
||||
use std::ptr::{self, null_mut};
|
||||
@@ -291,36 +290,27 @@ pub fn lazy_per_thread_init() -> Result<(), Box<Trap>> {
|
||||
|
||||
// ... but failing that we need to allocate our own, so do all that
|
||||
// here.
|
||||
let page_size: usize = libc::sysconf(libc::_SC_PAGESIZE).try_into().unwrap();
|
||||
let page_size: usize = region::page::size();
|
||||
let guard_size = page_size;
|
||||
let alloc_size = guard_size + MIN_STACK_SIZE;
|
||||
|
||||
let ptr = libc::mmap(
|
||||
let ptr = rsix::io::mmap_anonymous(
|
||||
null_mut(),
|
||||
alloc_size,
|
||||
libc::PROT_NONE,
|
||||
libc::MAP_PRIVATE | libc::MAP_ANON,
|
||||
-1,
|
||||
0,
|
||||
);
|
||||
if ptr == libc::MAP_FAILED {
|
||||
return Err(Box::new(Trap::oom()));
|
||||
}
|
||||
rsix::io::ProtFlags::NONE,
|
||||
rsix::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 libc::c_void;
|
||||
let r = libc::mprotect(
|
||||
let stack_ptr = (ptr as usize + guard_size) as *mut std::ffi::c_void;
|
||||
rsix::io::mprotect(
|
||||
stack_ptr,
|
||||
MIN_STACK_SIZE,
|
||||
libc::PROT_READ | libc::PROT_WRITE,
|
||||
);
|
||||
assert_eq!(
|
||||
r,
|
||||
0,
|
||||
"mprotect to configure memory for sigaltstack failed: {}",
|
||||
io::Error::last_os_error()
|
||||
);
|
||||
rsix::io::MprotectFlags::READ | rsix::io::MprotectFlags::WRITE,
|
||||
)
|
||||
.expect("mprotect to configure memory for sigaltstack failed");
|
||||
let new_stack = libc::stack_t {
|
||||
ss_sp: stack_ptr,
|
||||
ss_flags: 0,
|
||||
@@ -344,8 +334,8 @@ pub fn lazy_per_thread_init() -> Result<(), Box<Trap>> {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
// Deallocate the stack memory.
|
||||
let r = libc::munmap(self.mmap_ptr, self.mmap_size);
|
||||
debug_assert_eq!(r, 0, "munmap failed during thread shutdown");
|
||||
let r = rsix::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.0"
|
||||
cap-std = "0.19.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.30.0" }
|
||||
tracing = "0.1.19"
|
||||
cap-std = "0.19.0"
|
||||
cap-rand = "0.19.0"
|
||||
cap-std = "0.19.1"
|
||||
cap-rand = "0.19.1"
|
||||
bitflags = "1.2"
|
||||
io-lifetimes = { version = "0.3.0", default-features = false }
|
||||
io-lifetimes = { version = "0.3.1", default-features = false }
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
rsix = "0.22.4"
|
||||
rsix = "0.23.0"
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
winapi = "0.3"
|
||||
|
||||
@@ -15,18 +15,18 @@ include = ["src/**/*", "README.md", "LICENSE" ]
|
||||
wasi-common = { path = "../", version = "0.30.0" }
|
||||
async-trait = "0.1"
|
||||
anyhow = "1.0"
|
||||
cap-std = "0.19.0"
|
||||
cap-fs-ext = "0.19.0"
|
||||
cap-time-ext = "0.19.0"
|
||||
cap-rand = "0.19.0"
|
||||
fs-set-times = "0.11.0"
|
||||
system-interface = { version = "0.14.0", features = ["cap_std_impls"] }
|
||||
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"] }
|
||||
tracing = "0.1.19"
|
||||
bitflags = "1.2"
|
||||
io-lifetimes = { version = "0.3.0", default-features = false }
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
rsix = "0.22.4"
|
||||
rsix = "0.23.0"
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
winapi = "0.3"
|
||||
|
||||
@@ -15,18 +15,18 @@ wasi-common = { path = "../", version = "0.30.0" }
|
||||
wasi-cap-std-sync = { path = "../cap-std-sync", version = "0.30.0" }
|
||||
wiggle = { path = "../../wiggle", version = "0.30.0" }
|
||||
tokio = { version = "1.8.0", features = [ "rt", "fs", "time", "io-util", "net", "io-std", "rt-multi-thread"] }
|
||||
cap-std = "0.19.0"
|
||||
cap-fs-ext = "0.19.0"
|
||||
cap-time-ext = "0.19.0"
|
||||
fs-set-times = "0.11.0"
|
||||
system-interface = { version = "0.14.0", features = ["cap_std_impls"] }
|
||||
cap-std = "0.19.1"
|
||||
cap-fs-ext = "0.19.1"
|
||||
cap-time-ext = "0.19.1"
|
||||
fs-set-times = "0.12.0"
|
||||
system-interface = { version = "0.15.0", features = ["cap_std_impls"] }
|
||||
tracing = "0.1.19"
|
||||
bitflags = "1.2"
|
||||
anyhow = "1"
|
||||
io-lifetimes = { version = "0.3.0", default-features = false }
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
rsix = "0.22.4"
|
||||
rsix = "0.23.0"
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
winapi = "0.3"
|
||||
@@ -36,4 +36,4 @@ lazy_static = "1.4"
|
||||
tempfile = "3.1.0"
|
||||
tokio = { version = "1.8.0", features = [ "macros" ] }
|
||||
anyhow = "1"
|
||||
cap-tempfile = "0.19.0"
|
||||
cap-tempfile = "0.19.1"
|
||||
|
||||
Reference in New Issue
Block a user