IonMonkey: Assertion failure: ionInlineFrames_.numActualArgs() <= ionInlineFrames_.callee()->nargs, at vm/Stack.cpp:1496 or Crash [@ js::StackFrame::isFunctionFrame]




7 years ago
6 years ago


(Reporter: decoder, Assigned: nbp)


(Blocks: 1 bug, {assertion, testcase})

Other Branch
assertion, testcase
Dependency tree / graph
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)


(Whiteboard: [jsbugmon:update,ignore])


(1 attachment, 1 obsolete attachment)



7 years ago
The following testcase asserts on ionmonkey revision e8de64e7e9fe (run with --ion -n -m --ion-eager):

function f2() {
  return f2.arguments;
actual = (f2() == null);
actual = (f2(0) == null);

Comment 1

7 years ago
Crashes only in debug build but I cannot judge if that is coincidence or not. Crash trace when stepping through assertions:

Assertion failure: Crossing fingers: Unable to read snapshot slot., at ../ion/IonFrameIterator.h:224

Program received signal SIGABRT, Aborted.

Program received signal SIGSEGV, Segmentation fault.
0x000000000040681c in js::StackFrame::isFunctionFrame (this=0x6d65) at ../../vm/Stack.h:462
462             return !!(flags_ & FUNCTION);
Missing separate debuginfos, use: debuginfo-install libgcc-4.4.6-3.el6.x86_64 libstdc++-4.4.6-3.el6.x86_64
(gdb) bt 8
#0  0x000000000040681c in js::StackFrame::isFunctionFrame (this=0x6d65) at ../../vm/Stack.h:462
#1  0x0000000000639e7c in js::StackFrame::functionScript (this=0x6d65) at ../vm/Stack.h:622
#2  0x00007f0700000002 in ?? ()
#3  0xffffffff00000001 in ?? ()
#4  0x00007fffffffb600 in ?? ()
#5  0x00007fffffffb620 in ?? ()
#6  0x00007f0700000002 in ?? ()
#7  0xffffffff00000001 in ?? ()
(More stack frames follow...)
(gdb) x /i $pc
=> 0x40681c <js::StackFrame::isFunctionFrame() const+12>:       mov    (%rax),%eax
(gdb) info reg rax
rax            0x6d65   28005

Comment 2

7 years ago
I added this code because this case is not handled yet.  Currently we are not mapping all arguments of the function, only the expected number of arguments and add Undefined arguments as padding if not provided.

So if the number of actual argument is larger than the number of formal argument, which explain why we have this assertion.  Eager compilation cause f2 to be compiled and when f2.arguments tries to create an unexpected argument object, it needs to recover them from the Ion stack.

Sadly we have no current way to detect such cases ahead enough to avoid entering the ion code which is shrinking the argument vector.
Assignee: general → nicolas.b.pierron

Comment 3

7 years ago
Created attachment 624427 [details] [diff] [review]
f.arguments: Recover overflow of arguments from the stack.

This patch should fix the current bug but it also introduce a problem in case of bailouts with an overflow of arguments which is not yet handled and will be fixed in a follow-up bug/patch.
Attachment #624427 - Flags: review?(dvander)

Comment 4

7 years ago
Created attachment 624439 [details] [diff] [review]
f.arguments: Recover overflow of arguments from the stack.

The same except that this fix an additional bug SnapshotIterator::hasLocation which raised when I added one formal argument in the test case.
Attachment #624427 - Attachment is obsolete: true
Attachment #624427 - Flags: review?(dvander)
Attachment #624439 - Flags: review?(dvander)
Comment on attachment 624439 [details] [diff] [review]
f.arguments: Recover overflow of arguments from the stack.

Review of attachment 624439 [details] [diff] [review]:

::: js/src/ion/Ion.cpp
@@ +960,5 @@
>          argv = fp->formalArgs() - 1;
> +        if (fp->hasOverflowArgs()) {
> +            argc = fp->numActualArgs() + 1;
> +            argv = fp->actualArgs() - 1;
> +        }

nit: It might read better to put the initial argc/argv assignment in an else branch.

::: js/src/ion/IonFrameIterator-inl.h
@@ +65,5 @@
> +        // Currently inlining does not support overflow of arguments, we have to
> +        // add this feature in IonBuilder.cpp and in Bailouts.cpp before
> +        // continuing. We need to add it to Bailouts.cpp because we need to know
> +        // how to walk over the oveflow of arguments.
> +        JS_ASSERT(end <= nformal);

nit: Please brace this if/else (comment makes it multi-line)
Attachment #624439 - Flags: review?(dvander) → review+


7 years ago
Blocks: 755979

Comment 6

7 years ago
No longer blocks: 755979
Last Resolved: 7 years ago
Resolution: --- → FIXED

Comment 7

7 years ago
Previous commits have been reverted, due to errors on tbpl.
Resolution: FIXED → ---
status-firefox-esr10: --- → unaffected

Comment 8

7 years ago
JSBugMon: The testcase found in this bug no longer reproduces (tried revision 8c54899dae82).


7 years ago
Whiteboard: [jsbugmon:update] → [jsbugmon:update,ignore]

Comment 9

7 years ago
Group: core-security
Last Resolved: 7 years ago7 years ago
status-firefox-esr10: unaffected → ---
Resolution: --- → FIXED

Comment 10

6 years ago
A testcase for this bug was automatically identified at js/src/jit-test/tests/ion/bug754720.js.
Flags: in-testsuite+
You need to log in before you can comment on or make changes to this bug.