Commit Graph

9362 Commits

Author SHA1 Message Date
Christoph Herzog
25128a4678 wasi: Remove StubTaskManager
Removes the StubTaskManager implementation.
A WASI(X) module requires a VirtualTaskManager implementation to do
anything useful.

Having this implmementation doesn't make sense anymore, it only invites
misuse.
2023-02-16 20:17:11 +01:00
Christoph Herzog
195ea89841 wasi: Rename BidiPipe to DuplexPipe and add helper methods
* Rename BidiPipe to DuplexPipe, because the name is better
* Make the fields private: gives us more flexibility in the future
* Add a split() method and accessors for send and receive
2023-02-16 20:14:59 +01:00
Christoph Herzog
3e43325f0d wasi: Remove WasiPipe::channel to prevent misuse
The WasiPipe::channel() function is a leftover from a previous
implementation.

It pipes data through two different Pipes, which doesn't actually make
any sense in most circumstances.

Best to remove the function.

Users should just use Pipe::new(), or DuplexPipe::new().
2023-02-16 20:13:43 +01:00
Christoph Herzog
b6f3ebcc01 wasi: Return the actual error from WasiEnvBuilder::run/run_with_module
Fixes a refactoring left-over that discarded the actual result.
2023-02-16 20:13:43 +01:00
Christoph Herzog
4cb2d74b47 chore: Fix vnet Error mapping + some clippy lints 2023-02-16 13:54:53 +01:00
Christoph Herzog
5e290b5884 chore: Formatting... 2023-02-16 13:44:47 +01:00
Christoph Herzog
61bd7bd798 wasi: Add OS to vnet error mapping
Add mapping functions that were previously removed from vnet
2023-02-16 13:38:34 +01:00
Christoph Herzog
384af9af4c fix(wasi): Fix import path to also work for JS 2023-02-16 13:38:06 +01:00
Christoph Herzog
76a2996751 Remove libc dependency from vnet again
libc was added as a dependency to vnet for error mapping.

This breaks JS targets.

Removed the dependency, and removed the mapping functions.
Will be added again in the wasi crate.
2023-02-16 13:38:04 +01:00
Christoph Herzog
30f7bdfb4a chore: Remove invalid FIXME comments
The syscalls are still used, the comments were added in error.
2023-02-16 13:15:29 +01:00
Christoph Herzog
f0dbbc7d72 fix: Add missing import in c_api
Was forgotten during restoring a function from master.
2023-02-16 12:57:50 +01:00
Christoph Herzog
a7cd600382 chore: Fix clippy lints 2023-02-16 07:40:48 +01:00
Christoph Herzog
b15d028cb5 chore: Fix clippy lints 2023-02-16 06:21:45 +01:00
Christoph Herzog
cbcae65d71 Merge remote-tracking branch 'origin/wasix-major-fixes-and-tweaks' into wasix 2023-02-16 06:11:48 +01:00
Johnathan Sharratt
81bae8f95d Merge remote-tracking branch 'origin' into wasix-major-fixes-and-tweaks 2023-02-16 15:40:44 +11:00
Johnathan Sharratt
31c6eca32e Moved the OwnedRwReadLock and OwnedRwWriteLock implementation(s) into a privata mod and added some extra protection against race conditions 2023-02-16 14:54:16 +11:00
Syrus Akbary
e9a4ba498a Fix linting 2023-02-15 18:28:41 -08:00
Syrus Akbary
5faa0364fc Improved module imports 2023-02-15 18:24:45 -08:00
Syrus Akbary
745a06b15a Improved module imports 2023-02-15 18:12:18 -08:00
Syrus Akbary
99d3f84590 Simplified errors 2023-02-15 18:02:22 -08:00
Syrus Akbary
c45864ac26 Universalize MemoryView in js/sys 2023-02-15 17:13:15 -08:00
Johnathan Sharratt
e82fc87a1d Made the replace operation a bit easier to read 2023-02-16 12:06:33 +11:00
Johnathan Sharratt
4f117a6b63 Moved the notification implementation into a private scope 2023-02-16 11:57:06 +11:00
Johnathan Sharratt
4473be1b04 Replaced OsError with concrete types 2023-02-16 10:46:18 +11:00
Syrus Akbary
95e351adb2 Merge branch 'master' into std-api
# Conflicts:
#	lib/api/src/engine.rs
#	lib/api/src/store.rs
2023-02-15 13:26:45 -08:00
Syrus Akbary
b4c190bf72 Unified Function into js/sys 2023-02-15 13:17:28 -08:00
Christoph Herzog
30dc848de8 c-api: Restore wasi_env_set_memory function
Not supported anymore, but better to have it panic instead of just
breaking the API by removing it.
2023-02-15 17:46:10 +01:00
Michael-F-Bryan
8d46f7f2d7 Make AsStoreRef and friends work for anything that derefs to an AsStoreRef 2023-02-16 00:41:03 +08:00
Christoph Herzog
4db0dd06f3 chore: Align read_to_slice function names between sys and js 2023-02-15 17:22:05 +01:00
Christoph Herzog
506da0bdd7 chore: Remove all WASIX bus and event related syscalls + types
The implementations were previously already replaced with stub impls.
After ensuring that the current wasix modules don't actually import the
syscalls, we can now safely remove all the plumbing, including:

* syscalls
* types
2023-02-15 15:55:56 +01:00
ptitSeb
dc05bd111b Removed new ExportError::SerializationFailed, as it's not used 2023-02-15 14:50:30 +01:00
Christoph Herzog
e46c2e6c4b build(c-api): Enable more feature on the wasi dependency
Needed for things to work properly
2023-02-15 14:05:50 +01:00
ptitSeb
247de6f8bf Fixed wasmer_create_exe_main.c C file for non PIRITA_WASI config 2023-02-15 11:36:46 +01:00
Christoph Herzog
da1361fd79 Make LocalNetworking internals private and add ::new()
Since LocalNetworking was an empty struct, it could have been
constructed by anyone , which would lead to a breaking change if we need
to add any fields.

This commit adds a private stub field to prevent that.
Also adds a LocalNetworking::new() constructor
2023-02-15 11:28:35 +01:00
Christoph Herzog
e385a017ec build: Remove useless host-fs feature from vnet crate
It's not used and doesn't make sense.
Probably an artifact of copying the vfs crate...
2023-02-15 11:28:33 +01:00
Christoph Herzog
93a0cd6bbf cli: Add a --net flag to run command for enabling networking
WASIX networking will now only be enabled if the --net flag is provided.
Otherwise it would break the Wasmer sandboxing promise.

In the future we should add more advanced networking config.
(like only allow certain ports, limit dns domains, limit ip ranges, etc )
2023-02-15 11:25:17 +01:00
Johnathan Sharratt
cc83041680 Merge branch 'wasix' of github.com:wasmerio/wasmer into wasix-major-fixes-and-tweaks 2023-02-15 17:07:17 +11:00
Johnathan Sharratt
7d86ef5c58 Merge remote-tracking branch 'origin' into wasix-john 2023-02-15 16:14:37 +11:00
Johnathan Sharratt
c12a60f9a7 Many bug fixes and performance optimizations
- Removed generation_arena which was causing some serious leakages of files and sockets
- Added OsError for NetworkErrors so that "Too Many Open Files" is properly passed
- Local networking will now cap at 10 sockets in the backlog
- Added the missing shutdown error code
- Removed the inodes lock around most of the WASI syscalls
- Fixed some race conditions in the event notifications for WASI
- The polling loop will now only notify a closed socket once
- Event notifications now uses Wakers rather than MPSC
- Some socket errors now return the right codes which prevents panics in WASM
- Fixed a bug where the file read and write guards might release the file before the lock
- The inode seed is now much safer preventing overlaps
- The fd seed is now much safer preventing overlaps
- Closing files is now implicit rather than explicit reducing possibliities for error
- Forking of file descriptors is now much simplier
- Polling events will now be returned in random order to prevent some race conditions
- Removed a number of memory allocations which were wasting memory and performance
- Sockets now only copy the send and recv data once rather than multiple times
2023-02-15 16:13:48 +11:00
Syrus Akbary
cd4cb7a75b Make function internal APIs closer 2023-02-14 18:10:37 -08:00
Syrus Akbary
e9b8868b63 Moved ExternRef and FuncRef into crate::vm for unification 2023-02-14 18:07:05 -08:00
Syrus Akbary
3e7552abc3 Fix global 2023-02-14 17:58:42 -08:00
Syrus Akbary
7bf1bd1dc1 Fixed as_js for global 2023-02-14 17:08:05 -08:00
Syrus Akbary
4c0399f674 Unified global into js/sys 2023-02-14 16:41:39 -08:00
Syrus Akbary
4c0bd5c9d8 Unified Memory in js/sys 2023-02-14 16:20:11 -08:00
Syrus Akbary
b1a94df631 bump inkwell to 0.1.1 (#3582)
* Revert "Revert "bump inkwell to 0.1.0""

* Updated Inkwell to 0.1.1

---------

Co-authored-by: ptitSeb <sebastien.chev@gmail.com>
2023-02-14 16:45:09 +01:00
Christoph Herzog
60850bdb2f fix(wasi): Get the JS implementation to build (somewhat hackily)
Makes various fixes to get wasi JS to build.

Has some nasty workarounds that need to be removed in the future.
2023-02-14 13:24:45 +01:00
Syrus Akbary
1966af3703 Unified extern::Table in js/sys 2023-02-13 17:07:22 -08:00
Syrus Akbary
3b0ee715f7 Created vm module 2023-02-13 17:05:46 -08:00
ptitSeb
4c64988d07 Same lifetime on js as on sys for MemoryView 2023-02-13 13:25:27 +01:00