WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
101190
[V8] Remove setDOMWrapper(wrapper, 0) from V8NPObject
https://bugs.webkit.org/show_bug.cgi?id=101190
Summary
[V8] Remove setDOMWrapper(wrapper, 0) from V8NPObject
Kentaro Hara
Reported
2012-11-05 00:37:12 PST
In
bug 101054
, we want to add an ASSERT() that guarantees that we don't pass 0 to setDOMWrapper(). On the other hand, V8NPObject.cpp is trying to pass 0 to setDOMWrapper() just before disposing a wrapper, which hits the ASSERT(). We should remove it.
Attachments
Patch
(1.64 KB, patch)
2012-11-05 00:38 PST
,
Kentaro Hara
no flags
Details
Formatted Diff
Diff
Patch
(3.18 KB, patch)
2012-11-05 10:50 PST
,
Kentaro Hara
no flags
Details
Formatted Diff
Diff
patch for landing
(3.18 KB, patch)
2012-11-06 01:37 PST
,
Kentaro Hara
no flags
Details
Formatted Diff
Diff
patch for landing
(3.18 KB, patch)
2012-11-06 03:37 PST
,
Kentaro Hara
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Kentaro Hara
Comment 1
2012-11-05 00:38:33 PST
Created
attachment 172284
[details]
Patch
Adam Barth
Comment 2
2012-11-05 07:47:24 PST
Comment on
attachment 172284
[details]
Patch What if other folks have a reference to the v8 object? After this change, won't they have a use-after-free if they try to access the wrapped object? In the DOM case, we only remove objects from the wrapper map when we get a weak handle callback. In the case of NP objects, we can remove them when asked to do so explicitly by the plugin (you might want to check that I'm right about that---it's from memory).
Kentaro Hara
Comment 3
2012-11-05 07:50:15 PST
(In reply to
comment #2
)
> (From update of
attachment 172284
[details]
) > What if other folks have a reference to the v8 object? After this change, won't they have a use-after-free if they try to access the wrapped object?
Just after this setDOMWrapper(wrapper, 0), the wrapper handle is immediately disposed and cleared. This means that other folks should not have a reference to the V8 object, doesn't it?
Adam Barth
Comment 4
2012-11-05 08:25:53 PST
> Just after this setDOMWrapper(wrapper, 0), the wrapper handle is immediately disposed and cleared. This means that other folks should not have a reference to the V8 object, doesn't it?
No, that just means that we don't have a reference anymore. There could be other handles to the object, either local or persistent or internal to the JS VM.
Kentaro Hara
Comment 5
2012-11-05 08:39:17 PST
(In reply to
comment #4
)
> > Just after this setDOMWrapper(wrapper, 0), the wrapper handle is immediately disposed and cleared. This means that other folks should not have a reference to the V8 object, doesn't it? > > No, that just means that we don't have a reference anymore. There could be other handles to the object, either local or persistent or internal to the JS VM.
Yeah, makes sense... but that sounds like another problem. In bindings (even in V8NPObject.cpp), we do not do a null check for the result of toNative(handle). If there were other folks holding a handle to the wrapper, the folks might retrieve null pointers from internal fields and use them.
Adam Barth
Comment 6
2012-11-05 10:04:16 PST
I think only NP objects need to null-check toNative.
Kentaro Hara
Comment 7
2012-11-05 10:31:03 PST
(In reply to
comment #6
)
> I think only NP objects need to null-check toNative.
Thanks, now I understood things. As far as I scanned the code, the only place where toNative(npObjectWrapper) is called is weakNPObjectCallback() in V8NPObject.cpp. Just after toNative(npObjectWrapper), we have an ASSERT() that checks if the retrieved npObject is not NULL. So, the world is working safely.
Kentaro Hara
Comment 8
2012-11-05 10:50:06 PST
Reopening to attach new patch.
Kentaro Hara
Comment 9
2012-11-05 10:50:09 PST
Created
attachment 172363
[details]
Patch
Adam Barth
Comment 10
2012-11-05 14:02:10 PST
Comment on
attachment 172363
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=172363&action=review
> Source/WebCore/bindings/v8/V8DOMWrapper.h:77 > + static void resetDOMWrapper(v8::Handle<v8::Object> object, WrapperTypeInfo* type)
resetDOMWrapper -> clearDOMWrapper?
Kentaro Hara
Comment 11
2012-11-06 01:37:48 PST
Created
attachment 172519
[details]
patch for landing
WebKit Review Bot
Comment 12
2012-11-06 03:34:59 PST
Comment on
attachment 172519
[details]
patch for landing Rejecting
attachment 172519
[details]
from commit-queue. Failed to run "['/mnt/git/webkit-commit-queue/Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '-..." exit_code: 1 ERROR: /mnt/git/webkit-commit-queue/Source/WebCore/ChangeLog neither lists a valid reviewer nor contains the string "Unreviewed" or "Rubber stamp" (case insensitive). Full output:
http://queues.webkit.org/results/14690390
Kentaro Hara
Comment 13
2012-11-06 03:37:37 PST
Created
attachment 172542
[details]
patch for landing
WebKit Review Bot
Comment 14
2012-11-06 05:21:09 PST
Comment on
attachment 172542
[details]
patch for landing Clearing flags on attachment: 172542 Committed
r133589
: <
http://trac.webkit.org/changeset/133589
>
WebKit Review Bot
Comment 15
2012-11-06 05:21:12 PST
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug