Bug 214403 - [JSC] Use unvalidatedGet instead of get to access UnlinkedCodeBlock from CodeBlock destructor
Summary: [JSC] Use unvalidatedGet instead of get to access UnlinkedCodeBlock from Code...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Yusuke Suzuki
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-07-16 03:48 PDT by Yusuke Suzuki
Modified: 2020-07-16 12:46 PDT (History)
7 users (show)

See Also:


Attachments
Patch (5.59 KB, patch)
2020-07-16 03:50 PDT, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Patch (5.63 KB, patch)
2020-07-16 12:39 PDT, Yusuke Suzuki
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yusuke Suzuki 2020-07-16 03:48:14 PDT
[JSC] Touch UnlinkedCodeBlock from CodeBlock destructor by using unvalidatedGet
Comment 1 Yusuke Suzuki 2020-07-16 03:50:41 PDT
Created attachment 404433 [details]
Patch
Comment 2 Yusuke Suzuki 2020-07-16 03:50:43 PDT
<rdar://problem/65527229>
Comment 3 Mark Lam 2020-07-16 10:18:54 PDT
Comment on attachment 404433 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=404433&action=review

r=me if EWS bots are green.  The mac-wk1 bot was red but I told it to re-run the test.  If the failure is real, please fix before landing.  Thanks.

> Source/JavaScriptCore/ChangeLog:3
> +        [JSC] Touch UnlinkedCodeBlock from CodeBlock destructor by using unvalidatedGet

I suggest renaming this title to "Use unvalidatedGet instead of get to access UnlinkedCodeBlock from CodeBlock destructor".  The current title reads to me like an imperative to add some code to access the UnlinkedCodeBlock, whereas what you meant is that when we access it, we need to use unvalidatedGet.

> Source/JavaScriptCore/bytecode/CodeBlock.cpp:820
> +    // We use unvalidatedGet because validation rejects get() access when we are destroying cells.

I suggest rephrasing as "because get() has a validation assertion that rejects access".  Mentioning the "assertion" here also sets the context for the next point.

> Source/JavaScriptCore/bytecode/CodeBlock.cpp:821
> +    // This is right assertion since destruction order of cells is not defined, so member cells would get destroyed already.

I suggest rephrasing as "This assertion is correct since destruction order of cells is not guaranteed, and member cells could already be destroyed."

> JSTests/stress/codeblock-destructor-access-unlinkedcodeblock.js:2
> +//@ runDefault("--returnEarlyFromInfiniteLoopsForFuzzing=1")
> +//@ slow!

Please skip for memoryLimited.  I'm using memoryLimited here as a proxy for slow machines here.  The armv7 and mips bots are showing that this tests times out there.  I'm guessing this might also be the case for other embedded / memory limited devices.
Comment 4 Yusuke Suzuki 2020-07-16 12:35:22 PDT
Comment on attachment 404433 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=404433&action=review

>> Source/JavaScriptCore/ChangeLog:3
>> +        [JSC] Touch UnlinkedCodeBlock from CodeBlock destructor by using unvalidatedGet
> 
> I suggest renaming this title to "Use unvalidatedGet instead of get to access UnlinkedCodeBlock from CodeBlock destructor".  The current title reads to me like an imperative to add some code to access the UnlinkedCodeBlock, whereas what you meant is that when we access it, we need to use unvalidatedGet.

Changed.

>> Source/JavaScriptCore/bytecode/CodeBlock.cpp:820
>> +    // We use unvalidatedGet because validation rejects get() access when we are destroying cells.
> 
> I suggest rephrasing as "because get() has a validation assertion that rejects access".  Mentioning the "assertion" here also sets the context for the next point.

Changed.

>> Source/JavaScriptCore/bytecode/CodeBlock.cpp:821
>> +    // This is right assertion since destruction order of cells is not defined, so member cells would get destroyed already.
> 
> I suggest rephrasing as "This assertion is correct since destruction order of cells is not guaranteed, and member cells could already be destroyed."

Changed.

>> JSTests/stress/codeblock-destructor-access-unlinkedcodeblock.js:2
>> +//@ slow!
> 
> Please skip for memoryLimited.  I'm using memoryLimited here as a proxy for slow machines here.  The armv7 and mips bots are showing that this tests times out there.  I'm guessing this might also be the case for other embedded / memory limited devices.

OK, added.
Comment 5 Yusuke Suzuki 2020-07-16 12:39:54 PDT
Created attachment 404474 [details]
Patch
Comment 6 Yusuke Suzuki 2020-07-16 12:42:18 PDT
Committed r264473: <https://trac.webkit.org/changeset/264473>