Closed Bug 1554113 Opened 7 years ago Closed 7 years ago

Self-hosted JavaScript assertion info: "js/src/builtin/TypedObject.js:255: Unhandled scalar type: 10"

Categories

(Core :: JavaScript Engine, defect, P1)

x86_64
Linux
defect

Tracking

()

RESOLVED FIXED
mozilla70
Tracking Status
firefox-esr60 --- unaffected
firefox-esr68 --- disabled
firefox67 --- unaffected
firefox68 --- disabled
firefox69 --- disabled
firefox70 --- fixed

People

(Reporter: decoder, Assigned: wingo)

References

Details

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

Attachments

(1 external file)

The following testcase crashes on mozilla-central revision 840b7106d8ae (build with --enable-posix-nspr-emulation --enable-valgrind --enable-gczeal --disable-tests --disable-profiling --enable-debug --enable-optimize, run with --fuzzing-safe --ion-offthread-compile=off):

var T = TypedObject;
x = T.biguint64;
var ST = new T.StructType({ x });
new ST({});

Backtrace:

received signal SIGSEGV, Segmentation fault.
#0  intrinsic_AssertionFailed (cx=cx@entry=0x7ffff5f19000, argc=<optimized out>, vp=<optimized out>) at js/src/vm/SelfHosting.cpp:459
#1  0x000055555591130f in CallJSNative (cx=0x7ffff5f19000, native=native@entry=0x555555cab2b0 <intrinsic_AssertionFailed(JSContext*, unsigned int, JS::Value*)>, args=...) at js/src/vm/Interpreter.cpp:446
#2  0x00005555559086d9 in js::InternalCallOrConstruct (cx=<optimized out>, cx@entry=0x7ffff5f19000, args=..., construct=construct@entry=js::NO_CONSTRUCT) at js/src/vm/Interpreter.cpp:538
#3  0x0000555555908e1d in InternalCall (cx=0x7ffff5f19000, args=...) at js/src/vm/Interpreter.cpp:593
#4  0x00005555558fa0f0 in js::CallFromStack (args=..., cx=<optimized out>) at js/src/vm/Interpreter.cpp:597
#5  Interpret (cx=0x7ffff5f19000, state=...) at js/src/vm/Interpreter.cpp:3085
#6  0x0000555555908156 in js::RunScript (cx=0x7ffff5f19000, state=...) at js/src/vm/Interpreter.cpp:423
#7  0x000055555590899f in js::InternalCallOrConstruct (cx=<optimized out>, cx@entry=0x7ffff5f19000, args=..., construct=construct@entry=js::NO_CONSTRUCT) at js/src/vm/Interpreter.cpp:566
#8  0x0000555555908e1d in InternalCall (cx=0x7ffff5f19000, args=...) at js/src/vm/Interpreter.cpp:593
#9  0x0000555555908f90 in js::Call (cx=<optimized out>, fval=..., fval@entry=..., thisv=..., thisv@entry=..., args=..., rval=...) at js/src/vm/Interpreter.cpp:609
#10 0x0000555555cd8796 in js::CallSelfHostedFunction (cx=<optimized out>, name=..., thisv=..., thisv@entry=..., args=..., rval=..., rval@entry=...) at js/src/vm/SelfHosting.cpp:1966
#11 0x0000555555dc03c4 in ConvertAndCopyTo (cx=<optimized out>, typeObj=typeObj@entry=..., typedObj=typedObj@entry=..., offset=offset@entry=0, name=..., name@entry=..., val=..., val@entry=...) at js/src/builtin/TypedObject.cpp:125
#12 0x0000555555dcfc7c in ConvertAndCopyTo (val=..., typedObj=..., cx=<optimized out>) at js/src/builtin/TypedObject.cpp:131
#13 js::TypedObject::construct (cx=<optimized out>, cx@entry=0x7ffff5f19000, argc=<optimized out>, vp=<optimized out>) at js/src/builtin/TypedObject.cpp:2314
#14 0x000055555591130f in CallJSNative (cx=0x7ffff5f19000, native=native@entry=0x555555dcf9d0 <js::TypedObject::construct(JSContext*, unsigned int, JS::Value*)>, args=...) at js/src/vm/Interpreter.cpp:446
[...]
#27 main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>) at js/src/shell/js.cpp:11399
rax	0x555557d01f20	93825033838368
rbx	0x7fffffffb9d0	140737488337360
rcx	0x555556b67421	93825015378977
rdx	0x0	0
rsi	0x7ffff6eeb770	140737336227696
rdi	0x7ffff6eea540	140737336223040
rbp	0x7fffffffba10	140737488337424
rsp	0x7fffffffb9b0	140737488337328
r8	0x7ffff6eeb770	140737336227696
r9	0x7ffff7fe6cc0	140737354034368
r10	0x58	88
r11	0x7ffff6b927a0	140737332717472
r12	0x263933200610	42027112728080
r13	0x7ffff5f19000	140737319636992
r14	0x7fffffffba48	140737488337480
r15	0x7ffff5f4e000	140737319854080
rip	0x555555cab30c <intrinsic_AssertionFailed(JSContext*, unsigned int, JS::Value*)+92>
=> 0x555555cab30c <intrinsic_AssertionFailed(JSContext*, unsigned int, JS::Value*)+92>:	movl   $0x0,0x0
   0x555555cab317 <intrinsic_AssertionFailed(JSContext*, unsigned int, JS::Value*)+103>:	ud2
