Closed
Bug 1137591
Opened 11 years ago
Closed 11 years ago
crash in xul.dll@0x1a42790 | SandboxCreateXMLHttpRequest trying to Cu.importGlobalProperties XMLHttpRequest onto a Window and then use it
Categories
(Core :: XPConnect, defect)
Tracking
()
RESOLVED
FIXED
mozilla39
| Tracking | Status | |
|---|---|---|
| firefox39 | --- | fixed |
People
(Reporter: markh, Assigned: bzbarsky)
References
Details
(Keywords: crash)
Crash Data
Attachments
(4 files, 1 obsolete file)
|
706 bytes,
application/javascript
|
Details | |
|
2.41 KB,
patch
|
bholley
:
review+
|
Details | Diff | Splinter Review |
|
1.95 KB,
patch
|
bholley
:
review+
|
Details | Diff | Splinter Review |
|
4.23 KB,
patch
|
bholley
:
review+
|
Details | Diff | Splinter Review |
This bug was filed from the Socorro interface and is
report bp-2faefff1-db61-4ba7-ade1-af5e62150227.
=============================================================
On a locally built nightly and from the normal nightly channel I can reliably crash when I execute the attached file in a "browser" scratchpad.
| Assignee | ||
Updated•11 years ago
|
Flags: needinfo?(bzbarsky)
| Reporter | ||
Comment 1•11 years ago
|
||
oops - I meant to mention that the script assumes a Firefox Account user is logged in :( I doubt it's related to that though.
| Reporter | ||
Comment 2•11 years ago
|
||
A version with no FxA requirements.
Attachment #8570333 -
Attachment is obsolete: true
| Reporter | ||
Comment 3•11 years ago
|
||
mozregression tells me:
> Got as far as we can go bisecting nightlies...
> Ensuring we have enough metadata to get a pushlog...
> Last good revision: cbe4f69c2e9c (2014-05-27)
> First bad revision: e017c15325ae (2014-05-28)
> Pushlog:
> https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=cbe4f69c2e9c&tochange=e017c15325ae
> ...
> Oh noes, no (more) inbound revisions :(
> do you want to bisect further by fetching the repository and building? (y or n) n
Given the age I didn't bother going further.
| Reporter | ||
Comment 4•11 years ago
|
||
I've only a "release" build handy, but in my debugger, the object passed to QI at http://hg.mozilla.org/mozilla-central/annotate/df3daecd381f/js/xpconnect/src/Sandbox.cpp#l207 appears to have a garbage vtable
| Assignee | ||
Comment 5•11 years ago
|
||
This script is doing this:
Cu.importGlobalProperties(["XMLHttpRequest"]);
This is meant to be used inside sandboxes and maybe JSMs, but the script is being run in a window global. We should probably make importGlobalProperties throw in that situation to start with.
Anyway, moving right along.... GlobalProperties::Define for the XMLHttpRequest case defines SandboxCreateXMLHttpRequest as the ctor. This function in assumes that the private value of the global is going to be an nsISupports. But Web IDL objects, including Window, have no private value, so in a debug build you get a nice assert and in an opt build you get garbage.
Since we do want to move at least backstagepass to Web IDL, if not sandboxes, we should also change SandboxCreateXMLHttpRequest to handle this situation.
That said, I wonder why we have SandboxCreateXMLHttpRequest at all. Why can we not use the normal XHR constructor in sandboxes/jsms? Or can we at this point?
Component: XUL → XPConnect
Flags: needinfo?(bzbarsky) → needinfo?(bobbyholley)
Summary: crash in xul.dll@0x1a42790 | SandboxCreateXMLHttpRequest → crash in xul.dll@0x1a42790 | SandboxCreateXMLHttpRequest trying to Cu.importGlobalProperties XMLHttpRequest onto a Window and then use it
| Assignee | ||
Comment 6•11 years ago
|
||
And of course the regression range here is when we turned on webidl bindings for window.
Comment 7•11 years ago
|
||
(In reply to Not doing reviews right now from comment #5)
> This script is doing this:
>
> Cu.importGlobalProperties(["XMLHttpRequest"]);
>
> This is meant to be used inside sandboxes and maybe JSMs, but the script is
> being run in a window global. We should probably make
> importGlobalProperties throw in that situation to start with.
Yes.
> Anyway, moving right along.... GlobalProperties::Define for the
> XMLHttpRequest case defines SandboxCreateXMLHttpRequest as the ctor. This
> function in assumes that the private value of the global is going to be an
> nsISupports. But Web IDL objects, including Window, have no private value,
> so in a debug build you get a nice assert and in an opt build you get
> garbage.
>
> Since we do want to move at least backstagepass to Web IDL, if not
> sandboxes, we should also change SandboxCreateXMLHttpRequest to handle this
> situation.
Agreed.
> That said, I wonder why we have SandboxCreateXMLHttpRequest at all. Why can
> we not use the normal XHR constructor in sandboxes/jsms? Or can we at this
> point?
I believe it predates WebIDL XHR. It's worth making sure that the WebIDL constructor doesn't expect Windows or Documents and works for System Principal though.
Flags: needinfo?(bobbyholley)
| Assignee | ||
Comment 8•11 years ago
|
||
OK, so the Web IDL ctor....
The binding part doesn't expect anything interesting, obviously.
nsXMLHttpRequest::Constructor expects an nsIGlobalObject and nsIScriptObjectPrincipal, which should be fine. There _will_ be a slight behavior change though: the Web IDL ctor will use the principal of the global the ctor lives in (so of the sandbox) while SandboxCreateXMLHttpRequest uses the subject principal (which could in theory be different if we can have Xrays into a sandbox via which we invoke the ctor, right?). Seems to me that this behavior change is OK.
Also, the subject principal and current compartment in the XHR C++ code will be the sandbox, not the maybe-Xray caller, in the new setup. It doesn't look to me like XHR ever uses those, so it's ok.
Apart from that, both the current codepath via the 5-arg form of nsXMLHttpRequest::Init with null passed for the last two args and the new codepath via the web idl ctor end up doing exactly the same things.
Comment 9•11 years ago
|
||
(In reply to Not doing reviews right now from comment #8)
> nsXMLHttpRequest::Constructor expects an nsIGlobalObject and
> nsIScriptObjectPrincipal, which should be fine. There _will_ be a slight
> behavior change though: the Web IDL ctor will use the principal of the
> global the ctor lives in (so of the sandbox) while
> SandboxCreateXMLHttpRequest uses the subject principal (which could in
> theory be different if we can have Xrays into a sandbox via which we invoke
> the ctor, right?). Seems to me that this behavior change is OK.
>
> Also, the subject principal and current compartment in the XHR C++ code will
> be the sandbox, not the maybe-Xray caller, in the new setup. It doesn't
> look to me like XHR ever uses those, so it's ok.
Hm, why is that? Shouldn't WebIDL ctors do the proper Xray semantics? I seem to remember some fussing about this (you and me and peterv had a call about it 2 years ago), but I always forget what we settled on.
| Assignee | ||
Comment 10•11 years ago
|
||
Attachment #8570617 -
Flags: review?(bobbyholley)
| Assignee | ||
Updated•11 years ago
|
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
| Assignee | ||
Comment 11•11 years ago
|
||
Attachment #8570618 -
Flags: review?(bobbyholley)
| Assignee | ||
Comment 12•11 years ago
|
||
> but I always forget what we settled on.
We settled on ctors entering the compartment of the global they live in and wrapping all arguments into that compartment.
Updated•11 years ago
|
Attachment #8570617 -
Flags: review?(bobbyholley) → review+
Updated•11 years ago
|
Attachment #8570618 -
Flags: review?(bobbyholley) → review+
| Assignee | ||
Comment 13•11 years ago
|
||
OK, the throwing bit is ... troublesome. I get test failures from some mochitest-chrome tests that include specialpowersAPI.js (which uses importGlobalProperties). There are also explicit calls to importGlobalProperties in other mochitest-chrome tests...
I'll see if I can fix the tests to stop doing this.
| Assignee | ||
Comment 14•11 years ago
|
||
Attachment #8570991 -
Flags: review?(bobbyholley)
Updated•11 years ago
|
Attachment #8570991 -
Flags: review?(bobbyholley) → review+
| Assignee | ||
Comment 15•11 years ago
|
||
Comment 16•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/d4f1b7962af4
https://hg.mozilla.org/mozilla-central/rev/2a034f03f773
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
status-firefox39:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla39
You need to log in
before you can comment on or make changes to this bug.
Description
•