Closed Bug 2020616 Opened 8 months ago Closed 8 months ago

Ion JIT Miscompilation: Dead-Code Private Field Class + Recursive Method Dispatch Produces Wrong Results and OOB

Categories

(Core :: JavaScript Engine: JIT, defect, P5)

Firefox 150
defect

Tracking

()

RESOLVED INVALID

People

(Reporter: amolnaik4, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: reporter-external)

Attachments

(2 files)

731 bytes, text/javascript
Details
2.58 KB, text/javascript
Details
Attached file poc.js —

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

Attached file poc-oob.js —

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

Group: core-security → javascript-core-security

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.

Blocks: sm-security
Severity: -- → S4
Status: UNCONFIRMED → RESOLVED
Closed: 8 months ago
Priority: -- → P5
Resolution: --- → INVALID

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).

Group: javascript-core-security
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: