Commit Graph

7942 Commits

Author SHA1 Message Date
Pat Hickey
bb3e391a27 accept fdread event as valid behavior of stdin poll 2021-02-01 15:26:06 -08:00
Pat Hickey
0c4aec391e actually empty ready bytes of stdin 2021-02-01 14:43:32 -08:00
Pat Hickey
b9a3f8694d cap-std-sync test runner: read stdin to end before inheriting stdio 2021-02-01 14:32:51 -08:00
Pat Hickey
40e541bfc3 test suite: cap-std-sync test environment does not support fdflags sync 2021-02-01 14:25:42 -08:00
Pat Hickey
cde252c59b wasi-cap-std-sync: sync family of flags is not supported on file_open 2021-02-01 14:25:32 -08:00
Pat Hickey
993697e221 set_fd_flags is only good for append and nonblock 2021-02-01 14:14:13 -08:00
Pat Hickey
5ee093e774 Merge remote-tracking branch 'origin/main' into pch/wasi_common_cap_std 2021-02-01 13:21:25 -08:00
Pat Hickey
a4372c8c2e cap-std-sync: test opening a tempdir as ambient and then WasiDir 2021-02-01 13:15:39 -08:00
Pat Hickey
8b9d2c5bbb cap-std-sync: my set_fd_flags idea didnt seem to work? 2021-02-01 12:42:31 -08:00
Peter Huene
256cc8a518 Merge pull request #2620 from peterhuene/fix-fd-readdir
Fix `fd_readdir` to properly truncate directory entry names.
2021-02-01 12:29:56 -08:00
Peter Huene
0502cadc62 Stop allowing bufused > BUF_LEN in fd_readdir program.
This commit removes what appears to be a workaround to the bug being fixed by
the change in #2620.
2021-02-01 11:41:29 -08:00
Peter Huene
4632228b35 Fix fd_readdir to properly truncate directory entry names.
Previously, `fd_readdir` was truncating directory entry names based on the
calculation of `min(name_len, buf_len - bufused)`, but `bufused` was not being
updated after writing in the `dirent` structure to the buffer.

This allowed `bufused` to be incremented beyond `buf_len` and returned as the
number of bytes written to the buffer, which is invalid.

This fix adjusts `bufused` when the buffer is written to for the `dirent` so
that name truncation happens as expected.

