Comments (7)
Hello. If I am not mistaken, these are the functions that should be implemented by the embedded system. In the compiled WebAssembly module, these are declared as import functions. For detailed documentation, check this, https://github.com/WebAssembly/WASI/blob/master/design/WASI-core.md .
from wasi-libc.
Thanks! @NineKa
In the repo readme, it introduced this repo provides a wasi reference implementation. so I assume it should be somewhere in the bottom half.
from wasi-libc.
Yes; the "bottom half" here refers to the bottom half of "libc", which is functions like pread
which are wrappers around calls to system calls like __wasi_fd_pread
. These system calls aren't implemented in libc -- they need to be provided by the embedder. For example, Wasmtime's implementation for Unix-type platforms is here.
from wasi-libc.
@sunfishcode Thanks, Dan!
I think I got some understanding about this repo structure now. The bottom half are mostly the added component on the musl with additional permission check and re-routing the syscalls to the WASI APIs.
If my understanding is right, I have another question - the bottom half seems to be built as part of WASM application binary. For the security reason, should we put the permission into the runtime implementation rather than being part of application?
from wasi-libc.
You're right, any required security checks need to happen in the runtime—and they do. For example the implementation of __wasi_fd_pread
in Wasmtime that @sunfishcode mentions contains checks that ensure that the requested operation is allowed. If you look at the implementation of pread
here, it doesn't perform any security checks itself; it just calls __wasi_fd_pread
and then just tries to provide some more specific information if the check failed and otherwise just returns an error.
from wasi-libc.
@tschneidereit Thank you for your further explanation! I was trying to understand what is the boundary between the top half and bottom half. I just compared the current implementation of fopen and its original implementation of musl. Now I feel the bottom half is more like the replacement of some key functions from the musl source code.
It will be great if some basic introduction can be available from the readme about the boundary definition between the two half parts.
I also came up with a few other questions during exploring the source code and will raise new issues. Your input is very appreciated.
from wasi-libc.
I maintain a simple (and partial) JS implementation of the current syscall layer here: https://github.com/WebAssembly/waterfall/blob/master/src/wasi.js.
from wasi-libc.
Related Issues (20)
- Adding `IFTODT` for more compatibility HOT 1
- A few packaging nits, coming from Nixpkgs/NixOS HOT 6
- Confusion around SIGCHLD value? HOT 2
- WASI signal numbers out of sync with wasi-libc signal numbers HOT 15
- Latest SIMD patch HOT 2
- fd_set implementation is inefficient HOT 5
- Support for `accept{,4}` HOT 3
- Implement the new preopen scheme in wasi-libc HOT 1
- __wasm_call_ctors broken previously wokring rust wasm reactors HOT 2
- getpagesize() HOT 4
- README seems to be wrong wrt minimal LLVM version HOT 4
- Provide socket option definitions HOT 3
- Missing __WASI_RIFLAGS_RECV_DATA_TRUNCATED for MSG_TRUNC HOT 1
- help how to disable feature for example( bulk memory)? HOT 1
- Humble request from distro packagers to start releasing versions HOT 6
- poll() with timeout fails with "timer subscriptions only support monotonic timer" HOT 1
- dlmalloc has license incompatible with Fedora policies HOT 12
- Migrate build system to CMake HOT 4
- How to distribute `THREAD_MODEL=posix` builds? HOT 46
- Is it safe to have mixed sbrk and malloc calls? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wasi-libc.