Type: task → defect
Whiteboard: [jsbugmon:update,bisect] → [jsbugmon:update]
JSBugMon: Bisection requested, result: autoBisect shows this is probably related to the following changeset: The first bad revision is: changeset: https://hg.mozilla.org/mozilla-central/rev/efc786c70693 user: Robin Templeton date: Tue Apr 02 17:11:13 2019 +0000 summary: bug 1456569 - Implement BigInt64 and BigUint64Array. r=wingo,jwalden,sfink This iteration took 505.908 seconds to run.

Hi. Considering that the presumed regressor was pushed in firefox68, can we also set firefox68 as affected and firefox67 as unaffected?
Otherwise, I would like some pointers into how to reproduce these bugs. :) Thank you!

Flags: needinfo?(choller)
QA Whiteboard: [qa-regression-triage]

(In reply to Bodea Daniel [:danibodea] from comment #2)

Hi. Considering that the presumed regressor was pushed in firefox68, can we also set firefox68 as affected and firefox67 as unaffected?
Otherwise, I would like some pointers into how to reproduce these bugs. :) Thank you!

Sure, you can go ahead and the flags based on the bisection (for any of the bugs we file).

In order to reproduce this and other JS fuzzing bugs, you need a JS shell to run the test. See the beginning of

https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Introduction_to_the_JavaScript_shell

for more information on that.

Flags: needinfo?(choller)

Thanks for the quick reply!

Flags: needinfo?(robin)
QA Whiteboard: [qa-regression-triage]

Hi Steven, what is the priority on this one? (checking for regression triage)

Flags: needinfo?(robin) → needinfo?(sdetar)

Patricia, this should be a priority to address. I will set the priority to P1. But we should still keep the needinfo for Robin at Igalia to look at this.

Flags: needinfo?(sdetar) → needinfo?(robin)
Priority: -- → P1

Adding ni? on Andy as he reviewed the patch mentioned in comment 1.

Flags: needinfo?(wingo)

I'll look at this one today, tx for the ni?.

Assignee: nobody → wingo
Flags: needinfo?(wingo)

So, the deal is that TypedObjects only partially know about the bigint scalar type. There's some support for bigint in JS_FOR_EACH_UNIQUE_SCALAR_TYPE_REPR_CTYPE (https://searchfox.org/mozilla-central/source/js/src/builtin/TypedObject.h#276), but not in TypedObject.getScalar (https://searchfox.org/mozilla-central/source/js/src/builtin/TypedObject.js#87; this is the bug we're hitting here).

Less happily there is a generated load routine for (u)int64_t values which just casts the (u)int64_t to a double :-( :-( :-( -- https://searchfox.org/mozilla-central/source/js/src/builtin/TypedObject.cpp#2569.

Not sure what the plan is. Is TypedObject a standard thing? Is it sticking around and I should try to make the case for doing work here, or is it going away and I can ignore it?

Flags: needinfo?(robin) → needinfo?(sdetar)

Jason, would you know the answer to this or who on our team might?

Flags: needinfo?(sdetar) → needinfo?(jorendorff)

According to Till, typed objects are blocked on more clarity about the wasm GC proposal, but will eventually move ahead. It's sticking around.

Flags: needinfo?(jorendorff)
Flags: needinfo?(wingo)

Do we need a fix for 68 or can we ship with this? (Heading to release candidates next week)

Flags: needinfo?(jorendorff)

The problem only exists when TypedObjects are enabled, so it is a nightly-only problem.

Flags: needinfo?(jorendorff)

Hi, my understanding was that Robin has an in-progress patch for this. Apologies for the ni?-tag but Robin would you mind uploading the patch? Otherwise if I am mistaken I am happy to take this up.

Flags: needinfo?(wingo)
Flags: needinfo?(robin)

I'll take this bug.

Flags: needinfo?(robin)
Keywords: checkin-needed

Pushed by btara@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/43d9939e4ebd
Support (Big)Int64 fields in typed objects r=till

Keywords: checkin-needed

Backed out changeset 43d9939e4ebd (Bug 1554113) for TypedObject.cpp related failures

Push with failures: https://treeherder.mozilla.org/#/jobs?repo=autoland&fromchange=71fab7f49ff6290e69ddbd09a289e38871d2ccaf&searchStr=linux%2Cx64%2Cdebug%2Cspidermonkey%2Cbuilds%2Chazard-linux64-shell-haz%2Fdebug%2Csm%28h%29%2C7888ddd644c8d65c8b900cbab60babd1625a15f1&tochange=7d7830b79440ac5cfcfccd161768960452b7d56d&selectedJob=260545080

Backout link: https://hg.mozilla.org/integration/autoland/rev/7d7830b79440ac5cfcfccd161768960452b7d56d

Failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=260545080&repo=autoland&lineNumber=9026

[task 2019-08-08T08:36:13.168Z] PATH="/builds/worker/workspace/sixgill/usr/bin:${PATH}" SOURCE='/builds/worker/checkouts/gecko' ANALYZED_OBJDIR='/builds/worker/workspace/obj-analyzed' LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/builds/worker/workspace/obj-haz-shell/dist/bin" XDB='/builds/worker/workspace/sixgill/usr/bin/xdb.so' /builds/worker/workspace/obj-haz-shell/dist/bin/js /builds/worker/checkouts/gecko/js/src/devtools/rootAnalysis/analyzeRoots.js gcFunctions.lst gcEdges.txt limitedFunctions.lst gcTypes.txt typeInfo.txt 15 15 tmp.15 > rootingHazards.15
[task 2019-08-08T08:36:13.168Z] cat rootingHazards.1 rootingHazards.2 rootingHazards.3 rootingHazards.4 rootingHazards.5 rootingHazards.6 rootingHazards.7 rootingHazards.8 rootingHazards.9 rootingHazards.10 rootingHazards.11 rootingHazards.12 rootingHazards.13 rootingHazards.14 rootingHazards.15 > rootingHazards.txt
[task 2019-08-08T08:36:13.168Z] Running explain to generate ('hazards.txt', 'unnecessary.txt', 'refs.txt')
[task 2019-08-08T08:36:13.168Z] PATH="/builds/worker/workspace/sixgill/usr/bin:${PATH}" SOURCE='/builds/worker/checkouts/gecko' ANALYZED_OBJDIR='/builds/worker/workspace/obj-analyzed' LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/builds/worker/workspace/obj-haz-shell/dist/bin" XDB='/builds/worker/workspace/sixgill/usr/bin/xdb.so' python2.7 /builds/worker/checkouts/gecko/js/src/devtools/rootAnalysis/explain.py rootingHazards.txt gcFunctions.txt hazards.txt unnecessary.txt refs.txt
[task 2019-08-08T08:36:13.310Z] Wrote explained_hazards.tmp
[task 2019-08-08T08:36:13.310Z] Wrote unnecessary.tmp
[task 2019-08-08T08:36:13.310Z] Wrote refs.tmp
[task 2019-08-08T08:36:13.310Z] Found 2 hazards 38 unsafe references 0 missing
[task 2019-08-08T08:36:13.310Z] Running heapwrites to generate heapWriteHazards.txt
[task 2019-08-08T08:36:13.310Z] PATH="/builds/worker/workspace/sixgill/usr/bin:${PATH}" SOURCE='/builds/worker/checkouts/gecko' ANALYZED_OBJDIR='/builds/worker/workspace/obj-analyzed' LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/builds/worker/workspace/obj-haz-shell/dist/bin" XDB='/builds/worker/workspace/sixgill/usr/bin/xdb.so' /builds/worker/workspace/obj-haz-shell/dist/bin/js /builds/worker/checkouts/gecko/js/src/devtools/rootAnalysis/analyzeHeapWrites.js > heapWriteHazards.txt
[task 2019-08-08T08:36:15.587Z] + check_hazards /builds/worker/workspace/analysis
[task 2019-08-08T08:36:15.588Z] + set +e
[task 2019-08-08T08:36:15.588Z] ++ grep -c 'Function.*has unrooted.*live across GC call' /builds/worker/workspace/analysis/rootingHazards.txt
[task 2019-08-08T08:36:15.589Z] + NUM_HAZARDS=2
[task 2019-08-08T08:36:15.589Z] ++ grep -c '^Function.takes unsafe address of unrooted' /builds/worker/workspace/analysis/refs.txt
[task 2019-08-08T08:36:15.590Z] + NUM_UNSAFE=38
[task 2019-08-08T08:36:15.590Z] ++ grep -c '^Function.
has unnecessary root' /builds/worker/workspace/analysis/unnecessary.txt
[task 2019-08-08T08:36:15.592Z] + NUM_UNNECESSARY=1014
[task 2019-08-08T08:36:15.592Z] ++ grep -c '^Dropped CFG' /builds/worker/workspace/analysis/build_xgill.log
[task 2019-08-08T08:36:15.595Z] + NUM_DROPPED=0
[task 2019-08-08T08:36:15.595Z] ++ perl -lne 'print $1 if m!found (\d+)/\d+ allowed errors!' /builds/worker/workspace/analysis/heapWriteHazards.txt
[task 2019-08-08T08:36:15.596Z] + NUM_WRITE_HAZARDS=0
[task 2019-08-08T08:36:15.596Z] ++ grep -c '^Function.expected hazard.but none were found' /builds/worker/workspace/analysis/rootingHazards.txt
[task 2019-08-08T08:36:15.597Z] + NUM_MISSING=0
[task 2019-08-08T08:36:15.597Z] + set +x
[task 2019-08-08T08:36:15.597Z] TinderboxPrint: rooting hazards<br/>2
[task 2019-08-08T08:36:15.597Z] TinderboxPrint: (unsafe references to unrooted GC pointers)<br/>38
[task 2019-08-08T08:36:15.597Z] TinderboxPrint: (unnecessary roots)<br/>1014
[task 2019-08-08T08:36:15.597Z] TinderboxPrint: missing expected hazards<br/>0
[task 2019-08-08T08:36:15.597Z] TinderboxPrint: heap write hazards<br/>0
[task 2019-08-08T08:36:15.599Z] TEST-UNEXPECTED-FAIL | hazards | unrooted 'typedObj' of type 'js::TypedObject
' live across GC call at js/src/builtin/TypedObject.cpp:2783
[task 2019-08-08T08:36:15.599Z] TEST-UNEXPECTED-FAIL | hazards | unrooted 'typedObj' of type 'js::TypedObject
' live across GC call at js/src/builtin/TypedObject.cpp:2783
[task 2019-08-08T08:36:15.599Z] TEST-UNEXPECTED-FAIL | hazards | 2 rooting hazards detected
[task 2019-08-08T08:36:15.599Z] TinderboxPrint: documentation<br/><a href='https://wiki.mozilla.org/Javascript:Hazard_Builds#Diagnosing_a_rooting_hazards_failure'>static rooting hazard analysis failures</a>, visit "Inspect Task" link for hazard details
[task 2019-08-08T08:36:15.599Z] + onexit
[task 2019-08-08T08:36:15.599Z] + grab_artifacts /builds/worker/workspace/analysis /builds/worker/artifacts
[task 2019-08-08T08:36:15.599Z] + local analysis_dir
[task 2019-08-08T08:36:15.599Z] + analysis_dir=/builds/worker/workspace/analysis
[task 2019-08-08T08:36:15.599Z] + local artifacts
[task 2019-08-08T08:36:15.599Z] + artifacts=/builds/worker/artifacts
[task 2019-08-08T08:36:15.599Z] + cd /builds/worker/workspace/analysis
[task 2019-08-08T08:36:15.599Z] + ls -lah
[task 2019-08-08T08:36:15.601Z] total 592M

Flags: needinfo?(wingo)

Thank you and good catch, bots! Updated patch.

Flags: needinfo?(wingo)
Keywords: checkin-needed

Pushed by btara@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/3661ff622cec
Support (Big)Int64 fields in typed objects r=till

Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla70
Regressions: 1572714

Is this something we should consider uplifting to Beta for Fx69 or can this ride with Fx70 to release.

Flags: needinfo?(wingo)
Flags: in-testsuite+

Based on hazy watchings of this bug I'm moderately sure this requires Typed Object support be enabled to hit it, and Typed Objects are only enabled in nightly builds, so there's no reason to uplift this. But you should listen to someone actually paying attention and not drivebying before you stop worrying here. :-)

Waldo has it right -- this bug only affects nightly, so no need to uplift. In classic clownshoes fashion, the fix for it affected beta (bug 1572714)! But that's fixed too, so we're done I think.

Flags: needinfo?(wingo)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: