Closed Bug 1006811 Opened 10 years ago Closed 10 years ago

Assertion failure: is<T>(), at jsobj.h:1130 or Crash [@ js::types::TypeSet::mightBeMIRType] with Proxy

Categories

(Core :: JavaScript Engine: JIT, defect)

x86_64
Linux
defect
Not set
critical

Tracking

()

VERIFIED FIXED
mozilla32
Tracking Status
firefox30 --- unaffected
firefox31 + verified
firefox32 + verified
firefox-esr24 --- unaffected
b2g-v1.2 --- unaffected
b2g-v1.3 --- unaffected
b2g-v1.3T --- unaffected
b2g-v1.4 --- unaffected
b2g-v2.0 --- fixed

People

(Reporter: decoder, Assigned: h4writer)

Details

(4 keywords, Whiteboard: [jsbugmon:update])

Attachments

(2 files)

The following testcase asserts on mozilla-central revision 87c8f870e2b9 (run with --fuzzing-safe --ion-eager):


var proxy = Proxy.createFunction({}, function() { return "call"; });
assertEq(Function.prototype.bind.call(proxy)(), "call");
while ( actual = testfunc(0) ) var objRef = obj;
Crash trace from opt-build:


Program received signal SIGSEGV, Segmentation fault.
js::types::TypeSet::mightBeMIRType (this=0xba9050509008a6e, type=js::jit::MIRType_Undefined) at jsscript.cpp:3869
3869	}
(gdb) bt 16
#0  js::types::TypeSet::mightBeMIRType (this=0xba9050509008a6e, type=js::jit::MIRType_Undefined) at jsscript.cpp:3869
#1  0x00000000005a8159 in ArgumentTypesMatch (calleeTypes=<optimized out>, def=<optimized out>) at jit/IonBuilder.cpp:5235
#2  ArgumentTypesMatch (calleeTypes=<optimized out>, def=<optimized out>) at jit/IonBuilder.cpp:5239
#3  js::jit::IonBuilder::testNeedsArgumentCheck (this=<optimized out>, target=0x7ffff4f52d40, callInfo=...) at jit/IonBuilder.cpp:5252
#4  0x00000000005a8366 in js::jit::IonBuilder::makeCallHelper (this=0x15d5d50, target=0x7ffff4f52d40, callInfo=..., cloneAtCallsite=false) at jit/IonBuilder.cpp:5338
#5  0x00000000005b54de in js::jit::IonBuilder::makeCall (this=0x15d5d50, target=<optimized out>, callInfo=..., cloneAtCallsite=<optimized out>) at jit/IonBuilder.cpp:5372
#6  0x0000000000613bc8 in js::jit::IonBuilder::inlineBoundFunction (this=0x15d5d50, nativeCallInfo=..., target=0x7ffff4f52d80) at jit/MCallOptimize.cpp:1952
#7  0x00000000005d3815 in inlineSingleCall (target=0x7ffff4f52d80, callInfo=..., this=0x15d5d50) at jit/IonBuilder.cpp:4295
#8  js::jit::IonBuilder::inlineCallsite (this=0x15d5d50, targets=..., originals=..., lambda=false, callInfo=...) at jit/IonBuilder.cpp:4342
#9  0x00000000005d3d48 in js::jit::IonBuilder::jsop_call (this=0x15d5d50, argc=0, constructing=false) at jit/IonBuilder.cpp:5155
#10 0x00000000005d4f8d in js::jit::IonBuilder::inspectOpcode (this=0x15d5d50, op=<optimized out>) at jit/IonBuilder.cpp:1593
#11 0x00000000005d5584 in js::jit::IonBuilder::traverseBytecode (this=0x15d5d50) at jit/IonBuilder.cpp:1284
#12 0x00000000005d606f in build (this=0x15d5d50) at jit/IonBuilder.cpp:740
#13 js::jit::IonBuilder::build (this=0x15d5d50) at jit/IonBuilder.cpp:628
#14 0x00000000005ef260 in IonCompile (optimizationLevel=js::jit::Optimization_Normal, recompile=false, executionMode=<optimized out>, constructing=<optimized out>, osrPc=<optimized out>, 
    baselineFrame=0x15d5cd8, script=<optimized out>, cx=0x159e000) at jit/Ion.cpp:1897
