Bug 1557343 Comment 0 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

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

    function loadFile(lfVarx) {
      eval(lfVarx);
    }
    var g = newGlobal({newCompartment: true});
    g.parent = this;
    g.hits = 0;
    g.eval("new Debugger(parent).onExceptionUnwind = function () { hits++; };");
    loadFile(`
      function* g1() {}
      var o = g1();
      function* g3() {
        while (x && 0) {}
      }
      o = g3();
      try { v = o.next(); } catch(exc) {}
    `)
    loadFile(`
      L: do {    } while (
        class MyArrayBuffer extends ArrayBuffer {}
      );
    `);


Backtrace:

    received signal SIGSEGV, Segmentation fault.
    #0  0x000055555605a5a6 in JS::shadow::Realm::compartment (this=<optimized out>) at dist/include/js/Realm.h:50
    #1  JS::GetCompartmentForRealm (realm=<optimized out>) at /srv/jenkins/jobs/mozilla-central-build-jsshell/workspace/arch/64/compiler/gcc/instrumentation/none/type/debug/dist/include/js/Realm.h:60
    #2  js::ObjectGroup::compartment (this=0xfffe4b4b4b4b4b4b) at js/src/vm/ObjectGroup.h:212
    #3  JSObject::compartment (this=<optimized out>) at js/src/vm/JSObject.h:159
    #4  JSObject::maybeCompartment (this=<optimized out>) at js/src/vm/JSObject.h:160
    #5  _ZZN2js19CrossCompartmentKey11compartmentEvENKUlT_E_clIPPNS_12NativeObjectEEEDaS1_ (__closure=<optimized out>, tp=<optimized out>) at js/src/vm/Compartment.h:226
    #6  _ZN2js19CrossCompartmentKey21ApplyToWrappedMatcherIZNS0_11compartmentEvEUlT_E_EclINS_12NativeObjectEEEDaRNS0_8DebuggeeIS2_EE (this=<optimized out>, dbg=...) at js/src/vm/Compartment.h:185
    [...]
    #18 js::CrossCompartmentKey::compartment (this=<optimized out>) at js/src/vm/Compartment.h:226
    #19 js::gc::GCRuntime::markCompartments (this=this@entry=0x7ffff5f1c6a8) at js/src/gc/GC.cpp:4562
    #20 0x000055555605b171 in js::gc::GCRuntime::beginMarkPhase (this=0x7ffff5f1c6a8, reason=<optimized out>, session=...) at js/src/gc/GC.cpp:4496
    #21 0x000055555605d48b in js::gc::GCRuntime::incrementalSlice (this=this@entry=0x7ffff5f1c6a8, budget=..., reason=reason@entry=JS::GCReason::INCREMENTAL_ALLOC_TRIGGER, session=...) at js/src/gc/GC.cpp:7186
    #22 0x000055555605e083 in js::gc::GCRuntime::gcCycle (this=this@entry=0x7ffff5f1c6a8, nonincrementalByAPI=nonincrementalByAPI@entry=false, budget=..., reason=reason@entry=JS::GCReason::INCREMENTAL_ALLOC_TRIGGER) at js/src/gc/GC.cpp:7628
    #23 0x000055555605e72c in js::gc::GCRuntime::collect (this=this@entry=0x7ffff5f1c6a8, nonincrementalByAPI=nonincrementalByAPI@entry=false, budget=..., reason=reason@entry=JS::GCReason::INCREMENTAL_ALLOC_TRIGGER) at js/src/gc/GC.cpp:7808
    #24 0x000055555605eee2 in js::gc::GCRuntime::startGC (this=0x7ffff5f1c6a8, gckind=GC_NORMAL, reason=JS::GCReason::INCREMENTAL_ALLOC_TRIGGER, millis=0) at js/src/gc/GC.cpp:7907
    #25 0x000055555605f158 in js::gc::GCRuntime::gcIfRequested (this=0x7ffff5f1c6a8) at js/src/gc/GC.cpp:8097
    #26 0x0000555555c218f6 in HandleInterrupt (cx=<optimized out>, invokeCallback=false) at js/src/vm/Runtime.cpp:413
    #27 0x00003f6c1b7edf7d in ?? ()
    [...]
    #36 0x0000000000000000 in ?? ()
    rax	0xfffe4b4b4b4b4b4b	-480163195565237
    rbx	0x7fffffffa5a0	140737488332192
    rcx	0x7ffff58fe940	140737313237312
    rdx	0x8	8
    rsi	0x7ffff58fe940	140737313237312
    rdi	0x7fffffffa5f8	140737488332280
    rbp	0x7fffffffa6a0	140737488332448
    rsp	0x7fffffffa520	140737488332064
    r8	0x0	0
    r9	0x6e	110
    r10	0x0	0
    r11	0x246	582
    r12	0x7fffffffa560	140737488332128
    r13	0x7fffffffa590	140737488332176
    r14	0x7ffff5f1c6a8	140737319650984
    r15	0x7ffff59f7550	140737314256208
    rip	0x55555605a5a6 <js::gc::GCRuntime::markCompartments()+1030>
    => 0x55555605a5a6 <js::gc::GCRuntime::markCompartments()+1030>:	mov    0x10(%rax),%rax
       0x55555605a5aa <js::gc::GCRuntime::markCompartments()+1034>:	mov    (%rax),%r15



