Open Bug 1835579 Opened 3 years ago Updated 1 year ago

Consdider censoring some return results from GC interfaces when doing differential fuzzing.

Categories

(Core :: JavaScript Engine, defect, P5)

Firefox 115
defect

Tracking

()

People

(Reporter: 2628388509, Unassigned)

References

(Blocks 1 open bug)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36

Steps to reproduce:

test.js

let g = newGlobal({
  newCompartment: true
});
evalcx("function f(x) { return {x: x}; }", g);
gc();
let initial = gcparam("gcNumber");
for (let i = 0; i < 1000; i++) {
  g.f(i);
  fuzzilli_hash(g);
  "gcNumber".localeCompare("1024")
}
let final = gcparam("gcNumber");
fuzzilli_hash(final);
print(final)

$ ./js --no-threads --differential-testing --blinterp-warmup-threshold=0 --baseline-warmup-threshold=0 --trial-inlining-warmup-threshold=0 --ion-warmup-threshold=3 test.js
output: 1
executionHash is 0x7fe00200 with 1001 inputs

$ ./js --no-threads --differential-testing --no-ion test.js
output: 2
executionHash is 0x80000200 with 1001 inputs

SpiderMonkey should be compiled with --enable-js-fuzzilli to enable fuzzilli_hash() in js.cpp.

If fuzzilli_hash(g) is commented, the result is no longer different. I am not sure if fuzzilli_hash has an effect on gc.

Actual results:

Differential testing generates different hash values when target is gcNumber.

Expected results:

Differential testing should generate the same hash value.

So, this is simply asking how many times GC occurred, and if it differs between having the JIT enabled and not. This isn't something we'd expect to stay the same.

Arguably, gcparam should be marked as fuzzing unsafe

Severity: -- → S4
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P5

(In general, when fuzzing it's important to include the --fuzzing-safe parameter, though I don't think that would have avoided this specific issue)

We probably want to check js::SupportDifferentialTesting() when returning the state of (some of) the gc parameters to JS.

Blocks: GC.stability
Summary: Differential testing generates different hash value when target is gcNumber → Consdider censoring some return results from GC interfaces when doing differential fuzzing.
You need to log in before you can comment on or make changes to this bug.