-
Notifications
You must be signed in to change notification settings - Fork 5.5k
wasm: Add WAMR support #16057
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
Changes from 24 commits
013f626
ad1b66b
4791b2f
2870ce8
4d55dac
0f64660
92af1c5
b064ed4
7e609b4
1b6bc39
635adb0
dd15bc8
2b79298
904e258
4af6ab8
af5cc19
13b52d6
7f0f522
6300297
1eaf38f
053ae9d
b7e910e
5df2800
49e1784
86420be
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 |
|---|---|---|
|
|
@@ -688,9 +688,25 @@ REPOSITORY_LOCATIONS_SPEC = dict( | |
| urls = ["https://github.com/llvm/llvm-project/releases/download/llvmorg-{version}/llvm-{version}.src.tar.xz"], | ||
| release_date = "2020-03-23", | ||
| use_category = ["dataplane_ext"], | ||
| extensions = ["envoy.wasm.runtime.wavm"], | ||
| extensions = [ | ||
| "envoy.wasm.runtime.wamr", | ||
| "envoy.wasm.runtime.wavm", | ||
| ], | ||
| cpe = "cpe:2.3:a:llvm:*:*", | ||
| ), | ||
| com_github_wamr = dict( | ||
| project_name = "Webassembly Micro Runtime", | ||
|
Member
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. @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
Contributor
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. 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 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.
Member
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. 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. |
||
| project_desc = "A standalone runtime with a small footprint for WebAssembly", | ||
| project_url = "https://github.com/bytecodealliance/wasm-micro-runtime", | ||
| version = "a14a4487bb8b493bf6c68d83b03f12028d16f58a", | ||
| sha256 = "d68668e129f16a9ddd7a1a0da22b17905a25001ae2de398726d37880b61fee9e", | ||
| strip_prefix = "wasm-micro-runtime-{version}", | ||
| urls = ["https://github.com/bytecodealliance/wasm-micro-runtime/archive/{version}.tar.gz"], | ||
| release_date = "2021-05-14", | ||
| use_category = ["dataplane_ext"], | ||
| extensions = ["envoy.wasm.runtime.wamr"], | ||
| cpe = "N/A", | ||
| ), | ||
| com_github_wavm_wavm = dict( | ||
| project_name = "WAVM", | ||
| project_desc = "WebAssembly Virtual Machine", | ||
|
|
@@ -938,6 +954,7 @@ REPOSITORY_LOCATIONS_SPEC = dict( | |
| "envoy.stat_sinks.wasm", | ||
| "envoy.wasm.runtime.null", | ||
| "envoy.wasm.runtime.v8", | ||
| "envoy.wasm.runtime.wamr", | ||
| "envoy.wasm.runtime.wavm", | ||
| "envoy.wasm.runtime.wasmtime", | ||
| ], | ||
|
|
@@ -948,8 +965,8 @@ REPOSITORY_LOCATIONS_SPEC = dict( | |
| project_name = "WebAssembly for Proxies (C++ host implementation)", | ||
| project_desc = "WebAssembly for Proxies (C++ host implementation)", | ||
| project_url = "https://github.com/proxy-wasm/proxy-wasm-cpp-host", | ||
| version = "31c75e0039f2f5c42dc6e12556cb151a38da6d8b", | ||
| sha256 = "779e7a8e0fd8ed8b3133b464a8e5a9974bdedb345792d3a6148cb5a87e26976b", | ||
| version = "e641ffa8893477cdb4720f572f50f003cd51a083", | ||
| sha256 = "20abaa0ff37b3765111fb81774bf4fa4630e23dc9c468b42016c4ebf4f27a38a", | ||
| strip_prefix = "proxy-wasm-cpp-host-{version}", | ||
| urls = ["https://github.com/proxy-wasm/proxy-wasm-cpp-host/archive/{version}.tar.gz"], | ||
| use_category = ["dataplane_ext"], | ||
|
|
@@ -961,10 +978,11 @@ REPOSITORY_LOCATIONS_SPEC = dict( | |
| "envoy.stat_sinks.wasm", | ||
| "envoy.wasm.runtime.null", | ||
| "envoy.wasm.runtime.v8", | ||
| "envoy.wasm.runtime.wamr", | ||
| "envoy.wasm.runtime.wavm", | ||
| "envoy.wasm.runtime.wasmtime", | ||
| ], | ||
| release_date = "2021-05-06", | ||
| release_date = "2021-05-07", | ||
| cpe = "N/A", | ||
| ), | ||
| proxy_wasm_rust_sdk = dict( | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| load( | ||
| "//bazel:envoy_build_system.bzl", | ||
| "envoy_cc_extension", | ||
| "envoy_extension_package", | ||
| ) | ||
| load("//bazel:envoy_select.bzl", "envoy_select_wasm_wamr") | ||
|
|
||
| licenses(["notice"]) # Apache 2 | ||
|
|
||
| envoy_extension_package() | ||
|
|
||
| envoy_cc_extension( | ||
| name = "config", | ||
| srcs = ["config.cc"], | ||
| deps = [ | ||
| "//include/envoy/registry", | ||
| "//source/extensions/common/wasm:wasm_runtime_factory_interface", | ||
| ] + envoy_select_wasm_wamr([ | ||
| "@proxy_wasm_cpp_host//:wamr_lib", | ||
| ]), | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| #include "envoy/registry/registry.h" | ||
|
|
||
| #include "extensions/common/wasm/wasm_runtime_factory.h" | ||
|
|
||
| #include "include/proxy-wasm/wamr.h" | ||
|
|
||
| namespace Envoy { | ||
| namespace Extensions { | ||
| namespace Common { | ||
| namespace Wasm { | ||
|
|
||
| class WamrRuntimeFactory : public WasmRuntimeFactory { | ||
| public: | ||
| WasmVmPtr createWasmVm() override { return proxy_wasm::createWamrVm(); } | ||
|
|
||
| absl::string_view name() override { return "envoy.wasm.runtime.wamr"; } | ||
| }; | ||
|
|
||
| #if defined(ENVOY_WASM_WAMR) | ||
| REGISTER_FACTORY(WamrRuntimeFactory, WasmRuntimeFactory); | ||
| #endif | ||
|
|
||
| } // namespace Wasm | ||
| } // namespace Common | ||
| } // namespace Extensions | ||
| } // namespace Envoy |
Uh oh!
There was an error while loading. Please reload this page.