Ion JIT Miscompilation: Dead-Code Private Field Class + Recursive Method Dispatch Produces Wrong Results and OOB
Categories
(Core :: JavaScript Engine: JIT, defect, P5)
Tracking
()
People
(Reporter: amolnaik4, Unassigned)
References
(Blocks 1 open bug)
Details
(Keywords: reporter-external)
Attachments
(2 files)
Steps to reproduce:
I found a JIT miscompilation issue where dead code private class field with recursive method dispatch produces wrong results and out-of-bound access.
version: JavaScript-C150.0a1
Actual results:
Download & run the attached poc as follows:
$ /path/to/js --no-ion --no-baseline --fuzzing-safe --disable-oom-functions poc.js
Checksum: 2.3072532794389332e+209
$ /path/to/js --baseline-warmup-threshold=10 --ion-warmup-threshold=100 --ion-offthread-compile=off --fuzzing-safe --disable-oom-functions poc.js
Checksum: 9.705253256751504e+206
Expected results:
Both commands should produce same checksum
Attaching another poc to demonstrate oob read access (poc-oob.js)
$ /path/to/js --no-ion --no-baseline --fuzzing-safe --disable-oom-functions poc-oob.js
=== SpiderMonkey Ion JIT OOB Read PoC ===
Corrupted checksum: 2.3072532794389332e+209
IEEE 754 low32: 0xf79b5f19
Computed index: 1 (array size: 8)
[] In-bounds index: 1 (correct execution path)
[] target[1] = 2.5
$ /path/to/js --baseline-warmup-threshold=10 --ion-warmup-threshold=100 --ion-offthread-compile=off --fuzzing-safe --disable-oom-functions poc-oob.js
=== SpiderMonkey Ion JIT OOB Read PoC ===
Corrupted checksum: 9.705253256751504e+206
IEEE 754 low32: 0x5590cebf
Computed index: 23 (array size: 8)
[!!!] OUT-OF-BOUNDS INDEX: 23 >= 8
[!!!] Reading 15 elements (120 bytes) past Float64Array boundary
[*] target[23] = undefined
Updated•8 months ago
|
Comment 2•8 months ago
|
||
Just reading the POC, I do not see any C++ out-of-bound issues from what I can read. JS OOB are supposed to be defined by the spec.
The differential behavior could be explained by something simpler, which is the difference of stack depth that we have with different modes of executions.
Thus having different number of multiplications executed based on the different stack consumption between the interpreter and Ion sounds like the most plausible explanation.
I am going to mark this bug as invalid unless you can reproduce it without the stack overflow / try-catch statement.
Comment 3•8 months ago
|
||
For differential testing like this, you should pass the --differential-testing shell flag too. It disables some sources of non-determinism and will print a message for things like overrecursion exceptions (that you can then check for in the harness).
Updated•3 months ago
|
Description
•