Commit Graph

1294 Commits

Author SHA1 Message Date
Pat Hickey
f663045563 better arg names 2020-12-18 16:57:15 -08:00
Pat Hickey
8672dce541 open_file requires the FdFlags 2020-12-18 16:56:58 -08:00
Pat Hickey
a33418c34a path_filestat: remove expectation that rights_inheriting describes subdirs
if inheriting rights are for files (not subdirs) then this is incorrect.

if inheriting rights are for subdirs too, then we need to change the
implementation.
2020-12-18 16:34:25 -08:00
Pat Hickey
c1919259dc implement fd_readdir 2020-12-18 16:13:29 -08:00
Pat Hickey
af0aa14ee8 get a FileStat of a Dir
and fill out some remaining DirCaps from Rights
2020-12-18 16:13:10 -08:00
Pat Hickey
8cc1ab7720 fixup filetype nonsense
tried to go my own way here, bad idea, stick to the design of wasi buddy
2020-12-18 12:30:40 -08:00
Pat Hickey
82edae32b7 readlink 2020-12-18 11:33:28 -08:00
Pat Hickey
f6afd4c41c test-programs: sandbox escape is an EPERM now, not an ENOTCAPABLE 2020-12-17 18:12:29 -08:00
Pat Hickey
d8720cffe8 unexpected io error: do our best based on e.kind() 2020-12-17 18:12:15 -08:00
Pat Hickey
f9ff97aac1 virt pipes: return concrete errors, best effort at flags and filestat 2020-12-17 17:48:46 -08:00
Pat Hickey
4c3c9a9ecb Filestat: make times optional, default to 0 at wasi interface
this is DRY
2020-12-17 17:29:35 -08:00
Pat Hickey
8ac688287e fixup dir/file caps into rights 2020-12-17 17:29:00 -08:00
Pat Hickey
4bee07d6f9 Merge pull request #2520 from bytecodealliance/pch/prune_deps
Prune deps, comment deny.toml
2020-12-17 15:33:38 -08:00
Pat Hickey
fb78025e41 upgrade all wasmparser to 0.71
new simd instructions are left as ubsupported in cranelift-wasm
2020-12-17 14:49:13 -08:00
David Haynes
02260b7cd0 2499: First pass on TableOps fuzzer generator wasm_encoder migration (#2501)
* 2499: First pass on TableOps fuzzer generator wasm_encoder migration

- wasm binary generated via sections and smushed together into a module
- test: compare generated wat against expected wat
- note: doesn't work
  - Grouped instructions not implemented
  - Vec<u8> to wat String not implemented

* 2499: Add typesection, abstract instruction puts, and update test

- TableOp.insert now will interact with a function object directly
- add types for generated function
- expected test string now reflects expected generated code

* 2499: Mark unused index as _i

* 2499: Function insertion is in proper stack order, and fix off by 1
      index

- imported functions must be typed
- instructions operate on a stack ie. define values as instructions
  before using

* 2499: Apply suggestions from code review

- typo fixing
- oracle ingests binary bytes itself

Co-authored-by: Nick Fitzgerald <fitzgen@gmail.com>

* 2499: Code cleanup + renaming vars

- busywork, nothing to see here

Co-authored-by: Nick Fitzgerald <fitzgen@gmail.com>
2020-12-17 15:47:18 -06:00
Pat Hickey
4f5afe92dc wasmtime-debug: tune down features required from object
in order to eliminate a dep on an old wasmparser
2020-12-17 10:59:28 -08:00
Louis Pilfold
6bde8519c1 cargo deny config 2020-12-17 11:09:10 +00:00
Pat Hickey
df0218c086 make get_filestat work
up to 16 tests passing!
2020-12-16 17:54:17 -08:00
Pat Hickey
23b5689a5f fix file rights 2020-12-16 17:19:27 -08:00
Pat Hickey
8777194f0d always open files read if not write
and if creating a file, open it write.
2020-12-16 16:07:23 -08:00
Pat Hickey
af8bdf8933 table: borrow entry immutably or mutably 2020-12-16 15:55:30 -08:00
Pat Hickey
dbe0f4f284 Revert "dangling_fd test: open with either READ or CREAT|WRITE"
fix for behavior in wasi-c2 coming in next commit

This reverts commit 789eec3827.
2020-12-16 15:54:46 -08:00
Pat Hickey
789eec3827 dangling_fd test: open with either READ or CREAT|WRITE
neither READ nor WRITE is an error
2020-12-16 15:16:14 -08:00
Pat Hickey
27ddbda829 preopens with Caps::all, implement create, remove dir, remove file 2020-12-16 15:15:48 -08:00
Sakarias Johansson
22ad43b430 Add filestat_get for stdout, stdin and stderr
This makes fstat work for stdout, stdin and stderr as expected.
This seemed like the only reasonable functions to implement from the
filestat_* set, for stdout, stdin and stderr.

Fixes #2515
2020-12-16 14:33:42 +01:00
Pat Hickey
c0461ca170 redesign how caps fit into entries! 2020-12-15 18:09:36 -08:00
Pat Hickey
b5852bf5ff open_dir can never create a dir 2020-12-15 16:44:03 -08:00
Nick Fitzgerald
cc81570a05 bench-api: Clean up the benchmarking API
Mostly just tweaks to docs/naming/readability/tidying up.

The biggest thing is that the wasm bytes are passed in during compilation now,
rather than on initialization, which lets us remove the lifetime from our state
struct and makes wrangling unsafe conversions that much easier.
2020-12-15 11:21:51 -08:00
Nick Fitzgerald
48b401c6f5 Merge pull request #2437 from abrown/bench-api
Introduce benchmarking API
2020-12-15 09:42:48 -08:00
Ulrich Weigand
fe10cc9d52 Fix jitdump header magic field on big-endian platforms (#2511)
The jitdump header contains a "magic" field that is defined to hold
the value 0x4A695444 as u32 in native endianness.  (This allows
consumers of the file to detect the endianness of the platform
where the file was written, and apply it when reading other fields.)

However, current code always writes 0x4A695444 in little-endian
byte order, even on big-endian system.  This makes consumers fail
when attempting to read files written on big-endian platforms.

Fixed by always writing the magic in native endianness.
2020-12-15 08:44:43 -06:00
whitequark
fc4eeae896 Alias yanix::file::OFlags::RSYNC to SYNC on Android.
Android defines O_RSYNC to be the same as O_SYNC:

35bb46188c/libc/include/fcntl.h (L57)
2020-12-14 22:03:43 -08:00
whitequark
1ec1834d6e Treat Android like Linux in wasi_common::sys::unix.
Just like it happens in `yanix::sys`.
2020-12-14 22:03:43 -08:00
whitequark
476ee59774 Define local seekdir and telldir prototypes on Android.
These functions are not yet defined in the `libc` crate.
See https://github.com/rust-lang/libc/pull/1996.
2020-12-14 22:03:43 -08:00
whitequark
919600d10b Stub out the utimesat emulation logic on Android.
Android always has `utimensat` available, so it is not necessary (or
possible, for that matter) to emulate it. Mark the fallback path as
`unreachable!()`.
2020-12-14 22:03:43 -08:00
Pat Hickey
04805fcc5f pass a test, dubiously 2020-12-14 19:48:30 -08:00
Pat Hickey
c16e731455 get rid of linker Rc cycle, and add debug info to test programs 2020-12-14 17:15:03 -08:00
Pat Hickey
7ec9aac39f Merge remote-tracking branch 'origin/main' into pch/wasi_common_cap_std 2020-12-14 16:17:10 -08:00
Alex Crichton
2d7c2fba5f Update wasm-smith (#2509)
Brings in a few bug fixes for generating module-linking modules
2020-12-14 13:39:38 -06:00
Nick Fitzgerald
ed971fcfcc Merge pull request #2505 from alexcrichton/fix-reserve-bug
Fix a memory reservation bug in `reserve_modules`
2020-12-14 10:12:46 -08:00
Alex Crichton
42adeba65d Fix fuzzer expectation about valid modules
Recent changes to fuzzers made expectations more strict about handling
errors while fuzzing, but this erroneously changed a module compilation
step to always assume that the input wasm is valid. Instead a flag is
now passed through indicating whether the wasm blob is known valid or
invalid, and only if compilation fails and it's known valid do we panic.
2020-12-14 08:31:46 -08:00
Alex Crichton
c83dee07b7 Fix a memory reservation bug in reserve_modules
This method attempted to reserve space in the `results` list of final
modules. Unfortunately `results.reserve(nmodules)` isn't enough here
because this can be called many times before a module is actually
finished and pushed onto the vector. The attempted logic to work around
this was buggy, however, and would simply trigger geometric growth on
every single reservation because it erroneously assumed that a
reservation would be exactly met.

This is fixed by avoiding looking at the vector's capacity and instead
keeping track of modules-to-be in a side field. This is the incremented
and passed to `reserve` as it represents the number of modules that will
eventually make their way into the result vector.
2020-12-14 07:57:47 -08:00
Pat Hickey
1b8f9fd377 use virtual stdio
which works except for the lifetime issues, i think the trap still holds
an Rc to the store?
2020-12-11 18:22:13 -08:00
Pat Hickey
0572b40f58 port read and write pipes in 2020-12-11 17:54:32 -08:00
Pat Hickey
759455192b test-programs: learn how to preopen a dir again 2020-12-11 16:38:55 -08:00
Pat Hickey
30d49d122c add preopened_dir to builder 2020-12-11 16:38:44 -08:00
Pat Hickey
dfcdbfd0fe test-programs: no longer test virtfs separately
wasi-c2 does not have a virtfs yet, and when it does we'll design a
better test harness

also fix prestat get: i was reporting the wrong error
2020-12-11 15:51:14 -08:00
Pat Hickey
61f97a3e92 trap on wasi_proc_exit 2020-12-11 15:37:04 -08:00
Pat Hickey
d586574b1f port in args and env. slightly different style
building up a bunch of deferred errors in the CtxBuilder sucks. so does
reporting errors right away. Idk what to do here?
2020-12-11 15:33:59 -08:00
Pat Hickey
aef8be560f test-programs: use wasi-c2 instead of wasmtime 2020-12-11 15:00:58 -08:00
Pat Hickey
22db10e643 add wasmtime adapter and stdio wrappers
the stdio wrappers will not work on windows, but thats a whole other can
of worms anyway
2020-12-11 15:00:33 -08:00