Closed Bug 1819651 Opened 1 year ago Closed 1 year ago

Assertion failure: args.rval() != ObjectValue(*callee), at vm/Interpreter.cpp:492

Categories

(Core :: JavaScript Engine, defect)

x86_64
Linux
defect

Tracking

()

VERIFIED FIXED
112 Branch
Tracking Status
firefox-esr102 --- unaffected
firefox110 --- unaffected
firefox111 --- unaffected
firefox112 --- verified

People

(Reporter: decoder, Assigned: jandem)

References

(Regression)

Details

(Keywords: assertion, regression, testcase, Whiteboard: [bugmon:update,bisected,confirmed])

Attachments

(3 files)

The following testcase crashes on mozilla-central revision 20230228-bc3bdd8c19f8 (debug build, run with --fuzzing-safe --cpu-count=2 --ion-offthread-compile=off):

var func = function() {
  objResult = NewFunc;
  return objResult;
};
var NewFunc = Function.prototype.bind.call(func);
var newInstance = new NewFunc();

Backtrace:

received signal SIGSEGV, Segmentation fault.
0x0000555556d42303 in CallJSNativeConstructor(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), JS::CallArgs const&) ()
#0  0x0000555556d42303 in CallJSNativeConstructor(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), JS::CallArgs const&) ()
#1  0x0000555556d33e3b in InternalConstruct(JSContext*, js::AnyConstructArgs const&, js::CallReason) ()
#2  0x0000555556d28ae4 in Interpret(JSContext*, js::RunState&) ()
[...]
#11 0x0000555556b8ac8a in main ()
rax	0x555555879d4f	93824995532111
rbx	0x7ffff51630a8	140737305260200
rcx	0x5555582e6d08	93825040018696
rdx	0x0	0
rsi	0x7ffff6abd770	140737331844976
rdi	0x7ffff6abc540	140737331840320
rbp	0x7fffffffcdc0	140737488342464
rsp	0x7fffffffcd70	140737488342384
r8	0x7ffff6abd770	140737331844976
r9	0x7ffff7fe3840	140737354020928
r10	0x0	0
r11	0x0	0
r12	0x7fffffffcd78	140737488342392
r13	0x555558261270	93825039471216
r14	0x1	1
r15	0x3e6b69300618	68631047177752
rip	0x555556d42303 <CallJSNativeConstructor(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), JS::CallArgs const&)+963>
=> 0x555556d42303 <_Z23CallJSNativeConstructorP9JSContextPFbS0_jPN2JS5ValueEERKNS1_8CallArgsE+963>:	movl   $0x1ec,0x0
   0x555556d4230e <_Z23CallJSNativeConstructorP9JSContextPFbS0_jPN2JS5ValueEERKNS1_8CallArgsE+974>:	callq  0x555556c20f44 <abort>
Attached file Testcase
Flags: needinfo?(jdemooij)

Most likely a bogus assertion. In CallJSNativeConstructor we check that a native function doesn't return itself (often a bug because callee/rval use the same Value slot in our native call ABI), but a bound function constructor can return itself if that's what the bound function is doing. We probably just have to add it to the allowlist.

I'll take a closer look tomorrow.

Verified bug as reproducible on mozilla-central 20230301093735-d59b76766f0d.
The bug appears to have been introduced in the following build range:

Start: 9c3f71785d22cc144088970c41ba7779fe005d5b (20230227130037)
End: 443570c2740f2014644dcb6e1e35937b423b9c95 (20230227130952)
Pushlog: https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=9c3f71785d22cc144088970c41ba7779fe005d5b&tochange=443570c2740f2014644dcb6e1e35937b423b9c95

Whiteboard: [bugmon:update,bisect] → [bugmon:update,bisected,confirmed]
Regressed by: 1483869

Set release status flags based on info from the regressing bug 1483869

Assignee: nobody → jdemooij
Group: javascript-core-security
Status: NEW → ASSIGNED
Duplicate of this bug: 1819805
Flags: needinfo?(jdemooij)
Pushed by jdemooij@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a80f1935af57
Add bound function construct hook to allowlist in CallJSNativeConstructor. r=iain
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 112 Branch

Verified bug as fixed on rev mozilla-central 20230303155912-fa3134749ef0.
Removing bugmon keyword as no further action possible. Please review the bug and re-add the keyword for further analysis.

Status: RESOLVED → VERIFIED
Keywords: bugmon
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: