-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
wasm: Add WAMR support #16057
wasm: Add WAMR support #16057
Conversation
Hi @leyao-daily, welcome and thank you for your contribution. We will try to review your Pull Request as quickly as possible. In the meantime, please take a look at the contribution guidelines if you have not done so already. |
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.
Thank you for working on this. You're still missing:
- Wasm Runtime factory for WAMR (see:
source/extensions/wasm_runtime
), - tests executed on the CI (see:
bazel.compile_time_options
inci/do_ci.sh
).
14643f7
to
b2be443
Compare
f0752b5
to
49f1de8
Compare
CC @envoyproxy/api-shepherds: Your approval is needed for changes made to |
@@ -704,6 +704,19 @@ REPOSITORY_LOCATIONS_SPEC = dict( | |||
extensions = ["envoy.wasm.runtime.wavm"], | |||
cpe = "cpe:2.3:a:webassembly_virtual_machine_project:webassembly_virtual_machine:*", | |||
), | |||
com_github_wamr = dict( | |||
project_name = "Webassembly Micro Runtime", |
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.
@PiotrSikora what's our end game here? Will we eventually bring every Wasm runtime into the Envoy OSS build? Do we need this or can we be opinionated?
My main worry here is the increase in build time in CI, security risk envelope, etc.
CC @envoyproxy/dependency-shepherds
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.
Those are good questions.
From Proxy-Wasm C++ Host's perspective, supporting any decent Wasm runtime is desireable, since they all have a bit different features, and most implement variants of Wasm C/C++ API, so both implementation and maintanance have relatively small cost.
From Envoy's perspective, it's definitely not neccessary, and we could be opinionated, but since those are optional alternatives, I don't think there are too many downsides, especially since the common logic is abstracted away.
Regarding build time - Wasm runtimes are updated once a month or once a quarter, and the alternative ones are built only in bazel.compile_time_options
target, so their artifacts should be pretty much always cached, and the overhead shouldn't be much of an issue.
Regarding security risk - we could officially support only the default Wasm runtime (currently: V8), and be upfront that there won't be any security releases for other runtimes.
Regarding WAMR specifically, it has interpreted mode, and claims very small binary size overhead and low memory usage, so it might be more desirable in Envoy Mobile than V8, for example.
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.
OK, can we add to this PR a change to threat model https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/security/threat_model#core-and-extensions stating this explicitly?
I think this is a pretty important thing to get clear as we add more runtimes; we won't support anything other than V8 for now from a security perspective.
name = "config", | ||
srcs = ["config.cc"], | ||
category = "envoy.wasm.runtime", | ||
security_posture = "unknown", |
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 we add a comment that "This may never change from unknown
until the threat model at https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/security/threat_model#core-and-extensions is updated to capture additional Wasm runtimes". This should also be done for all other Wasm runtimes other than V8.
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.
So add an annotation above the unknown
line to explain the meaning?
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.
Yes. Could you add that comment here and to Wasmtime and WAVM?
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.
Friendly ping.
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.
This is still needed.
The PR is waiting for #16112 merging. |
About the API change, what should I do to pass the check? |
Wait for one of the @envoyproxy/api-shepherds to approve. |
/lgtm api |
@leyao-daily this needs merge with master to resolve conflicts. @htuch @lizan could one of you please take a look at this PR? |
- generate llvm libraries list with "llvm-config --libnames" ``` $ llvm-config --version 10.0.0 $ llvm-config --libnames asmparser core debuginfodwarf engine lto mcparser mirparser orcjit passes runtimedyld support x86asmparser x86desc ``` - change WAMR default mode to JIT. - change to latest bytecodealliance/wasm-micro-runtime commits Signed-off-by: Liang He <[email protected]>
fix several comments
Signed-off-by: Le Yao <[email protected]>
/lgtm deps |
Signed-off-by: Le Yao <[email protected]>
Signed-off-by: Le Yao <[email protected]>
Signed-off-by: Le Yao <[email protected]>
Once the CI/CD pass, I think this PR is ready to be merged. |
Signed-off-by: Le Yao <[email protected]>
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.
/lgtm deps
WebAssembly Micro Runtime (WAMR) is a standalone WebAssembly (WASM) runtime with a small footprint. It includes a few parts as below: The "iwasm" VM core, supporting WebAssembly interpreter, ahead of time compilation (AoT) and Just-in-Time compilation (JIT) The application framework and the supporting API's for the WASM applications The dynamic management of the WASM applications Risk Level: Medium Testing: Runtime unit testing, integration testing and manual testing Signed-off-by: Le Yao <[email protected]>
Commit Message: Enabling WAMR(Webassembly Micro Runtime) as wasm runtime in Envoy
Additional Description:
Risk Level: Medium
Testing: Runtime unit testing, integration testing and manual testing
Docs Changes: N/A
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Deprecated:]
[Optional API Considerations:]