This is causing issues in fuzzing because it triggers frequently and looks like a real security issue (while it is not, involving Debugger). Marking as fuzzblocker.
The following testcase crashes on mozilla-central revision 155a7e2117e5 (build with --enable-posix-nspr-emulation --enable-valgrind --enable-gczeal --disable-tests --disable-profiling --enable-debug --enable-optimize, run with --fuzzing-safe --cpu-count=2 --ion-offthread-compile=off):

    function loadFile(lfVarx) {
      eval(lfVarx);
    }
    var g = newGlobal({newCompartment: true});
    g.parent = this;
    g.hits = 0;
    g.eval("new Debugger(parent).onExceptionUnwind = function () { hits++; };");
    loadFile(`
      function* g1() {}
      var o = g1();
      function* g3() {
        while (x && 0) {}
      }
      o = g3();
      try { v = o.next(); } catch(exc) {}
    `)
    loadFile(`
      L: do {    } while (
        class MyArrayBuffer extends ArrayBuffer {}
      );
    `);


Backtrace:

    received signal SIGSEGV, Segmentation fault.
    #0  0x000055555605a5a6 in JS::shadow::Realm::compartment (this=<optimized out>) at dist/include/js/Realm.h:50
    #1  JS::GetCompartmentForRealm (realm=<optimized out>) at dist/include/js/Realm.h:60
    #2  js::ObjectGroup::compartment (this=0xfffe4b4b4b4b4b4b) at js/src/vm/ObjectGroup.h:212
    #3  JSObject::compartment (this=<optimized out>) at js/src/vm/JSObject.h:159
    #4  JSObject::maybeCompartment (this=<optimized out>) at js/src/vm/JSObject.h:160
    #5  _ZZN2js19CrossCompartmentKey11compartmentEvENKUlT_E_clIPPNS_12NativeObjectEEEDaS1_ (__closure=<optimized out>, tp=<optimized out>) at js/src/vm/Compartment.h:226
    #6  _ZN2js19CrossCompartmentKey21ApplyToWrappedMatcherIZNS0_11compartmentEvEUlT_E_EclINS_12NativeObjectEEEDaRNS0_8DebuggeeIS2_EE (this=<optimized out>, dbg=...) at js/src/vm/Compartment.h:185
    [...]
    #18 js::CrossCompartmentKey::compartment (this=<optimized out>) at js/src/vm/Compartment.h:226
    #19 js::gc::GCRuntime::markCompartments (this=this@entry=0x7ffff5f1c6a8) at js/src/gc/GC.cpp:4562
    #20 0x000055555605b171 in js::gc::GCRuntime::beginMarkPhase (this=0x7ffff5f1c6a8, reason=<optimized out>, session=...) at js/src/gc/GC.cpp:4496
    #21 0x000055555605d48b in js::gc::GCRuntime::incrementalSlice (this=this@entry=0x7ffff5f1c6a8, budget=..., reason=reason@entry=JS::GCReason::INCREMENTAL_ALLOC_TRIGGER, session=...) at js/src/gc/GC.cpp:7186
    #22 0x000055555605e083 in js::gc::GCRuntime::gcCycle (this=this@entry=0x7ffff5f1c6a8, nonincrementalByAPI=nonincrementalByAPI@entry=false, budget=..., reason=reason@entry=JS::GCReason::INCREMENTAL_ALLOC_TRIGGER) at js/src/gc/GC.cpp:7628
    #23 0x000055555605e72c in js::gc::GCRuntime::collect (this=this@entry=0x7ffff5f1c6a8, nonincrementalByAPI=nonincrementalByAPI@entry=false, budget=..., reason=reason@entry=JS::GCReason::INCREMENTAL_ALLOC_TRIGGER) at js/src/gc/GC.cpp:7808
    #24 0x000055555605eee2 in js::gc::GCRuntime::startGC (this=0x7ffff5f1c6a8, gckind=GC_NORMAL, reason=JS::GCReason::INCREMENTAL_ALLOC_TRIGGER, millis=0) at js/src/gc/GC.cpp:7907
    #25 0x000055555605f158 in js::gc::GCRuntime::gcIfRequested (this=0x7ffff5f1c6a8) at js/src/gc/GC.cpp:8097
    #26 0x0000555555c218f6 in HandleInterrupt (cx=<optimized out>, invokeCallback=false) at js/src/vm/Runtime.cpp:413
    #27 0x00003f6c1b7edf7d in ?? ()
    [...]
    #36 0x0000000000000000 in ?? ()
    rax	0xfffe4b4b4b4b4b4b	-480163195565237
    rbx	0x7fffffffa5a0	140737488332192
    rcx	0x7ffff58fe940	140737313237312
    rdx	0x8	8
    rsi	0x7ffff58fe940	140737313237312
    rdi	0x7fffffffa5f8	140737488332280
    rbp	0x7fffffffa6a0	140737488332448
    rsp	0x7fffffffa520	140737488332064
    r8	0x0	0
    r9	0x6e	110
    r10	0x0	0
    r11	0x246	582
    r12	0x7fffffffa560	140737488332128
    r13	0x7fffffffa590	140737488332176
    r14	0x7ffff5f1c6a8	140737319650984
    r15	0x7ffff59f7550	140737314256208
    rip	0x55555605a5a6 <js::gc::GCRuntime::markCompartments()+1030>
    => 0x55555605a5a6 <js::gc::GCRuntime::markCompartments()+1030>:	mov    0x10(%rax),%rax
       0x55555605a5aa <js::gc::GCRuntime::markCompartments()+1034>:	mov    (%rax),%r15



This is causing issues in fuzzing because it triggers frequently and looks like a real security issue (while it is not, involving Debugger). Marking as fuzzblocker.

Back to Bug 1557343 Comment 0