Commit Graph

35 Commits

Author SHA1 Message Date
Dan Gohman
a76639c6fb Wasmtime 0.17.0 and Cranelift 0.64.0. (#1805) 2020-06-02 18:51:59 -07:00
Jakub Konka
348be6f3ed Revert fstatat on *nix and test symlinks in path_filestat calls (#1725)
* Revert fstatat on *nix and test symlinks in path_filestat calls

This commit effectively reverts too eager refactoring on my part which
resulted in incorrect `path_filestat_{get, set_times}` behaviour on
*nix hosts. In the presence of symlinks, neither of the calls would
work properly.

In order to shield ourselves from similar errors in the future, I've
augmented the `path_filestat` test cases with symlink checks as well.

* Pass appropriate flags to fstatat and utimensat

* Fix formatting

* Fix Windows build

* Expand final symlinks if follow is set on Windows

* Fix formatting

* Do not follow symlinks unless specified on Windows

* Update comments and restart CI

* Skip testing volatile atim field
2020-05-20 12:02:24 -07:00
Dan Gohman
864cf98c8d Update release notes, wasmtime 0.16, cranelift 0.63. 2020-04-29 17:30:25 -07:00
Dan Gohman
fde5ddf159 Fixes for 0.15 (#1449)
* Wasmtime 0.15.0 and Cranelift 0.62.0. (#1398)

* Bump more ad-hoc versions.

* Add build.rs to wasi-common's Cargo.toml.

* Update the env var name in more places.

* Remove a redundant echo.
2020-04-03 13:13:37 -07:00
Marcin Mielniczuk
f6e3ab03a2 Implement path_link for Windows. (#1199)
Implement path_link for Windows.
2020-04-03 21:24:38 +02:00
Dan Gohman
092538cc54 Test 0.14 (#1417)
* Bump Wasmtime to 0.14.0.

* Update the publish script for the wiggle crate wiggle.

* More fixes.

* Fix lightbeam depenency version.

* cargo update

* Cargo update wasi-tests too.

And add cargo update to the version-bump scripts.
2020-03-26 21:53:42 -07:00
Dan Gohman
6fa9be7767 Wasmtime 0.13.0 and Cranelift 0.61.0. (#1398)
This also updates the publishing scripts to work with newly added
and reorganized crates.
2020-03-26 13:19:02 -07:00
Marcin Mielniczuk
c50c24e699 Path symlink follow (#1284)
* Fix the tests for correctly following symlinks.

* Correctly follow symlinks in path_link.
2020-03-20 11:59:16 -07:00
iximeow
7e0d9decbf Virtual file support (#701)
* Add support for virtual files (eg, not backed by an OS file).

Virtual files are implemented through trait objects, with a default
implementation that tries to behave like on-disk files, but entirely
backed by in-memory structures.

Co-authored-by: Dan Gohman <sunfish@mozilla.com>
2020-03-06 11:08:13 -08:00
Alex Crichton
33a39ff4f0 Bump to 0.12.0 (#997)
* Bump to 0.12.0

* Another lockfile update
2020-02-26 16:19:12 -06:00
Peter Huene
ef6e1ca2a8 Merge pull request #552 from marmistrz/poll
Minimal viable implementation of poll_oneoff for Windows
2020-01-23 09:30:21 -08:00
Marcin Mielniczuk
815576edc5 Return EINVAL in poll_oneoff with no events. (#838)
* Return EINVAL in poll_oneoff with no events.

We adhere to WebAssembly/WASI#193.

* Add a test for empty poll.
2020-01-17 13:41:37 -08:00
Marcin Mielniczuk
b2c63290dd Merge remote-tracking branch 'upstream/master' into poll 2020-01-14 16:40:23 +01:00
Alex Crichton
420dcd76fd Don't require Store in Instance constructor (#810)
* Don't require `Store` in `Instance` constructor

This can be inferred from the `Module` argument. Additionally add a
`store` accessor to an `Instance` in case it's needed to instantiate
another `Module`.

cc #708

* Update more constructors

* Fix a doctest

* Don't ignore store in `wasm_instance_new`

* Run rustfmt
2020-01-13 17:50:57 -06:00
Dan Gohman
336ee94c89 Bump version to 0.9.0 (#790) 2020-01-09 21:57:40 -08:00
Peter Huene
4b7677e4da Additional PR feedback changes.
* Add more comments.
* Use `contains` from bitflags.
* Format wasi-test source.
* Remove permission check from Windows `path_open` impl.
2020-01-09 17:13:21 -08:00
Peter Huene
1c4c78ab03 Add the Cargo.lock for the test programs. 2020-01-09 17:13:21 -08:00
Peter Huene
8fdd776f81 Implement fd_fdstat_set_flags for Windows.
This commit implements `fd_fdstat_set_flags` for Windows.

Additionally, it fixes a problem where `O_APPEND` was not working correctly
because `GENERIC_WRITE` was always being set; as a result, `FILE_WRITE_DATA`
could not be removed from the permission set to properly enable append-only
mode.

It also treats `O_TRUNC` with `O_APPEND` as an invalid argument error.  This is
because Windows cannot support these two flags together. To support `O_TRUNC`,
the `GENERIC_WRITE` bit must be set for the file access flags.  Setting this
bit will cause `FILE_WRITE_DATA` to be set, which will not properly treat the
file as append-only (it requires `FILE_APPEND_DATA` without `FILE_WRITE_DATA`).
2020-01-09 17:13:21 -08:00
Jakub Konka
036fd8ead5 Fix path_open_read_without_rights test
Fixes `path_open_read_without_rights` test making the CI green again.
2020-01-09 21:16:31 +01:00
Marcin Mielniczuk
f7f10c12b3 Fix rights checks across the codebase.
* Fix path_open granting more rights than requested
* Add missing rights checks in: fd_fdstat_set_flags, fd_filestat_get, poll_oneoff
* Fix `open_scratch_directory` not requesting any rights.
* Properly request needed rights in various tests
* Add some extra trace-level logging
* Remove a no-op restriction of rights to the ones returned by
  `determine_type_rights`. It was redundant, because `FdEntry:from`
  internally also called `determine_type_rights` and only dropped some of them.
2020-01-09 10:01:01 -08:00
Marcin Mielniczuk
5efa640e23 Add a test for path_open read rights 2020-01-09 10:01:01 -08:00
Marcin Mielniczuk
0b50274680 WIP 2020-01-09 18:46:03 +01:00
Marcin Mielniczuk
54a398ad69 Fix writing timeout events. Check that we only return one timeout event. 2020-01-09 18:46:03 +01:00
Jakub Konka
51f3ac0c45 Update WASI tests to use wasi crate v0.9.0 (#743)
This commit updates _all_ WASI test programs to use the latest
version of the `wasi` crate (`v0.9.0`). While at it, it also
unifies asserting error conditions across all test programs.
2019-12-24 13:04:14 -08:00
Alex Crichton
d641e6e7b0 Update some more wasi test programs to 0.9.0
Largely the same as the previous update!
2019-12-13 17:27:59 +01:00
Alex Crichton
e13fabb276 Start to update the wasi crate in wasi tests (#675)
* Move `wasi` to `wasi_old` in wasi-tests

Leave space for the new `wasi` crate but allow us to incrementally
update tests.

* Update the big_random_buf test

* Update clock_time_get test

* Update close_preopen test

* Review comments

* Update to latest Wasmtime API
2019-12-09 13:08:47 +01:00
Jakub Konka
45f41b3c8e Deny warnings in the CI by default (#616)
* Deny warnings in the CI by default

This commit passes `-D warnings` flag to `rustc` in the Test stage
of the CI in order to deny warnings on _all_ tested platforms.

* Fix warnings

* Fix warnings
2019-12-04 17:43:36 +01:00
Dan Gohman
1f9d764d5d Support fd_fdstat_get and fd_renumber on stdin/stdout/stderr (#631)
* Support fd_fdstat_get on stdin/stdout/stderr.

Add a routine for obtaining an `OsFile` containing a file descriptor for
stdin/stdout/stderr so that we can do fd_fdstat_get on them.

* Add a testcase for fd_fdstat_get etc. on stdin etc.

* Don't dup file descriptors in fd_renumber.

* Fix compilation on macOS

* Rename OsFile to OsHandle

This commits renames `OsFile` to `OsHandle` which seems to make
more sense semantically as it is permitted to hold a valid OS handle
to OS entities other than simply file/dir (e.g., socket, stream, etc.).
As such, this commit also renames methods on `Descriptor` struct
from `as_actual_file` to `as_file` as this in reality does pertain
ops on FS entities such as files/dirs, and `as_file` to `as_os_handle`
as in this case it can be anything, from file, through a socket, to
a stream.

* Fix compilation on Linux

* Introduce `OsHandleRef` for borrowing OS resources.

To prevent a `ManuallyDrop<OsHandleRef>` from outliving the resource it
holds on to, create an `OsHandleRef` class parameterized on the lifetime
of the `Descriptor`.

* Fix scoping to pub-priv and backport to snapshot_0
2019-11-28 14:36:18 +01:00
Marcin Mielniczuk
b69758f672 Correctly handle possibly misaligned pointers in readdir (#615) 2019-11-27 19:11:32 -08:00
Peter Huene
0cf54ffeba Implement __wasi_fd_fdstat_get for Windows.
This commit fully implements `__wasi_fd_fdstat_get` on Windows so that
the descriptor flags can be determined.

It does this by calling into `NtQueryInformationFile` (safe to call from
user mode) to get the open mode and access of the underlying OS handle.

`NtQueryInformationFile` isn't included in the `winapi` crate, so it is
manually being linked against.

This commit also fixes several bugs on Windows:

* Ignore `__WASI_FDFLAG_NONBLOCK` by not setting `FILE_FLAG_OVERLAPPED`
  on file handles (the POSIX behavior for `O_NONBLOCK` on files).
* Use `FILE_FLAG_WRITE_THROUGH` for the `__WASI_FDFLAG_?SYNC` flags.
* `__WASI_FDFLAG_APPEND` should disallow `FILE_WRITE_DATA` access to
  force append-only on write operations.
* Use `GENERIC_READ` and `GENERIC_WRITE` access flags.  The
  latter is required when opening a file for truncation.
2019-11-26 22:24:12 +01:00
Jakub Konka
7d7360b32d Move dangling_fd test case into test-programs (#590)
* Move dangling_fd test case in test-programs

* Fix build errors
2019-11-19 12:20:47 +01:00
Jakub Konka
5edbd9b967 Test path_open O_EXCL behaviour 2019-11-15 23:18:52 +01:00
Dan Gohman
c5f998add2 Update the crates.io publishing scripts (#580)
* Fix fuzz target compilation.

* Bump version to 0.7.0

* Temporarily disable fuzz tests

Temporarily disable fuzz tests until https://github.com/bytecodealliance/cranelift/issues/1216 is resolved.

* Fix publish-all.sh to not modify the witx crate.

* Remove the "publish = false" attribute from Lightbeam.

* Add a README.md for wasmtime-interface-types.

* Remove the "rust" category.

This fixes the following warning:

warning: the following are not valid category slugs and were ignored: rust. Please see https://crates.io/category_slugs for the list of all category slugs.

* Mark wasmtime-cli as "publish = false".

* Sort the publishing rules in topological order.

Also, publish nightly-only crates with cargo +nightly.
2019-11-15 12:17:19 -08:00
Jakub Konka
3d5b55c095 Fix rights check for fd_pread and fd_pwrite
This commit fixes rights check for `fd_pread` and `fd_pwrite` to be
conformant with the WASI spec. In the spec, it is clearly stated that
the right to invoke `__wasi_fd_pread()` requires a combination of
`__WASI_RIGHT_FD_READ` with `__WASI_RIGHT_FD_SEEK`, and similarly for
`__wasi_fd_pwrite()` the combination is `__WASI_RIGHT_FD_WRITE` with
`__WASI_RIGHT_FD_SEEK`. Relevant link to the spec: [__wasi_rights_t].

[__wasi_rights_t]: https://github.com/WebAssembly/WASI/blob/master/phases/snapshot/docs/wasi_unstable_preview1.md#__wasi_rights_t-uint64_t-bitfield
2019-11-15 20:59:54 +01:00
Dan Gohman
d4fd229e5e Reorganize wasi-misc-tests. (#575)
* Reorganize wasi-misc-tests.

Move wasi-misc-tests out of wasi-common, to break a dependency cycle;
previously, wasmtime-* depended on wasi-common, but wasi-common
dev-dependended on wasmtime-*.

Now, wasi-common no longer dev-depends on wasmtime-*; instead, the
tests are in their own crate which depends on wasi-common and on
wasmtime-*.

Also, rename wasi-misc-tests to wasi-tests for simplicity.

This also removes the "wasm_tests" feature; it's replaced by the
"test-programs" feature.

* Update the CI script to use the new feature name.

* Update the CI script to use the new feature name in one more place.

* Change a `write!` to a `writeln!`.
2019-11-15 08:03:43 -08:00