Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rewrite wasi-common in terms of cap-std #2487

Merged
merged 267 commits into from
Feb 5, 2021
Merged
Changes from 1 commit
Commits
Show all changes
267 commits
Select commit Hold shift + click to select a range
61f97a3
trap on wasi_proc_exit
pchickey Dec 11, 2020
dfcdbfd
test-programs: no longer test virtfs separately
pchickey Dec 11, 2020
30d49d1
add preopened_dir to builder
pchickey Dec 12, 2020
7594551
test-programs: learn how to preopen a dir again
pchickey Dec 12, 2020
0572b40
port read and write pipes in
pchickey Dec 12, 2020
1b8f9fd
use virtual stdio
pchickey Dec 12, 2020
7ec9aac
Merge remote-tracking branch 'origin/main' into pch/wasi_common_cap_std
pchickey Dec 15, 2020
c16e731
get rid of linker Rc cycle, and add debug info to test programs
pchickey Dec 15, 2020
04805fc
pass a test, dubiously
pchickey Dec 15, 2020
b5852bf
open_dir can never create a dir
pchickey Dec 16, 2020
c0461ca
redesign how caps fit into entries!
pchickey Dec 16, 2020
27ddbda
preopens with Caps::all, implement create, remove dir, remove file
pchickey Dec 16, 2020
789eec3
dangling_fd test: open with either READ or CREAT|WRITE
pchickey Dec 16, 2020
dbe0f4f
Revert "dangling_fd test: open with either READ or CREAT|WRITE"
pchickey Dec 16, 2020
af8bdf8
table: borrow entry immutably or mutably
pchickey Dec 16, 2020
8777194
always open files read if not write
pchickey Dec 16, 2020
23b5689
fix file rights
pchickey Dec 17, 2020
df0218c
make get_filestat work
pchickey Dec 17, 2020
8ac6882
fixup dir/file caps into rights
pchickey Dec 18, 2020
4c3c9a9
Filestat: make times optional, default to 0 at wasi interface
pchickey Dec 18, 2020
f9ff97a
virt pipes: return concrete errors, best effort at flags and filestat
pchickey Dec 18, 2020
d8720cf
unexpected io error: do our best based on e.kind()
pchickey Dec 18, 2020
f6afd4c
test-programs: sandbox escape is an EPERM now, not an ENOTCAPABLE
pchickey Dec 18, 2020
82edae3
readlink
pchickey Dec 18, 2020
8cc1ab7
fixup filetype nonsense
pchickey Dec 18, 2020
af0aa14
get a FileStat of a Dir
pchickey Dec 19, 2020
c191925
implement fd_readdir
pchickey Dec 19, 2020
a33418c
path_filestat: remove expectation that rights_inheriting describes su…
pchickey Dec 19, 2020
8672dce
open_file requires the FdFlags
pchickey Dec 19, 2020
f663045
better arg names
pchickey Dec 19, 2020
8deb3ed
path_open: ENOTDIR when fd is a file
pchickey Dec 19, 2020
b50b9b4
add notes describing why remaining wasi tests are failing
pchickey Dec 19, 2020
01d74ce
Merge remote-tracking branch 'origin/main' into pch/wasi_common_cap_std
pchickey Jan 4, 2021
48554a1
implement randomness
pchickey Jan 4, 2021
50554d3
add, fix tests
pchickey Jan 4, 2021
c7fcc34
add clocks!
pchickey Jan 5, 2021
10a8472
Ilseq is the correct error when osstring cant be turned into string
pchickey Jan 5, 2021
add601f
use cap_rand instead of getrandom
pchickey Jan 5, 2021
41c06db
finish implementing clocks correctly
pchickey Jan 5, 2021
8431802
no more clock test fail
pchickey Jan 5, 2021
222a578
readlink: get rid of weird partial-buffer semantics carried over from…
pchickey Jan 5, 2021
d51ffe8
add . and .. to the readdir iterator
pchickey Jan 5, 2021
94d2280
better docs
pchickey Jan 5, 2021
21cd55b
add directory rename
pchickey Jan 5, 2021
07a9584
add hard_link to dir
pchickey Jan 5, 2021
fb32f65
get path filestat on a dir
pchickey Jan 5, 2021
8ace7f0
delete file::get/set_oflags
pchickey Jan 5, 2021
16eff68
summarize failures with a TODO list!
pchickey Jan 5, 2021
ce13cd9
dir: add set times
pchickey Jan 5, 2021
56788be
sorta fix set_times on paths and dirfds
pchickey Jan 5, 2021
31c5328
incorporate dan's suggestions on readdir
pchickey Jan 5, 2021
fb37751
fix warning
pchickey Jan 6, 2021
c200400
Merge remote-tracking branch 'origin/main' into pch/wasi_common_cap_std
pchickey Jan 7, 2021
13cd7a4
Merge branch 'pch/wiggle_trapping' into pch/wasi_common_cap_std
pchickey Jan 7, 2021
c2a715c
wiggle traps
pchickey Jan 7, 2021
82128cb
trap proc_exit and unsupported funcs
pchickey Jan 7, 2021
a900d04
Merge remote-tracking branch 'origin/main' into pch/wasi_common_cap_std
pchickey Jan 8, 2021
4a6e92f
upgrade to cap-std 0.9
pchickey Jan 8, 2021
2d2e6d1
Dir::open_file, open_dir: correct symlink following
pchickey Jan 11, 2021
09861c2
symlink-related tests: accept either ELOOP or ENOTDIR
pchickey Jan 11, 2021
932ba6b
need DirExt::hard_link_nofollow to implement path_link properly
pchickey Jan 11, 2021
f084cf1
failure to create trailing slash symlink to file can be EEXIST or ENO…
pchickey Jan 11, 2021
4044977
just ignore nofollow on links for now
pchickey Jan 12, 2021
3863b8b
re-organize failures todo list
pchickey Jan 12, 2021
b1d32f4
use bitflags crate to define bitflags, rather than by hand
pchickey Jan 12, 2021
d56d2f0
directory seek test: code does not agree with comment. Fix code.
pchickey Jan 12, 2021
4a54db0
derive debug and clone on DirFdStat / FdStat
pchickey Jan 12, 2021
b53aecb
Merge branch 'pch/wiggle_flags_bitflags' into pch/wasi_common_cap_std
pchickey Jan 12, 2021
e7018bf
wiggle flags are now bitflags!
pchickey Jan 12, 2021
0e42c2e
scaffold a scheduler
pchickey Jan 12, 2021
b79bdce
port subscriptions in from old branch
pchickey Jan 12, 2021
81065eb
more scheduler
pchickey Jan 13, 2021
7303793
also expose WasiCtxBuilder
Ekleog Jan 13, 2021
f315611
reserve keys 0, 1 and 2 for stdio
Ekleog Jan 13, 2021
2e035be
make WasiCtxBuilder be an actual builder, allowing to call .build() a…
Ekleog Jan 13, 2021
5d85216
also reexport WasiDir from wasmtime_wasi
Ekleog Jan 13, 2021
20bb4b2
Also reexport Error from wasmtime_wasi
Ekleog Jan 13, 2021
932378e
reexport all the things required to implement WasiDir
Ekleog Jan 13, 2021
28c57c0
Merge pull request #2577 from Ekleog/pr-2487
Jan 13, 2021
e0e205f
ctx builder: fix warnings, test harness
pchickey Jan 13, 2021
8298ce9
clock sub, start with the read sub
pchickey Jan 13, 2021
7beb52a
i guess this is a way to do refs
pchickey Jan 13, 2021
ea94d6f
this is indeed a nice way to do refs!
pchickey Jan 13, 2021
5c8efe8
need Any on WasiFile to upcast for AsRawFd
pchickey Jan 14, 2021
4b39a14
fix tests in pipe
pchickey Jan 14, 2021
9a1ce1a
TEMPORARY: inherit stdio for the wasi ctx
pchickey Jan 15, 2021
7d7acc4
poll_oneoff test: outline assertions
pchickey Jan 15, 2021
f667263
TEMPORARY: poll_oneoff test uses CLOCKID_REALTIME instead of MONOTONIC
pchickey Jan 15, 2021
b84c4d7
poll_oneoff test: if you subscribe to a badf, the whole call fails wi…
pchickey Jan 15, 2021
7f7a0be
wasi-c2: implement a synchronous poll_oneoff in terms of yanix
pchickey Jan 15, 2021
657024b
latest system-interface provides ReadReady::num_ready_bytes
pchickey Jan 19, 2021
21713d3
Revert "TEMPORARY: poll_oneoff test uses CLOCKID_REALTIME instead of …
pchickey Jan 19, 2021
016ed89
poll now handles monotonic clocks, not system clocks
pchickey Jan 19, 2021
f3e40e2
restructure cap-std impls into their own crate
pchickey Jan 21, 2021
7ec0363
inline only what we need of cap-std/system-interface traits
pchickey Jan 21, 2021
61885b7
stub in windows scheduler, get to some interesting errors
pchickey Jan 21, 2021
fcd00f5
move more deps to cap-std-sync, define own SystemTimeSpec
pchickey Jan 21, 2021
85c3b73
stdio compiles on windows!
pchickey Jan 21, 2021
16b42a5
fix
pchickey Jan 21, 2021
1205688
fix preopen dir to work on windows
pchickey Jan 22, 2021
a46c2ad
split poll tests up, only one requires "real" stdio
pchickey Jan 22, 2021
f1a5dce
change set_fdflags to reopen_with_fdflags
pchickey Jan 22, 2021
69b7352
various stdio fixes
pchickey Jan 22, 2021
9e0d295
use `unsafe` to mark reopen_with_fdflags as having special safety fea…
pchickey Jan 22, 2021
86d369c
inline poll from yanix
pchickey Jan 22, 2021
a06c4fb
make a pipe filetype, reorder filetype enum
pchickey Jan 22, 2021
1d8070b
wasi-c2: completely redo how errors work
pchickey Jan 22, 2021
423973a
push the error types conversion all the way through
pchickey Jan 22, 2021
19254bf
error mapping for windows!
pchickey Jan 22, 2021
2b70ea8
windows scheduler passes tests
pchickey Jan 23, 2021
634e911
tests: directory seeking is actually prohibited! but the test was wrong
pchickey Jan 25, 2021
957c434
ErrorExt: trap convenience method
pchickey Jan 25, 2021
17a82c5
table: fix up errnos. trap on internal failures.
pchickey Jan 25, 2021
7fd3d58
enumerate windows test failures, move the file
pchickey Jan 25, 2021
2c6bde5
elaborate!
pchickey Jan 25, 2021
72b207d
path_link: some improvements required by windows
pchickey Jan 25, 2021
a842612
kick the can
pchickey Jan 25, 2021
144ca2f
add a test of symlink happy path to isolate the windows failure
pchickey Jan 25, 2021
996d49c
nofollow test: permit ACCES as well as LOOP when opening with nofollow
pchickey Jan 25, 2021
b0b263f
find a symlink error
pchickey Jan 25, 2021
8f4feca
interesting paths: loosen up errno requirements
pchickey Jan 25, 2021
42ccb11
cap-std is going to use winerror::ERROR_STOPPED_ON_SYMLINK
pchickey Jan 26, 2021
a993090
fix warning
pchickey Jan 26, 2021
fded424
Dir::hard_link: dont support symlink following
pchickey Jan 26, 2021
17f43d4
path_link test: we no longer support symlink following
pchickey Jan 26, 2021
f4a6b95
notes
pchickey Jan 26, 2021
c98d6f6
fix warning
pchickey Jan 26, 2021
1eb8a8a
integrate GetSetFdFlags!
pchickey Jan 26, 2021
8cd21ee
elaborate
pchickey Jan 26, 2021
220509f
latest system-interface
pchickey Jan 27, 2021
6fcbd3f
split path_filestat test into two, improve variable names
pchickey Jan 27, 2021
b2e0597
narrow the bug
pchickey Jan 27, 2021
6c0f312
fix bug: i was ignoring the symlink follow flag in path_filestat_{get,
pchickey Jan 27, 2021
d1160cb
split path rename trailing slash test into files and dirs
pchickey Jan 27, 2021
cb17171
various windows test notes
pchickey Jan 27, 2021
4f2696f
more docs
pchickey Jan 28, 2021
4f65500
make a macro that automates errno assertions
pchickey Jan 28, 2021
2ae1dee
convert all errno assertions to assert_errno!
pchickey Jan 28, 2021
be108c7
will this work for platform-specific errnos? WIP
pchickey Jan 28, 2021
03466d0
temporarily use my branch of the wasi crate
pchickey Jan 28, 2021
6f85abd
itsp ublished
pchickey Jan 28, 2021
7ffe3c7
config is lazy_static to amoritze it
pchickey Jan 28, 2021
bbbe168
ctx: i guess we need environment variables!
pchickey Jan 28, 2021
e758318
wire env variables through test runner to TESTCONFIG
pchickey Jan 28, 2021
f7403ac
fd_advise test: set size via fd_filestat_set_size and fd_allocate
pchickey Jan 28, 2021
20e9169
fd_allocate: put meat of test behind a guard
pchickey Jan 28, 2021
1196e21
fix macro by denying trailing slashes. also other stuff
pchickey Jan 28, 2021
dae022b
woo
pchickey Jan 28, 2021
79e8f17
bum bum bum
pchickey Jan 28, 2021
0cedc17
another one bites the dust
pchickey Jan 28, 2021
4801ea0
cool
pchickey Jan 28, 2021
34ad8df
dangling directories are a windows thing
pchickey Jan 28, 2021
11b8222
missed a dangling symlink
pchickey Jan 28, 2021
201a888
dirty fuckin' dangles boys
pchickey Jan 28, 2021
1d057af
notes
pchickey Jan 28, 2021
d628677
move test failures into ignores in build.rs
pchickey Jan 28, 2021
dd00520
delete wasi-common, yanix, winx
pchickey Jan 28, 2021
47fec44
move wasi-c2 into wasi-common
pchickey Jan 28, 2021
9bd89ab
rename everything c2 related to the "real" names
pchickey Jan 28, 2021
ef2cb7b
nearly have snapshot 0 implemented...
pchickey Jan 29, 2021
d738a4a
preview 0: copy bodies of read, write, and poll_oneoff from snapshot 1
pchickey Jan 29, 2021
c8e76b1
wasmtime-wasi: support both snapshots
pchickey Jan 29, 2021
70f8288
wasmtime-wiggle: take an Rc<RefCell<ctx>> instead of construct one
pchickey Jan 29, 2021
e498888
hook run command up to both wasi snapshots
pchickey Jan 29, 2021
11821e5
Merge remote-tracking branch 'origin/main' into pch/wasi_common_cap_std
pchickey Jan 29, 2021
8b285ec
make wasmtime_wasi::Wasi a struct which does both snapshots!
pchickey Jan 29, 2021
d5fdd83
port bench-api
pchickey Jan 29, 2021
d3ba69d
wasi-common no longer contains code derived from cloudabi-utils
pchickey Jan 29, 2021
6a5d4b9
docs
pchickey Jan 29, 2021
b48e7fc
integrate with c-api
pchickey Jan 29, 2021
8ea42ab
fix wasi-nn and wasi-crypto integrations for wasmtime-wiggle changes
pchickey Jan 29, 2021
2ad7565
update linking example
pchickey Jan 29, 2021
5ee6059
fix wasi example
pchickey Jan 29, 2021
897b4fb
wasictxbuilder: assert that stdio is provided
pchickey Jan 29, 2021
2e10e62
stub virtfs
pchickey Jan 30, 2021
95ad13c
wasi-common: break dep on system-interface by defining our own Advice…
pchickey Jan 30, 2021
d8f3a62
dont try to make a virtfs today. instead, delete virtfs example.
pchickey Jan 30, 2021
1af7659
wasi-nn CI: use the same nightly as rest of file
pchickey Jan 30, 2021
f40b9d8
Merge branch 'pch/wasinn-fix-nightly' into pch/wasi_common_cap_std
pchickey Jan 30, 2021
6ed8638
fix test runtime
pchickey Jan 30, 2021
b5f3a4a
wasi-crypto: forgot to erase ctx indirection
pchickey Jan 30, 2021
8313a62
fix test
pchickey Jan 30, 2021
e1ca5d1
fix the second place i made the same dumb typo
pchickey Jan 30, 2021
3d406ff
Dir::open_file can just pass read/write as bools, centralizing FileCa…
pchickey Jan 30, 2021
e9a7a40
cap-std-sync Dir::open_file: set the fdflags that OpenOptions cant
pchickey Jan 30, 2021
c12cd82
careful now
pchickey Jan 30, 2021
e940d31
add a noent / not_found errorkind
pchickey Jan 30, 2021
b6cd7d8
cap-std-sync: export ctx components
pchickey Jan 30, 2021
533db3e
virtfs: implement a bunch more
pchickey Jan 30, 2021
fcecb3f
test-programs: test both cap-std-sync and virtfs backend
pchickey Jan 30, 2021
91a311e
delete
pchickey Jan 30, 2021
321bf27
check in virtfs backend test harness
pchickey Jan 30, 2021
133344e
woo it passes six tests even though its awful
pchickey Jan 30, 2021
ac60b03
well this much passes
pchickey Jan 30, 2021
92e1949
doh
pchickey Feb 1, 2021
bad169d
port https://github.com/bytecodealliance/wasmtime/pull/2620 into rewrite
pchickey Feb 1, 2021
8b9d2c5
cap-std-sync: my set_fd_flags idea didnt seem to work?
pchickey Feb 1, 2021
a4372c8
cap-std-sync: test opening a tempdir as ambient and then WasiDir
pchickey Feb 1, 2021
5ee093e
Merge remote-tracking branch 'origin/main' into pch/wasi_common_cap_std
pchickey Feb 1, 2021
993697e
set_fd_flags is only good for append and nonblock
pchickey Feb 1, 2021
cde252c
wasi-cap-std-sync: sync family of flags is not supported on file_open
pchickey Feb 1, 2021
40e541b
test suite: cap-std-sync test environment does not support fdflags sync
pchickey Feb 1, 2021
b9a3f86
cap-std-sync test runner: read stdin to end before inheriting stdio
pchickey Feb 1, 2021
0c4aec3
actually empty ready bytes of stdin
pchickey Feb 1, 2021
bb3e391
accept fdread event as valid behavior of stdin poll
pchickey Feb 1, 2021
8e015ca
traps needed stdio
pchickey Feb 1, 2021
848be8c
path_rename should work on windows with TESTCONFIG
pchickey Feb 1, 2021
e9ad361
get rid of outdated cfg_attr
pchickey Feb 2, 2021
f17bff5
fill in Deterministic impl of RngCore
pchickey Feb 2, 2021
30c5e8c
DEBUG: turn off fail-fast for wasmtime build matrix, and test wasi-ca…
pchickey Feb 2, 2021
7919b19
fix tests and exports
pchickey Feb 2, 2021
037c5e3
remove re-exports
pchickey Feb 2, 2021
e511dac
rustdoc the table
pchickey Feb 2, 2021
0ef691b
rustdocs!!
pchickey Feb 2, 2021
7daa776
rustdoc the errors
pchickey Feb 2, 2021
58aa98a
cap-std-sync docs
pchickey Feb 2, 2021
b59160c
docs!
pchickey Feb 2, 2021
d83dba4
fix publish script
pchickey Feb 2, 2021
c77a11b
tests: macos-specific behavior
pchickey Feb 2, 2021
a29b5bd
dep to latest, lockfile already has it
pchickey Feb 2, 2021
f48b457
remove dead comment
pchickey Feb 2, 2021
e385075
this windows test should be fixed...
pchickey Feb 2, 2021
544a491
fail-fast false on the other matrix too
pchickey Feb 2, 2021
ca65718
fix wasmtime doctest
pchickey Feb 2, 2021
80fce7c
unlink behavior on macos...
pchickey Feb 2, 2021
dec0038
add a readdir unit test to wasi-cap-std-sync
pchickey Feb 2, 2021
47a89d3
cargo update. wanted the latest `cap-primitives`
pchickey Feb 2, 2021
330902f
add test for incredibly cursed windows rename behavior
pchickey Feb 2, 2021
a06b23a
even simpler test case
pchickey Feb 2, 2021
186360f
delete temporary tests
pchickey Feb 2, 2021
cd02e5a
path_rename: make more concessions for windows. this shit sucks but o…
pchickey Feb 2, 2021
857ef41
upstream fixes are pending for symlink_create & nofollow_errors on wi…
pchickey Feb 3, 2021
b29a3bf
fix warnings
pchickey Feb 3, 2021
d62b0a1
table keys can wrap around
pchickey Feb 3, 2021
b382a1e
back out wasi-cap-std-sync special test step
pchickey Feb 3, 2021
a9639e5
publish script: tell me more about the failure please
pchickey Feb 3, 2021
7a35763
collapse two test flags into dangling_filesystem
pchickey Feb 3, 2021
3114506
remove virtfs - it is not suitable for use
pchickey Feb 3, 2021
bc1992b
cap-std 0.13
pchickey Feb 3, 2021
1a45096
wasi-common, wasi-cap-std-sync, wasmtime-wasi should all be published…
pchickey Feb 3, 2021
e670c46
system-interface 0.6
pchickey Feb 4, 2021
c8ca639
new cap-std apis fix some windows tests!
pchickey Feb 4, 2021
72a8f92
cap-primitives bump fixes windows bugs
pchickey Feb 4, 2021
e2b67aa
simplify life for readdir implementors
pchickey Feb 4, 2021
3526145
wasi-common 0.13.2
pchickey Feb 4, 2021
5ff9578
wasi-common: WASI/phases is included in the package
pchickey Feb 4, 2021
4681e18
will this fix it?
pchickey Feb 4, 2021
c535b94
theres the bug
pchickey Feb 4, 2021
21a1307
latest cap-std 0.13.3 fixes windows bug
pchickey Feb 5, 2021
6fb2c29
remove development scaffolding
pchickey Feb 5, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions crates/wasi-common/src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ impl Table {

/// Insert a resource at the next available index.
pub fn push(&mut self, a: Box<dyn Any>) -> Result<u32, Error> {
// NOTE: The performance of this new key calculation could be very bad once keys wrap
// around.
if self.map.len() == u32::MAX as usize {
pchickey marked this conversation as resolved.
Show resolved Hide resolved
return Err(Error::trap("table has no free keys"));
}
loop {
let key = self.next_key;
// XXX this is not correct. The table may still have empty entries, but our
// linear search strategy is quite bad
self.next_key = self
.next_key
.checked_add(1)
.ok_or_else(|| Error::trap("out of keys in table"))?;
self.next_key = self.next_key.wrapping_add(1);
if self.map.contains_key(&key) {
continue;
}
Expand Down