From f05ea4819fbc360c9e43c9b17edb39a50f75b014 Mon Sep 17 00:00:00 2001 From: Thibault Charbonnier Date: Wed, 1 Nov 2023 09:32:12 -0700 Subject: [PATCH] chore(deps) bump Wasmer to 3.3.0 Co-Authored-By: Hisham Muhammad --- .github/workflows/ci-large.yml | 10 +++++----- .github/workflows/ci.yml | 16 ++++++++-------- Makefile | 2 +- src/wasm/wrt/ngx_wrt.h | 2 +- src/wasm/wrt/ngx_wrt_wasmer.c | 13 ++++++++----- valgrind.suppress | 20 +++++++++----------- 6 files changed, 32 insertions(+), 31 deletions(-) diff --git a/.github/workflows/ci-large.yml b/.github/workflows/ci-large.yml index 0e7801f27..34a8f8ab9 100644 --- a/.github/workflows/ci-large.yml +++ b/.github/workflows/ci-large.yml @@ -26,7 +26,7 @@ jobs: ngx: [1.25.3] runtime: [wasmtime, wasmer, v8] wasmtime: [14.0.3] - wasmer: [3.1.1] + wasmer: [3.3.0] v8: [11.4.183.23] debug: [debug, no_debug] hup: [hup, no_hup] @@ -69,7 +69,7 @@ jobs: ngx: [1.25.3] runtime: [wasmer, wasmtime, v8] wasmtime: [14.0.3] - wasmer: [3.1.1] + wasmer: [3.3.0] v8: [11.4.183.23] hup: [hup, no_hup] debug: [debug] @@ -80,7 +80,7 @@ jobs: cc: gcc-12 openresty: 1.21.4.2 runtime: wasmer - wasmer: 3.1.1 + wasmer: 3.3.0 debug: debug hup: no_hup uses: ./.github/workflows/job-valgrind-tests.yml @@ -107,7 +107,7 @@ jobs: openresty: [1.21.4.2] runtime: [wasmtime, wasmer, v8] wasmtime: [14.0.3] - wasmer: [3.1.1] + wasmer: [3.3.0] v8: [11.4.183.23] ssl: [no_ssl, ssl] debug: [debug, no_debug] @@ -135,7 +135,7 @@ jobs: ngx: [1.25.3] runtime: [wasmtime, wasmer, v8] wasmtime: [14.0.3] - wasmer: [3.1.1] + wasmer: [3.3.0] v8: [11.4.183.23] include: - label: old_nginx diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5ea8a44ef..32a021021 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,7 @@ jobs: openresty: [""] runtime: [wasmer] wasmtime: [""] - wasmer: [3.1.1] + wasmer: [3.3.0] v8: [""] ssl: [ssl] debug: [debug, no_debug] @@ -66,7 +66,7 @@ jobs: cc: gcc-12 ngx: 1.21.6 runtime: wasmer - wasmer: 3.1.1 + wasmer: 3.3.0 ssl: ssl debug: debug hup: no_hup @@ -86,7 +86,7 @@ jobs: cc: gcc-12 ngx: 1.25.3 runtime: wasmer - wasmer: 3.1.1 + wasmer: 3.3.0 ssl: no_ssl debug: no_debug hup: no_hup @@ -154,7 +154,7 @@ jobs: openresty: [""] runtime: [wasmer] wasmtime: [""] - wasmer: [3.1.1] + wasmer: [3.3.0] v8: [""] hup: [no_hup, hup] debug: [debug] @@ -182,7 +182,7 @@ jobs: openresty: 1.21.4.2 ngx: runtime: wasmer - wasmer: 3.1.1 + wasmer: 3.3.0 debug: debug hup: no_hup uses: ./.github/workflows/job-valgrind-tests.yml @@ -246,7 +246,7 @@ jobs: openresty: [1.21.4.2] runtime: [wasmtime, wasmer, v8] wasmtime: [14.0.3] - wasmer: [3.1.1] + wasmer: [3.3.0] v8: [11.4.183.23] ssl: [ssl] debug: [debug, no_debug] @@ -256,7 +256,7 @@ jobs: cc: clang-15 ngx: 1.25.3 runtime: wasmer - wasmer: 3.1.1 + wasmer: 3.3.0 ssl: no_ssl debug: debug uses: ./.github/workflows/job-clang-analyzer.yml @@ -282,7 +282,7 @@ jobs: ngx: [1.25.3] runtime: [wasmtime, wasmer, v8] wasmtime: [14.0.3] - wasmer: [3.1.1] + wasmer: [3.3.0] v8: [11.4.183.23] uses: ./.github/workflows/job-build-tests.yml with: diff --git a/Makefile b/Makefile index c13eb2e6f..a9a9992f9 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ NGX ?= 1.25.3 OPENSSL ?= 3.1.4 WASMTIME ?= 14.0.3 -WASMER ?= 3.1.1 +WASMER ?= 3.3.0 V8 ?= 11.4.183.23 PCRE ?= 8.45 ZLIB ?= 1.2.13 diff --git a/src/wasm/wrt/ngx_wrt.h b/src/wasm/wrt/ngx_wrt.h index 031fe22ab..e09895d41 100644 --- a/src/wasm/wrt/ngx_wrt.h +++ b/src/wasm/wrt/ngx_wrt.h @@ -119,7 +119,7 @@ void ngx_wasmtime_valvec2wasm(wasm_val_vec_t *out, wasmtime_val_t *vec, #if WASMER_VERSION_MAJOR != 3 # error Unsupported Wasmer version -#elif WASMER_VERSION_MINOR > 1 +#elif WASMER_VERSION_MINOR > 3 # warning Untested Wasmer version #endif diff --git a/src/wasm/wrt/ngx_wrt_wasmer.c b/src/wasm/wrt/ngx_wrt_wasmer.c index 8994f83e5..c27a1ec7c 100644 --- a/src/wasm/wrt/ngx_wrt_wasmer.c +++ b/src/wasm/wrt/ngx_wrt_wasmer.c @@ -610,6 +610,14 @@ ngx_wasmer_init_instance(ngx_wrt_instance_t *instance, ngx_wrt_store_t *store, instance->ctxs = hctxs; + if (module->wasi + && !wasi_env_initialize_instance(store->wasi_env, store->store, + instance->instance)) + { + dd("wasi_env_initialize_instance failed"); + goto error; + } + return NGX_OK; error: @@ -696,11 +704,6 @@ ngx_wasmer_init_extern(ngx_wrt_extern_t *ext, ngx_wrt_instance_t *instance, ngx_wasm_assert(wasm_extern_kind(ext->ext) == WASM_EXTERN_MEMORY); ext->kind = NGX_WRT_EXTERN_MEMORY; instance->memory = wasm_extern_as_memory(ext->ext); - - if (module->wasi) { - wasi_env_set_memory(instance->store->wasi_env, instance->memory); - } - break; case WASM_EXTERN_GLOBAL: diff --git a/valgrind.suppress b/valgrind.suppress index c3b011f51..3b299a3ee 100644 --- a/valgrind.suppress +++ b/valgrind.suppress @@ -31,29 +31,27 @@ fun:main } { - + Memcheck:Cond - fun:_ZN10wasmparser6parser6Parser5parse17h5c54f0ee5315402aE + fun:_ZN10wasmparser6parser6Parser5parse17h* ... fun:main } { - + Memcheck:Leak - match-leak-kinds: definite - fun:malloc ... - fun:_ZN6wasmer3sys8instance8Instance12new_by_index17h9b11b6b5fcb57319E - fun:wasm_instance_new + fun:wasi_env_new } { - + Memcheck:Leak - match-leak-kinds: possible + match-leak-kinds: definite fun:calloc ... - fun:_ZN6wasmer3sys6module6Module11from_binary17h0e63bedfc82f5d11E - fun:wasm_module_new + fun:_ZN3std3sys4unix6thread6Thread3new12thread_start17h* + fun:start_thread + fun:clone } {