Closed Bug 1987516 Opened 1 year ago Closed 1 year ago

Assertion failure: CurrentThreadIsGCMarking() || CurrentThreadCanAccessZone(zone), at /js/src/gc/Cell.h:463 with FinalizationRegistry

Categories

(Core :: JavaScript Engine, defect, P1)

x86_64
Linux
defect

Tracking

()

VERIFIED FIXED
144 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox-esr128 --- unaffected
firefox-esr140 --- unaffected
firefox142 --- unaffected
firefox143 --- unaffected
firefox144 + verified

People

(Reporter: decoder, Assigned: jonco)

References

(Blocks 1 open bug, Regression)

Details

(5 keywords, Whiteboard: [bugmon:update,bisected,confirmed])

Attachments

(2 files, 1 external file)

The following testcase crashes on mozilla-central revision 20250908-3927f21c92c9 (debug build, run with --fuzzing-safe --ion-offthread-compile=off --enable-symbols-as-weakmap-keys):

evalInWorker(`
  function a() {}
  b = function() {}
  c = new FinalizationRegistry(b)
  a(c.register(Symbol.hasInstance) )
`)

Backtrace:

received signal SIGSEGV, Segmentation fault.
#0  0x0000555556eede88 in js::gc::TenuredCell::zone() const ()
#1  0x000055555797d219 in js::gc::GCRuntime::registerWithFinalizationRegistry(JSContext*, JS::Handle<JS::Value>, JS::Handle<js::FinalizationRecordObject*>) ()
#2  0x00005555570de18b in js::FinalizationRegistryObject::register_(JSContext*, unsigned int, JS::Value*) ()
#3  0x000055555704ecb5 in CallJSNative(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), js::CallReason, JS::CallArgs const&) ()
#4  0x000055555704e3c0 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) ()
#5  0x0000555557062239 in js::Interpret(JSContext*, js::RunState&) ()
#6  0x000055555704d934 in js::RunScript(JSContext*, js::RunState&) ()
#7  0x0000555557050f41 in js::ExecuteKernel(JSContext*, JS::Handle<JSScript*>, JS::Handle<JSObject*>, js::AbstractFramePtr, JS::MutableHandle<JS::Value>) ()
#8  0x000055555705152f in js::Execute(JSContext*, JS::Handle<JSScript*>, JS::Handle<JSObject*>, JS::MutableHandle<JS::Value>) ()
#9  0x00005555571a05d2 in ExecuteScript(JSContext*, JS::Handle<JSObject*>, JS::Handle<JSScript*>, JS::MutableHandle<JS::Value>) ()
#10 0x00005555571a03e0 in JS_ExecuteScript(JSContext*, JS::Handle<JSScript*>, JS::MutableHandle<JS::Value>) ()
#11 0x0000555556f1f78a in WorkerMain(std::unique_ptr<WorkerInput, JS::DeletePolicy<WorkerInput> >) ()
#12 0x0000555556f1fcfa in js::detail::ThreadTrampoline<void (&)(std::unique_ptr<WorkerInput, JS::DeletePolicy<WorkerInput> >), std::unique_ptr<WorkerInput, JS::DeletePolicy<WorkerInput> > >::Start(void*) ()
#13 0x0000555556f7a6ad in set_alt_signal_stack_and_start(PthreadCreateParams*) ()
rax	0x0	0
rbx	0x7ffff4248000	140737289420800
rcx	0x1cf	463
rdx	0x7ffff7804563	140737345766755
rsi	0x0	0
rdi	0x7ffff7805700	140737345771264
rbp	0x7ffff4bfe160	140737299603808
rsp	0x7ffff4bfe150	140737299603792
r8	0x0	0
r9	0x3	3
r10	0x0	0
r11	0x293	659
r12	0x7ffff4bfe1e0	140737299603936
r13	0x7ffff4bfe248	140737299604040
r14	0x7ffff4bfe1e0	140737299603936
r15	0x7ffff4bfe230	140737299604016
rip	0x555556eede88 <js::gc::TenuredCell::zone() const+280>
=> 0x555556eede88 <_ZNK2js2gc11TenuredCell4zoneEv+280>:	mov    %rcx,(%rax)
   0x555556eede8b <_ZNK2js2gc11TenuredCell4zoneEv+283>:	call   0x555556f673e0 <abort>
Attached file Testcase —

Very similar and with same assertion:

evalInWorker(` new WeakRef(Symbol.hasInstance)`)

Verified bug as reproducible on mozilla-central 20250908082214-3927f21c92c9.
The bug appears to have been introduced in the following build range:

Start: 9786291f3312a108c81c8ef5ce0bde18fdc4e6af (20250905010130)
End: 9e06db4da20903f3daed4e3295ad8ac2f990984d (20250904082226)
Pushlog: https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=9786291f3312a108c81c8ef5ce0bde18fdc4e6af&tochange=9e06db4da20903f3daed4e3295ad8ac2f990984d

Whiteboard: [bugmon:update,bisect] → [bugmon:update,bisected,confirmed]

Bug 1863140 seems like the obvious choice for a regressor from that range.

Flags: needinfo?(jcoppeard)
Regressed by: 1863140

Set release status flags based on info from the regressing bug 1863140

Assignee: nobody → jcoppeard
Flags: needinfo?(jcoppeard)
Blocks: sm-security
Severity: -- → S3
Priority: -- → P1
Attached file (secure) —

Well known symbols are a problem for finalization tracking because we are not
able to safely access their zone if they are in the shared atoms zone.

The spec says we don't need to bother though as they are likely never to be
collected. So we can skip tracking these targets.

Group: javascript-core-security → core-security-release
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 144 Branch

Verified bug as fixed on rev mozilla-central 20250910212829-11b5377f9bfc.
Removing bugmon keyword as no further action possible. Please review the bug and re-add the keyword for further analysis.

Status: RESOLVED → VERIFIED
Keywords: bugmon
See Also: → 1988475
Group: core-security-release
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: