Summary: | Failure to allocate ArrayStorage in emit_op_new_array leads to poisonous JSArray | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Mark Hahnenberg <mhahnenberg> | ||||||||||
Component: | JavaScriptCore | Assignee: | Mark Hahnenberg <mhahnenberg> | ||||||||||
Status: | RESOLVED FIXED | ||||||||||||
Severity: | Normal | CC: | fpizlo, ggaren, rafaelw | ||||||||||
Priority: | P2 | ||||||||||||
Version: | 528+ (Nightly build) | ||||||||||||
Hardware: | Unspecified | ||||||||||||
OS: | Unspecified | ||||||||||||
Attachments: |
|
Description
Mark Hahnenberg
2012-04-23 16:29:51 PDT
Created attachment 138492 [details]
Patch
Comment on attachment 138492 [details]
Patch
(1) Regression test, please.
(2) A better fix is to allocate the backing store first. That way, no special branching, and no zombie JSArray.
(3) Please re-verify that this inlining is still a performance win. It's a bit odd to have an optimization only in the slow JIT.
Created attachment 138583 [details] Bencher results These are the benchmark results for ToT without the optimization (just a stub call like we used to do) compared to the optimization along with this particular fix. Looks like a small win. I think when we finish bug 79198 arrays will be in a much better state in general. Created attachment 138605 [details]
Patch
Comment on attachment 138605 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=138605&action=review Boy, those perf numbers are whisper-thin. Still, the fix is good, so let's take it. > Source/JavaScriptCore/jit/JITInlineMethods.h:490 > + // Allocate the backing store for the array. We allocate the storage first > + // because it could fail and we have to take the slow path, which would leave > + // behind a zombie JSArray with inconsistent state, potentially causing a GC crash. Hard to understand a comment about a potentially bad alternate version of the code. I would just say, "We allocate the backing store first to ensure that garbage collection doesn't happen during JSArray initialization". Fixed in http://trac.webkit.org/changeset/115096. Reopening to attach new patch. Created attachment 141188 [details]
Patch
(In reply to comment #8) > Reopening to attach new patch. I don't think this is the bug you meant to reopen. Sorry. No, it wasn't |