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

Fix a memory leak found in fuzzing #8016

Closed
wants to merge 1 commit into from

Conversation

alexcrichton
Copy link
Member

This fixes a mistake introduced in #7996 where a global.get used to initialize a table did not properly drop previous items in the table causing them to leak as the reference count was not decremented.

This fixes a mistake introduced in bytecodealliance#7996 where a `global.get` used to
initialize a table did not properly drop previous items in the table
causing them to leak as the reference count was not decremented.
@alexcrichton alexcrichton requested a review from a team as a code owner February 28, 2024 18:28
@alexcrichton alexcrichton requested review from fitzgen and removed request for a team February 28, 2024 18:28
Copy link
Member

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

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

Regression test in tests/all/gc.rs? Can use the SetFlagOnDrop helper.

alexcrichton added a commit to alexcrichton/wasmtime that referenced this pull request Feb 28, 2024
This commit is an attempt to make the mistake fixed in bytecodealliance#8016 harder to
happen again. This removes the `set_raw` helper entirely from tables and
instead forces all callers to view the table as either a table of
funcrefs or a table of externefs. By forcing that choice outwards
instead of handling it inwards it enables dealing with a typed table in
more contexts which should help naturally do the right thing.
@alexcrichton
Copy link
Member Author

Actually, there's another issue I've found, so I've opted for a larger refactor in #8018 to fix this (test included over there)

@alexcrichton alexcrichton deleted the fix-leak branch February 28, 2024 19:19
github-merge-queue bot pushed a commit that referenced this pull request Feb 28, 2024
This commit is an attempt to make the mistake fixed in #8016 harder to
happen again. This removes the `set_raw` helper entirely from tables and
instead forces all callers to view the table as either a table of
funcrefs or a table of externefs. By forcing that choice outwards
instead of handling it inwards it enables dealing with a typed table in
more contexts which should help naturally do the right thing.
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.

2 participants