Skip to content
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

compiler: zero-initializes moduleInstanceAddress of call engine #783

Merged
merged 3 commits into from Aug 31, 2022

Conversation

mathetake
Copy link
Member

@mathetake mathetake commented Aug 30, 2022

This fixes a bug introduced in #761 where the reuse of the api.Function
causes some trouble around module context initialization.

Signed-off-by: Takeshi Yoneda takeshi@tetrate.io

Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
@mathetake
Copy link
Member Author

will backfill more tests, but this should fix inkeliz/karmem#85 and aquasecurity/trivy#2791 @codefromthecrypt @inkeliz @knqyf263

@mathetake mathetake changed the title wip compiler: zero-initializes moduleInstanceAddress of call engine for reuse Aug 31, 2022
@mathetake mathetake changed the title compiler: zero-initializes moduleInstanceAddress of call engine for reuse compiler: zero-initializes moduleInstanceAddress of call engine Aug 31, 2022
@mathetake
Copy link
Member Author

ok verified that at least on my local machine, the PRs ^^ pass all tests. will do the backfilling

Copy link
Collaborator

@codefromthecrypt codefromthecrypt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good once the usage pattern that led to this in trivy and karmem is backfilled as a test!

internal/engine/compiler/engine.go Outdated Show resolved Hide resolved
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
@@ -558,50 +558,53 @@ func testCloseInFlight(t *testing.T, r wazero.Runtime) {

func testMemOps(t *testing.T, r wazero.Runtime) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so this was exactly the same pattern in trivy and karmen - calling exported functions which might grow memory. But in order to catch this bug, I had to reuse the same api.Function, so I fixed it in that way.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and verified that without the patch, this test fails!

@mathetake mathetake marked this pull request as ready for review August 31, 2022 03:31
@mathetake mathetake merged commit f95b95e into main Aug 31, 2022
@mathetake mathetake deleted the testfixreset branch August 31, 2022 03:33
codefromthecrypt added a commit to tetratelabs/proxy-wasm-go-sdk that referenced this pull request Aug 31, 2022
A bug in beta1 is fixed and released in beta2 tetratelabs/wazero#783

Signed-off-by: Adrian Cole <adrian@tetrate.io>
codefromthecrypt added a commit to tetratelabs/wazero-fuzz that referenced this pull request Aug 31, 2022
A bug in beta1 was fixed and released in beta2 tetratelabs/wazero#783

Signed-off-by: Adrian Cole <adrian@tetrate.io>
codefromthecrypt added a commit to codefromthecrypt/javy-wazero that referenced this pull request Aug 31, 2022
A bug in beta1 was fixed and released in beta2 tetratelabs/wazero#783

Signed-off-by: Adrian Cole <adrian@tetrate.io>
codefromthecrypt added a commit to codefromthecrypt/wazero-demo that referenced this pull request Aug 31, 2022
A bug in beta1 was fixed and released in beta2 tetratelabs/wazero#783

Signed-off-by: Adrian Cole <adrian@tetrate.io>
codefromthecrypt added a commit to codefromthecrypt/wazero-demo that referenced this pull request Aug 31, 2022
A bug in beta1 was fixed and released in beta2 tetratelabs/wazero#783

Signed-off-by: Adrian Cole <adrian@tetrate.io>
codefromthecrypt added a commit to codefromthecrypt/goissues that referenced this pull request Aug 31, 2022
A bug in beta1 was fixed and released in beta2 tetratelabs/wazero#783

Signed-off-by: Adrian Cole <adrian@tetrate.io>
F21 pushed a commit to F21/javy-wazero that referenced this pull request Aug 31, 2022
A bug in beta1 was fixed and released in beta2 tetratelabs/wazero#783

Signed-off-by: Adrian Cole <adrian@tetrate.io>
codefromthecrypt added a commit to codefromthecrypt/sdfx-isosurface that referenced this pull request Aug 31, 2022
A bug in beta1 was fixed and released in beta2 tetratelabs/wazero#783

Signed-off-by: Adrian Cole <adrian@tetrate.io>
codefromthecrypt added a commit to codefromthecrypt/wapc-guest-tinygo that referenced this pull request Aug 31, 2022
A bug in beta1 was fixed and released in beta2 tetratelabs/wazero#783

Signed-off-by: Adrian Cole <adrian@tetrate.io>
codefromthecrypt added a commit to codefromthecrypt/mjml-go that referenced this pull request Aug 31, 2022
A bug in beta1 was fixed and released in beta2 tetratelabs/wazero#783

Signed-off-by: Adrian Cole <adrian@tetrate.io>
F21 pushed a commit to Boostport/mjml-go that referenced this pull request Aug 31, 2022
A bug in beta1 was fixed and released in beta2 tetratelabs/wazero#783

Signed-off-by: Adrian Cole <adrian@tetrate.io>
codefromthecrypt added a commit to codefromthecrypt/RethinkRAW that referenced this pull request Aug 31, 2022
A bug in beta1 was fixed and released in beta2 tetratelabs/wazero#783

Signed-off-by: Adrian Cole <adrian@tetrate.io>
codefromthecrypt added a commit to codefromthecrypt/go-zbar-wasm that referenced this pull request Aug 31, 2022
A bug in beta1 was fixed and released in beta2 tetratelabs/wazero#783

Signed-off-by: Adrian Cole <adrian@tetrate.io>
Yeicor pushed a commit to Yeicor/sdfx-isosurface that referenced this pull request Aug 31, 2022
A bug in beta1 was fixed and released in beta2 tetratelabs/wazero#783

Signed-off-by: Adrian Cole <adrian@tetrate.io>
codefromthecrypt added a commit to codefromthecrypt/capsule that referenced this pull request Aug 31, 2022
A bug in beta1 was fixed and released in beta2 tetratelabs/wazero#783

Signed-off-by: Adrian Cole <adrian@tetrate.io>
pkedy pushed a commit to wapc/wapc-guest-tinygo that referenced this pull request Sep 1, 2022
A bug in beta1 was fixed and released in beta2 tetratelabs/wazero#783

Signed-off-by: Adrian Cole <adrian@tetrate.io>

Signed-off-by: Adrian Cole <adrian@tetrate.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants