-
Notifications
You must be signed in to change notification settings - Fork 725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Library sandboxing changes - support for per instance, cross platform, wasi, some debugging #1833
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
/bin | ||
/build | ||
/build* | ||
/out | ||
/fuzz-out | ||
/emscripten | ||
*.pyc | ||
*.o | ||
.idea/ | ||
.vscode/ | ||
/cmake-build-debug/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -351,11 +351,9 @@ set(WABT_LIBRARY_SRC | |
|
||
add_library(wabt STATIC ${WABT_LIBRARY_SRC}) | ||
|
||
IF (NOT WIN32) | ||
add_library(wasm-rt-impl STATIC wasm2c/wasm-rt-impl.c wasm2c/wasm-rt-impl.h) | ||
install(TARGETS wasm-rt-impl DESTINATION ${CMAKE_INSTALL_LIBDIR}) | ||
install(FILES wasm2c/wasm-rt.h wasm2c/wasm-rt-impl.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) | ||
endif () | ||
add_library(wasm-rt-impl STATIC SHARED wasm2c/wasm-rt-impl.c wasm2c/wasm-rt-os-unix.c wasm2c/wasm-rt-os-win.c wasm2c/wasm-rt-wasi.c) | ||
install(TARGETS wasm-rt-impl DESTINATION ${CMAKE_INSTALL_LIBDIR}) | ||
install(FILES wasm2c/wasm-rt.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) | ||
|
||
if (BUILD_FUZZ_TOOLS) | ||
set(FUZZ_FLAGS "-fsanitize=fuzzer,address") | ||
|
@@ -472,6 +470,19 @@ if (BUILD_TOOLS) | |
INSTALL | ||
) | ||
|
||
if (NOT WIN32) | ||
set(LDL_LIB "-ldl") | ||
else() | ||
set(LDL_LIB "") | ||
endif() | ||
|
||
wabt_executable( | ||
NAME wasm2c-runner | ||
SOURCES wasm2c/wasm-rt-runner.c | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you explain the utility of this helper? Why compile the the wasm2c code to a dll and then load it dyamically? Why not just compile it with a main.c and run its like that? Maybe there is some use case there its useful to have the wasm2c output be built as a dll that I'm not getting. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a pattern that is common in many sandboxing toolchains. Lucet is probably the easiest to look at https://github.com/bytecodealliance/lucet/blob/main/lucet-wasi/src/main.rs The goal of the runner is to give developers an easy way to test simple applications without changing their code. The runner uses a default Wasm configuration (instantiates a heap and the runtime etc) and would execute any wasm2c compiled module that includes a main. The expected workflow is that developers can simply compile their existing application to a wasm module, generate C with wasm2c, compile the result to a dll and run it with no modification. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess the separation of runtime from compiled module is the key benefit here.. since it allows the compilation of the module and runtime to be separated. But it seems that benefit is largely proportional to size of the runtime itself and how likely it is that you would want to iterate on the runtime without recompiling the wasm2c code. In practice, have you found this useful with wasm2c? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup! I think there are couple of positives here
That said, compiling wasm2c doesn't take that long and is not that complicated, so its not the end of the world to have to compile it multiple times. Other Wasm compilers like Lucet really needed a runner as recompiling Lucet (which is written in rust) takes a while. Given this, I think a runner would be nice to have but not a strict necessity. |
||
LIBS ${LDL_LIB} | ||
INSTALL | ||
) | ||
|
||
# wasm-opcodecnt | ||
wabt_executable( | ||
NAME wasm-opcodecnt | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you revert this file and submit this as a separate PR if you think there is a need for it. I for one am not a fan of
.gitignore
files that match a broad set of files like this, but we can have that discussion outside of this PR.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will fix