Fixes #2618.
2021-02-01 11:41:12 -08:00
Pat Hickey
bad169dde3 port https://github.com/bytecodealliance/wasmtime/pull/2620 into rewrite 2021-02-01 11:10:26 -08:00
Alex Crichton
cb7b1aadcc Fix a memory leak with command modules (#2017)
This commit fixes a memory leak that can happen with `Linker::module`
when the provided module is a command. This function creates a closure
but the closure closed over a strong reference to `Store` (and
transitively through any imports provided). Unfortunately a `Store`
keeps everything alive, including `Func`, so this meant that `Store` was
inserted into a cycle which caused the leak.

The cycle here is manually broken by closing over the raw value of each
external value rather than the external value itself (which has a
strong reference to `Store`).
2021-02-01 13:04:27 -06:00
Pat Hickey
92e1949944 doh 2021-02-01 11:01:41 -08:00
Pat Hickey
23b8c6be79 wasi-nn CI: use the same nightly as rest of file (#2624)
in particular, this 2020-08-25 fails to build `posish 0.5.9` which is
a dep in PR #2487. But there's no reason for this to be lagging
behind...
2021-02-01 10:22:59 -06:00
bjorn3
81b4e48f9f Remove some uses of riscv in tests (#2600)
* Remove some uses of riscv in tests

* Fix typo

* Apply suggestions from code review

* Apply suggestions from code review

Co-authored-by: Benjamin Bouvier <public@benj.me>
2021-01-30 23:54:48 +01:00
Pat Hickey
ac60b034f0 well this much passes 2021-01-30 13:58:30 -08:00
Pat Hickey
133344e880 woo it passes six tests even though its awful 2021-01-30 13:54:34 -08:00
Pat Hickey
321bf27292 check in virtfs backend test harness 2021-01-30 13:45:21 -08:00
Pat Hickey
91a311e37e delete 2021-01-30 13:44:54 -08:00
Pat Hickey
fcecb3fea6 test-programs: test both cap-std-sync and virtfs backend 2021-01-30 13:39:18 -08:00
Pat Hickey
533db3e807 virtfs: implement a bunch more 2021-01-30 13:39:03 -08:00
Pat Hickey
b6cd7d84ad cap-std-sync: export ctx components 2021-01-30 13:38:44 -08:00
Pat Hickey
e940d31f95 add a noent / not_found errorkind 2021-01-30 13:36:41 -08:00
Chris Fallin
3e38fb984a Merge pull request #2626 from bnjbvr/x64-new-iset-requirements
cranelift x64: add instruction set checks for popcnt/tzcnt/lzcnt
2021-01-30 10:39:31 -08:00
Benjamin Bouvier
13027ad670 cranelift x64: add instruction set checks for popcnt/tzcnt/lzcnt; 2021-01-30 13:38:55 +01:00
Pat Hickey
c12cd82fc0 careful now 2021-01-29 21:19:24 -08:00
Pat Hickey
e9a7a4094c cap-std-sync Dir::open_file: set the fdflags that OpenOptions cant 2021-01-29 21:08:53 -08:00
Pat Hickey
3d406ff50e Dir::open_file can just pass read/write as bools, centralizing FileCaps decoding
this way the impls of File/Dir don't need to know about any caps!
2021-01-29 21:04:34 -08:00
Pat Hickey
e1ca5d171c fix the second place i made the same dumb typo 2021-01-29 20:58:00 -08:00
Pat Hickey
8313a62e46 fix test 2021-01-29 19:54:27 -08:00
Pat Hickey
b5f3a4a6db wasi-crypto: forgot to erase ctx indirection 2021-01-29 19:53:19 -08:00
Pat Hickey
6ed8638559 fix test runtime 2021-01-29 18:01:48 -08:00
Pat Hickey
f40b9d8a5e Merge branch 'pch/wasinn-fix-nightly' into pch/wasi_common_cap_std 2021-01-29 18:00:59 -08:00
Pat Hickey
1af7659a4d wasi-nn CI: use the same nightly as rest of file
in particular, this 2020-08-25 fails to build `posish 0.5.9` which is
a dep in PR #2487. But there's no reason for this to be lagging
behind...
2021-01-29 17:59:37 -08:00
Pat Hickey
d8f3a62b32 dont try to make a virtfs today. instead, delete virtfs example. 2021-01-29 17:27:05 -08:00
Pat Hickey
95ad13c82d wasi-common: break dep on system-interface by defining our own Advice enum 2021-01-29 17:03:08 -08:00
Pat Hickey
2e10e621c4 stub virtfs 2021-01-29 17:02:57 -08:00
Pat Hickey
897b4fb8ab wasictxbuilder: assert that stdio is provided 2021-01-29 15:48:55 -08:00
Pat Hickey
5ee605995d fix wasi example 2021-01-29 15:43:30 -08:00
Pat Hickey
2ad7565a65 update linking example 2021-01-29 15:39:29 -08:00
Pat Hickey
8ea42abb14 fix wasi-nn and wasi-crypto integrations for wasmtime-wiggle changes
the Rc<RefCell<ctx>> wrapping inside the wasmtime-generated bindings
was eliminated, and instead the caller of ::new(linker, ctx) is
required to wrap the ctx in Rc<RefCell<>>.

The Rc wrapping inside WasiCryptoCtx can be eliminated due to this
change.
2021-01-29 14:25:47 -08:00
Pat Hickey
b48e7fcc5d integrate with c-api 2021-01-29 14:09:44 -08:00
Pat Hickey
6a5d4b9993 docs 2021-01-29 13:31:30 -08:00
Pat Hickey
d3ba69d865 wasi-common no longer contains code derived from cloudabi-utils
the original C implementation was derived directly from cloudabi-utils.
that implementation is no longer in tree.

acfoltzer's initial Rust implementation included a path_open function
that was ported from cloudabi-utils. this rewrite of wasi-common has
completely delegated all path lookup functionality to cap-std (in the
cap-std-sync impls), and cap-std itself has a completely re-designed
method of path resolution.
2021-01-29 13:28:13 -08:00
Pat Hickey
d5fdd835ab port bench-api 2021-01-29 13:25:06 -08:00
Pat Hickey
8b285ec2e7 make wasmtime_wasi::Wasi a struct which does both snapshots! 2021-01-29 13:23:04 -08:00
Pat Hickey
11821e5bfd Merge remote-tracking branch 'origin/main' into pch/wasi_common_cap_std 2021-01-29 12:38:13 -08:00
Pat Hickey
e498888732 hook run command up to both wasi snapshots
sharing the same context! at long last
2021-01-29 12:29:30 -08:00