Closed Bug 1205327 Opened 11 years ago Closed 11 years ago

Crash [@ (anonymous namespace)::ModuleValidator::finishFunctionBodies]

Categories

(Core :: JavaScript Engine, defect)

x86_64
Linux
defect
Not set
critical

Tracking

()

VERIFIED FIXED
Tracking Status
firefox43 --- verified

People

(Reporter: decoder, Unassigned)

Details

(Keywords: crash, regression, testcase, Whiteboard: [jsbugmon:update,ignore])

Crash Data

The following testcase crashes on mozilla-central revision 9ed17db42e3e (build with --enable-optimize --enable-posix-nspr-emulation --enable-valgrind --enable-gczeal --disable-tests --enable-debug, run with --fuzzing-safe): function oomTest(f) { var i = 1; do { try { oomAtAllocation(i); f(); } catch (e) {} more = resetOOMFailure(); i++; } while(more); } for (lfLocal in this) { } oomTest(function () { eval('function AsmModule(stdlib, foreign, heap) { "use asm";'); }); Backtrace: Program received signal SIGSEGV, Segmentation fault. (anonymous namespace)::ModuleValidator::finishFunctionBodies (this=this@entry=0x7fffffff8460, compileResults=compileResults@entry=0x7fffffff83b0) at js/src/asmjs/AsmJSValidate.cpp:1363 #0 (anonymous namespace)::ModuleValidator::finishFunctionBodies (this=this@entry=0x7fffffff8460, compileResults=compileResults@entry=0x7fffffff83b0) at js/src/asmjs/AsmJSValidate.cpp:1363 #1 0x00000000005c20fb in CheckModule (compilationTimeReport=0x7fffffff8390, moduleOut=0x7fffffff83a0, stmtList=0x7fffffff8790, parser=..., cx=<optimized out>) at js/src/asmjs/AsmJSValidate.cpp:12389 #2 js::ValidateAsmJS (cx=<optimized out>, parser=..., stmtList=stmtList@entry=0x7ffff699c2b0, validated=validated@entry=0x7fffffff8790) at js/src/asmjs/AsmJSValidate.cpp:12470 #3 0x00000000004c52ca in js::frontend::Parser<js::frontend::FullParseHandler>::asmJS (this=this@entry=0x7fffffff9cc0, list=0x7ffff699c2b0) at js/src/frontend/Parser.cpp:2987 #4 0x00000000004d9c4f in js::frontend::Parser<js::frontend::FullParseHandler>::maybeParseDirective (this=this@entry=0x7fffffff9cc0, list=list@entry=0x7ffff699c2b0, pn=pn@entry=0x7ffff699c320, cont=cont@entry=0x7fffffff8810) at js/src/frontend/Parser.cpp:3062 #5 0x00000000004f770c in js::frontend::Parser<js::frontend::FullParseHandler>::statements (this=this@entry=0x7fffffff9cc0, yieldHandling=yieldHandling@entry=js::frontend::YieldIsName) at js/src/frontend/Parser.cpp:3128 #6 0x00000000004f7a8b in js::frontend::Parser<js::frontend::FullParseHandler>::functionBody (this=this@entry=0x7fffffff9cc0, inHandling=inHandling@entry=js::frontend::InAllowed, yieldHandling=yieldHandling@entry=js::frontend::YieldIsName, kind=kind@entry=js::frontend::Statement, type=type@entry=js::frontend::Parser<js::frontend::FullParseHandler>::StatementListBody) at js/src/frontend/Parser.cpp:1141 #7 0x00000000004f8017 in js::frontend::Parser<js::frontend::FullParseHandler>::functionArgsAndBodyGeneric (this=this@entry=0x7fffffff9cc0, inHandling=inHandling@entry=js::frontend::InAllowed, yieldHandling=yieldHandling@entry=js::frontend::YieldIsName, pn=pn@entry=0x7ffff699c120, fun=fun@entry=..., kind=kind@entry=js::frontend::Statement) at js/src/frontend/Parser.cpp:2809 #8 0x00000000004ce5c9 in js::frontend::Parser<js::frontend::FullParseHandler>::functionArgsAndBody (this=this@entry=0x7fffffff9cc0, inHandling=inHandling@entry=js::frontend::InAllowed, pn=0x7ffff699c120, fun=..., fun@entry=..., kind=kind@entry=js::frontend::Statement, generatorKind=generatorKind@entry=js::NotGenerator, inheritedDirectives=..., newDirectives=newDirectives@entry=0x7fffffff8e40) at js/src/frontend/Parser.cpp:2613 #9 0x00000000004f851a in js::frontend::Parser<js::frontend::FullParseHandler>::functionDef (this=this@entry=0x7fffffff9cc0, inHandling=inHandling@entry=js::frontend::InAllowed, yieldHandling=yieldHandling@entry=js::frontend::YieldIsName, funName=..., funName@entry=..., kind=kind@entry=js::frontend::Statement, generatorKind=generatorKind@entry=js::NotGenerator, invoked=invoked@entry=js::frontend::Parser<js::frontend::FullParseHandler>::PredictUninvoked) at js/src/frontend/Parser.cpp:2443 #10 0x00000000004f87fd in js::frontend::Parser<js::frontend::FullParseHandler>::functionStmt (this=this@entry=0x7fffffff9cc0, yieldHandling=yieldHandling@entry=js::frontend::YieldIsName, defaultHandling=defaultHandling@entry=js::frontend::NameRequired) at js/src/frontend/Parser.cpp:2893 #11 0x00000000004f721d in js::frontend::Parser<js::frontend::FullParseHandler>::statement (this=this@entry=0x7fffffff9cc0, yieldHandling=yieldHandling@entry=js::frontend::YieldIsName, canHaveDirectives=<optimized out>) at js/src/frontend/Parser.cpp:6718 #12 0x00000000004f76c1 in js::frontend::Parser<js::frontend::FullParseHandler>::statements (this=this@entry=0x7fffffff9cc0, yieldHandling=yieldHandling@entry=js::frontend::YieldIsName) at js/src/frontend/Parser.cpp:3106 #13 0x00000000004d3191 in js::frontend::Parser<js::frontend::FullParseHandler>::evalBody (this=this@entry=0x7fffffff9cc0) at js/src/frontend/Parser.cpp:913 #14 0x0000000000635681 in BytecodeCompiler::compileScript (this=this@entry=0x7fffffff9640, scopeChain=..., scopeChain@entry=..., evalCaller=evalCaller@entry=...) at js/src/frontend/BytecodeCompiler.cpp:568 #15 0x0000000000635ad3 in js::frontend::CompileScript (cx=cx@entry=0x7ffff6907000, alloc=<optimized out>, scopeChain=scopeChain@entry=..., enclosingStaticScope=..., enclosingStaticScope@entry=..., evalCaller=evalCaller@entry=..., options=..., srcBuf=..., source_=0x7ffff7e74f40, extraSct=extraSct@entry=0x0, sourceObjectOut=sourceObjectOut@entry=0x0) at js/src/frontend/BytecodeCompiler.cpp:807 #16 0x00000000005b83a3 in EvalKernel (cx=cx@entry=0x7ffff6907000, args=..., evalType=evalType@entry=DIRECT_EVAL, caller=..., scopeobj=scopeobj@entry=..., pc=<optimized out>) at js/src/builtin/Eval.cpp:340 #17 0x00000000005b8a10 in js::DirectEval (cx=cx@entry=0x7ffff6907000, args=...) at js/src/builtin/Eval.cpp:476 #18 0x0000000000910ea4 in js::jit::DoCallFallback (cx=0x7ffff6907000, frame=0x7fffffffb408, stub_=<optimized out>, argc=<optimized out>, vp=0x7fffffffb3b8, res=...) at js/src/jit/BaselineIC.cpp:8890 #19 0x00007ffff7feef9f in ?? () [...] #47 0x0000000000000000 in ?? () rax 0x0 0 rbx 0x0 0 rcx 0x3 3 rdx 0x1 1 rsi 0x7fffffff83b0 140737488323504 rdi 0x0 0 rbp 0x7fffffff82e0 140737488323296 rsp 0x7fffffff8270 140737488323184 r8 0x0 0 r9 0x7ffff6a01018 140737331073048 r10 0x7ffff3312000 140737273470976 r11 0x7ffff33001e0 140737273397728 r12 0x7fffffff8460 140737488323680 r13 0x7fffffff8790 140737488324496 r14 0x7fffffff83b0 140737488323504 r15 0x7fffffff8460 140737488323680 rip 0x437e78 <(anonymous namespace)::ModuleValidator::finishFunctionBodies(js::ScopedJSDeletePtr<(anonymous namespace)::ModuleCompileResults>*)+76> => 0x437e78 <(anonymous namespace)::ModuleValidator::finishFunctionBodies(js::ScopedJSDeletePtr<(anonymous namespace)::ModuleCompileResults>*)+76>: mov 0xbd0(%rax),%rdx 0x437e7f <(anonymous namespace)::ModuleValidator::finishFunctionBodies(js::ScopedJSDeletePtr<(anonymous namespace)::ModuleCompileResults>*)+83>: cmp %rdx,%rbx The crash address being accessed here (0xbd0) is a little strange, could be pointer arithmetics on a nullptr which can be exploitable, so I'm marking this s-s until it is confirmed to be harmless.
Whiteboard: [jsbugmon:update,bisect] → [jsbugmon:update]
JSBugMon: Bisection requested, result: === Treeherder Build Bisection Results by autoBisect === The "good" changeset has the timestamp "20150902004523" and the hash "3a05ea83f1dd7994bd88b8551c50aa92864b051d". The "bad" changeset has the timestamp "20150902015023" and the hash "77537390836600a06a2c9ffa6474fb3ecc068ffe". Likely regression window: https://hg.mozilla.org/integration/mozilla-inbound/pushloghtml?fromchange=3a05ea83f1dd7994bd88b8551c50aa92864b051d&tochange=77537390836600a06a2c9ffa6474fb3ecc068ffe
This is a static near-null, so I don't think s-s. Benjamin: here's the basic fix (assuming calls to init() added below), but probably you want to apply on top of the big code-motion patch you're about to land. @@ -2457,20 +2457,25 @@ class MOZ_STACK_CLASS ModuleValidator // well. class MOZ_STACK_CLASS ModuleCompiler { ModuleCompileInputs compileInputs_; ScopedJSDeletePtr<ModuleCompileResults> compileResults_; public: explicit ModuleCompiler(const ModuleCompileInputs& inputs) - : compileInputs_(inputs), - compileResults_(js_new<ModuleCompileResults>()) + : compileInputs_(inputs) {} + bool init() + { + compileResults_.reset(js_new<ModuleCompileResults>()); + return !!compileResults_; + }
Thanks for the heads up, I've added this to the big code-motion patch. It creates another fallible path on the compiler thread I'll have to take into account...
Whiteboard: [jsbugmon:update] → [jsbugmon:update,ignore]
JSBugMon: The testcase found in this bug no longer reproduces (tried revision 3929b8fc6c33).
Fixed by landing the refactoring patch (part 1) in bug 1157624.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Status: RESOLVED → VERIFIED
JSBugMon: This bug has been automatically verified fixed.
Group: javascript-core-security → core-security-release
Did this affect Firefox 42?
Flags: needinfo?(choller)
I don't know but comment 2 seems to indicate there is no security risk. Opening up the bug.
Group: core-security-release
Flags: needinfo?(choller)
You need to log in before you can comment on or make changes to this bug.