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 ASan handling of WasmOffsetConverter reading on a pthread #14611

Merged
merged 1 commit into from
Jul 9, 2021

Conversation

kripken
Copy link
Member

@kripken kripken commented Jul 9, 2021

If ASan wants to show a stack trace on a pthread (like the trace to get to
an allocation that was later used after free), then it needs access to the
WasmOffsetConverter. We had a race there, where it could postMessage
the WasmOffsetConverter before that object was actually filled with the
data it needs (function offsets). See details in comments.

Fixes #13205

Copy link
Member

@tlively tlively left a comment

Choose a reason for hiding this comment

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

Nice 👍

'Thread T1 created by T0 here:',
'SUMMARY: AddressSanitizer: heap-use-after-free',
'Shadow bytes around the buggy address:',
'Shadow byte legend (one shadow byte represents 8 application bytes):',
Copy link
Collaborator

Choose a reason for hiding this comment

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

When these tests fail its really hard to know why.. I wonder if we can pipe the stderr back to the server and use the same output comparison methods we use in non-browser tests?

Do you know how common this pattern is in browser tests? Is it just the sanitizer tests?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think I've only seen this pattern in the sanitizer tests. Yeah, I agree it's a little inconvenient, +1 for looking into possible improvements.

sbc100 added a commit that referenced this pull request Jul 27, 2021
Following up on the change made in #14611, this change forces the
`WasmOffsetConverter` before calling receiveInstantiationResult in both
code paths (instantiateArrayBuffer and instantiateAsync).

With that done (along with #14755) there are no more valid use cases for
to block executation based on the absence of `WasmOffsetConverter`.  By
the time the instance is recieved it is always defined.
sbc100 added a commit that referenced this pull request Jul 27, 2021
Following up on the change made in #14611, this change forces the
`WasmOffsetConverter` before calling receiveInstantiationResult in both
code paths (instantiateArrayBuffer and instantiateAsync).

With that done (along with #14755) there are no more valid use cases for
to block execution based on the absence of `WasmOffsetConverter`.  By
the time the instance is received it is always defined.
sbc100 added a commit that referenced this pull request Jul 27, 2021
Following up on the change made in #14611, this change forces the
`WasmOffsetConverter` before calling receiveInstantiationResult in both
code paths (instantiateArrayBuffer and instantiateAsync).

With that done (along with #14755) there are no more valid use cases for
to block execution based on the absence of `WasmOffsetConverter`.  By
the time the instance is received it is always defined.
sbc100 added a commit that referenced this pull request Jul 27, 2021
Following up on the change made in #14611, this change forces the
`WasmOffsetConverter` before calling receiveInstantiationResult in both
code paths (instantiateArrayBuffer and instantiateAsync).

With that done (along with #14755) there are no more valid use cases for
to block execution based on the absence of `WasmOffsetConverter`.  By
the time the instance is received it is always defined.
sbc100 added a commit that referenced this pull request Jul 27, 2021
Following up on the change made in #14611, this change forces the
`WasmOffsetConverter` before calling receiveInstantiationResult in both
code paths (instantiateArrayBuffer and instantiateAsync).

With that done (along with #14755) there are no more valid use cases for
to block execution based on the absence of `WasmOffsetConverter`.  By
the time the instance is received it is always defined.
sbc100 added a commit that referenced this pull request Jul 27, 2021
Following up on the change made in #14611, this change forces the
`WasmOffsetConverter` before calling receiveInstantiationResult in both
code paths (instantiateArrayBuffer and instantiateAsync).

With that done (along with #14755) there are no more valid use cases for
to block execution based on the absence of `WasmOffsetConverter`.  By
the time the instance is received it is always defined.
sbc100 added a commit that referenced this pull request Jul 27, 2021
Following up on the change made in #14611, this change forces the
`WasmOffsetConverter` before calling `receiveInstantiationResult` in both
code paths (instantiateArrayBuffer and instantiateAsync).

With that done (along with #14755) there are no more valid use cases for
to block execution based on the absence of `WasmOffsetConverter`.  By
the time the instance is received it is always defined.
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.

ASan hit on background threads broken with "TypeError: Cannot read property 'length' of undefined"
3 participants