#15 js::jit::Compile (cx=0x159e000, script=..., osrFrame=0x15d5cd8, osrPc=<optimized out>, constructing=<optimized out>, executionMode=<optimized out>)
    at jit/Ion.cpp:2122
(More stack frames follow...)
(gdb) x /i $pc
=> 0x6eab40 <js::types::TypeSet::mightBeMIRType(js::jit::MIRType)>:	mov    (%rdi),%edx
(gdb) info reg rdi
rdi            0xba9050509008a6e	840208324665313902


That object pointer looks pretty bad, marking sec-critical.
Keywords: crash, sec-critical
Whiteboard: [jsbugmon:update,bisect]
Whiteboard: [jsbugmon:update,bisect] → [jsbugmon:update]
JSBugMon: Bisection requested, failed due to error (try manually).
I need to find out what's wrong with the bisection attempt, and/or try and get a bisection result.
Component: JavaScript Engine → JavaScript Engine: JIT
Flags: needinfo?(gary)
Can't help here - I cannot reproduce on local 64-bit deterministic threadsafe Linux debug/opt builds on 87c8f870e2b9 nor tip, and I also cannot reproduce using downloaded TBPL js binaries.
Flags: needinfo?(gary) → needinfo?(choller)
(and unlike bug 1006885, running this testcase repeatedly still doesn't show the issue for me.)
Retaking. I can reproduce with "--ion-parallel-compile=off --ion-eager".
Flags: needinfo?(choller) → needinfo?(gary)
autoBisect shows this is probably related to the following changeset:

The first bad revision is:
changeset:   http://hg.mozilla.org/mozilla-central/rev/53649d31c8b4
user:        Hannes Verschore
date:        Mon Apr 28 13:44:13 2014 +0200
summary:     Bug 1001850 - IonMonkey: Remove the intermediate native call when calling a bound function, r=jandem

Hannes, is bug 1001850 a likely regressor?
Flags: needinfo?(gary) → needinfo?(hv1989)
Attached patch PatchSplinter Review
We should definitely check the object is a function before casting it to a function.
Assignee: nobody → hv1989
Attachment #8420355 - Flags: review?(jdemooij)
Flags: needinfo?(hv1989)
Attachment #8420355 - Flags: review?(jdemooij) → review+
Comment on attachment 8420355 [details] [diff] [review]
Patch

[Security approval request comment]
How easily could an exploit be constructed based on the patch?
We know it can crash and do wrong things, but I didn't try to write an exploit. Shouldn't be to hard.

Do comments in the patch, the check-in comment, or tests included in the patch paint a bulls-eye on the security problem?
No extra info in the comments/tests/check-in comment

Which older supported branches are affected by this flaw?
FF31/FF32 only

If not all supported branches, which bug introduced the flaw?
Bug 1001850

Do you have backports for the affected branches? If not, how different, hard to create, and risky will they be?
They are all the same

How likely is this patch to cause regressions; how much testing does it need?
Not likeley. It reverts to use the old path, which is still tested and was used before.
Attachment #8420355 - Flags: sec-approval?
Comment on attachment 8420355 [details] [diff] [review]
Patch

sec-approval+ for trunk. Let's get an aurora patch made (if existing doesn't apply) and nominate it or this for aurora as well.
Attachment #8420355 - Flags: sec-approval? → sec-approval+
Group: javascript-core-security
Comment on attachment 8420355 [details] [diff] [review]
Patch

[Approval Request Comment]
Bug caused by (feature/regressing bug #): Bug 1001850
User impact if declined: Possible crashes and exploits
Testing completed (on m-c, etc.): m-c just landed
Risk to taking this patch (and alternatives if risky): low. For impacted path this patch takes the old path again.
String or IDL/UUID changes made by this patch: /
Attachment #8420355 - Flags: approval-mozilla-aurora?
https://hg.mozilla.org/mozilla-central/rev/7dabcbd22f09
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla32
Attachment #8420355 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Status: RESOLVED → VERIFIED
JSBugMon: This bug has been automatically verified fixed.
Group: javascript-core-security
JSBugMon: This bug has been automatically verified fixed on Fx31
JSBugMon: This bug has been automatically verified fixed on Fx32
Group: core-security → core-security-release
Group: core-security-release
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: