From 5a0e198dda2425622f1c02779f061591381e2b2c Mon Sep 17 00:00:00 2001 From: Thibault Charbonnier Date: Mon, 28 Aug 2023 19:36:02 -0700 Subject: [PATCH] chore(deps) bump Wasmer to 4.1.2 --- .github/workflows/ci-large.yml | 8 ++++---- .github/workflows/ci.yml | 16 ++++++++-------- Makefile | 2 +- src/wasm/wrt/ngx_wrt.h | 2 +- src/wasm/wrt/ngx_wrt_wasmer.c | 12 +++++++----- valgrind.suppress | 12 ++++++------ 6 files changed, 27 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci-large.yml b/.github/workflows/ci-large.yml index 32ca9889d..c7fd6fc06 100644 --- a/.github/workflows/ci-large.yml +++ b/.github/workflows/ci-large.yml @@ -26,7 +26,7 @@ jobs: ngx: [1.25.2] runtime: [wasmtime, wasmer, v8] wasmtime: [12.0.1] - wasmer: [3.1.1] + wasmer: [4.1.2] v8: [11.4.183.23] debug: [debug, no_debug] hup: [hup, no_hup] @@ -69,7 +69,7 @@ jobs: ngx: [1.25.2] runtime: [wasmer, wasmtime, v8] wasmtime: [12.0.1] - wasmer: [3.1.1] + wasmer: [4.1.2] v8: [11.4.183.23] hup: [hup, no_hup] debug: [debug] @@ -80,7 +80,7 @@ jobs: cc: gcc-10 openresty: 1.21.4.1 runtime: wasmer - wasmer: 3.1.1 + wasmer: 4.1.2 debug: debug hup: no_hup uses: ./.github/workflows/job-valgrind-tests.yml @@ -107,7 +107,7 @@ jobs: openresty: [1.21.4.1] runtime: [wasmtime, wasmer, v8] wasmtime: [12.0.1] - wasmer: [3.1.1] + wasmer: [4.1.2] v8: [11.4.183.23] ssl: [no_ssl, ssl] debug: [debug, no_debug] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e46d57bfa..76167573e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,7 +33,7 @@ jobs: openresty: [""] runtime: [wasmer] wasmtime: [""] - wasmer: [3.1.1] + wasmer: [4.1.2] v8: [""] ssl: [ssl] debug: [debug, no_debug] @@ -64,7 +64,7 @@ jobs: cc: gcc-9 ngx: 1.21.6 runtime: wasmer - wasmer: 3.1.1 + wasmer: 4.1.2 ssl: ssl debug: debug hup: no_hup @@ -84,7 +84,7 @@ jobs: cc: gcc-9 ngx: 1.25.2 runtime: wasmer - wasmer: 3.1.1 + wasmer: 4.1.2 ssl: no_ssl debug: no_debug hup: no_hup @@ -152,7 +152,7 @@ jobs: openresty: [""] runtime: [wasmer] wasmtime: [""] - wasmer: [3.1.1] + wasmer: [4.1.2] v8: [""] hup: [no_hup, hup] debug: [debug] @@ -180,7 +180,7 @@ jobs: openresty: 1.21.4.1 ngx: runtime: wasmer - wasmer: 3.1.1 + wasmer: 4.1.2 debug: debug hup: no_hup uses: ./.github/workflows/job-valgrind-tests.yml @@ -244,7 +244,7 @@ jobs: openresty: [1.21.4.1] runtime: [wasmtime, wasmer, v8] wasmtime: [12.0.1] - wasmer: [3.1.1] + wasmer: [4.1.2] v8: [11.4.183.23] ssl: [ssl] debug: [debug, no_debug] @@ -254,7 +254,7 @@ jobs: cc: clang-11 ngx: 1.25.2 runtime: wasmer - wasmer: 3.1.1 + wasmer: 4.1.2 ssl: no_ssl debug: debug uses: ./.github/workflows/job-clang-analyzer.yml @@ -283,7 +283,7 @@ jobs: ngx: [1.25.2] runtime: [wasmtime, wasmer, v8] wasmtime: [12.0.1] - wasmer: [3.1.1] + wasmer: [4.1.2] v8: [11.4.183.23] include: - label: old_nginx diff --git a/Makefile b/Makefile index 1203b1d12..c94c944ad 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ NGX ?= 1.25.2 OPENSSL ?= 3.1.2 WASMTIME ?= 12.0.1 -WASMER ?= 3.1.1 +WASMER ?= 4.1.2 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 6869df54d..b0180106d 100644 --- a/src/wasm/wrt/ngx_wrt.h +++ b/src/wasm/wrt/ngx_wrt.h @@ -112,7 +112,7 @@ void ngx_wasmtime_valvec2wasm(wasm_val_vec_t *out, wasmtime_val_t *vec, #elif NGX_WASM_HAVE_WASMER #include -#if WASMER_VERSION_MAJOR != 3 +#if WASMER_VERSION_MAJOR != 4 # error Unsupported Wasmer version #elif WASMER_VERSION_MINOR > 1 # warning Untested Wasmer version diff --git a/src/wasm/wrt/ngx_wrt_wasmer.c b/src/wasm/wrt/ngx_wrt_wasmer.c index 05aed26b3..580eb8b6b 100644 --- a/src/wasm/wrt/ngx_wrt_wasmer.c +++ b/src/wasm/wrt/ngx_wrt_wasmer.c @@ -604,6 +604,13 @@ ngx_wasmer_init_instance(ngx_wrt_instance_t *instance, ngx_wrt_store_t *store, instance->ctxs = hctxs; + if (!wasi_env_initialize_instance(store->wasi_env, store->store, + instance->instance)) + { + dd("wasi_env_initialize_instance failed"); + goto error; + } + return NGX_OK; error: @@ -690,11 +697,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 296e5709c..0fc95f399 100644 --- a/valgrind.suppress +++ b/valgrind.suppress @@ -22,28 +22,28 @@ fun:ngx_crc32_table_init } { - + Memcheck:Cond - fun:_ZN10wasmparser6parser6Parser5parse17h5c54f0ee5315402aE + fun:_ZN10wasmparser6parser6Parser5parse17h95aa6c048b6a9802E ... fun:main } { - + Memcheck:Leak match-leak-kinds: definite fun:malloc ... - fun:_ZN6wasmer3sys8instance8Instance12new_by_index17h9b11b6b5fcb57319E + fun:todo fun:wasm_instance_new } { - + Memcheck:Leak match-leak-kinds: possible fun:calloc ... - fun:_ZN6wasmer3sys6module6Module11from_binary17h0e63bedfc82f5d11E + fun:todo fun:wasm_module_new } {