Closed Bug 1791622 Opened 2 years ago Closed 2 years ago

Assertion failure: false (MOZ_ASSERT_UNREACHABLE: unexpected FontFaceLoadStatus), at /layout/style/FontFaceSet.cpp:444

Categories

(Core :: CSS Parsing and Computation, defect)

x86_64
Linux
defect

Tracking

()

VERIFIED FIXED
108 Branch
Tracking Status
firefox-esr102 --- unaffected
firefox106 --- wontfix
firefox107 --- wontfix
firefox108 --- verified

People

(Reporter: jkratzer, Assigned: aosmond)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression, testcase, Whiteboard: [bugmon:bisected,confirmed])

Attachments

(2 files)

Testcase found while fuzzing mozilla-central rev 45d33d6757ba (built with: --enable-debug --enable-fuzzing).

Testcase can be reproduced using the following commands:

$ pip install fuzzfetch grizzly-framework
$ python -m fuzzfetch --build 45d33d6757ba --debug --fuzzing -n firefox
$ python -m grizzly.replay ./firefox/firefox testcase.html
Assertion failure: false (MOZ_ASSERT_UNREACHABLE: unexpected FontFaceLoadStatus), at /layout/style/FontFaceSet.cpp:444

    ==1283327==ERROR: UndefinedBehaviorSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f2d88c1699b bp 0x7f2d7a57f930 sp 0x7f2d7a57f8f0 T1283374)
    ==1283327==The signal is caused by a WRITE memory access.
    ==1283327==Hint: address points to the zero page.
        #0 0x7f2d88c1699b in mozilla::dom::FontFaceSet::MaybeResolve()::$_13::operator()(nsTArray<mozilla::dom::FontFaceSet::FontFaceRecord>&) const /layout/style/FontFaceSet.cpp:444:11
        #1 0x7f2d88c16747 in mozilla::dom::FontFaceSet::MaybeResolve() /layout/style/FontFaceSet.cpp:451:3
        #2 0x7f2d88c17b97 in OnLoadingFinished /layout/style/FontFaceSetImpl.cpp:938:13
        #3 0x7f2d88c17b97 in mozilla::dom::FontFaceSetImpl::CheckLoadingFinished() /layout/style/FontFaceSetImpl.cpp:926:5
        #4 0x7f2d88c1dee0 in mozilla::dom::FontFaceSetImpl::Delete(mozilla::dom::FontFaceImpl*) /layout/style/FontFaceSetImpl.cpp:295:3
        #5 0x7f2d88c156b5 in mozilla::dom::FontFaceSet::Delete(mozilla::dom::FontFace&) /layout/style/FontFaceSet.cpp:265:15
        #6 0x7f2d868e25e6 in mozilla::dom::FontFaceSet_Binding::_delete_(JSContext*, JS::Handle<JSObject*>, void*, JSJitMethodCallArgs const&) /builds/worker/workspace/obj-build/dom/bindings/FontFaceSetBinding.cpp:369:36
        #7 0x7f2d86b0846c in bool mozilla::dom::binding_detail::GenericMethod<mozilla::dom::binding_detail::NormalThisPolicy, mozilla::dom::binding_detail::ThrowExceptions>(JSContext*, unsigned int, JS::Value*) /dom/bindings/BindingUtils.cpp:3287:13
        #8 0x7f2d8c1b1fec in CallJSNative(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), js::CallReason, JS::CallArgs const&) /js/src/vm/Interpreter.cpp:458:13
        #9 0x7f2d8c1b1911 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /js/src/vm/Interpreter.cpp:546:12
        #10 0x7f2d8c1a8c48 in CallFromStack /js/src/vm/Interpreter.cpp:618:10
        #11 0x7f2d8c1a8c48 in Interpret(JSContext*, js::RunState&) /js/src/vm/Interpreter.cpp:3374:16
        #12 0x7f2d8c19fced in js::RunScript(JSContext*, js::RunState&) /js/src/vm/Interpreter.cpp:430:13
        #13 0x7f2d8c1b180d in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /js/src/vm/Interpreter.cpp:578:13
        #14 0x7f2d8c1b2d4c in js::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, js::AnyInvokeArgs const&, JS::MutableHandle<JS::Value>, js::CallReason) /js/src/vm/Interpreter.cpp:645:8
        #15 0x7f2d8ae31d7c in JS::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, JS::HandleValueArray const&, JS::MutableHandle<JS::Value>) /js/src/vm/CallAndConstruct.cpp:117:10
        #16 0x7f2d867fc6d9 in mozilla::dom::EventListener::HandleEvent(mozilla::dom::BindingCallContext&, JS::Handle<JS::Value>, mozilla::dom::Event&, mozilla::ErrorResult&) /builds/worker/workspace/obj-build/dom/bindings/EventListenerBinding.cpp:62:8
        #17 0x7f2d870bcf46 in void mozilla::dom::EventListener::HandleEvent<mozilla::dom::EventTarget*>(mozilla::dom::EventTarget* const&, mozilla::dom::Event&, mozilla::ErrorResult&, char const*, mozilla::dom::CallbackObject::ExceptionHandling, JS::Realm*) /builds/worker/workspace/obj-build/dist/include/mozilla/dom/EventListenerBinding.h:65:12
        #18 0x7f2d870bcc6d in mozilla::EventListenerManager::HandleEventSubType(mozilla::EventListenerManager::Listener*, mozilla::dom::Event*, mozilla::dom::EventTarget*) /dom/events/EventListenerManager.cpp:1310:43
        #19 0x7f2d870bd917 in mozilla::EventListenerManager::HandleEventInternal(nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event**, mozilla::dom::EventTarget*, nsEventStatus*, bool) /dom/events/EventListenerManager.cpp:1506:17
        #20 0x7f2d870b2854 in HandleEvent /dom/events/EventListenerManager.h:395:5
        #21 0x7f2d870b2854 in mozilla::EventTargetChainItem::HandleEvent(mozilla::EventChainPostVisitor&, mozilla::ELMCreationDetector&) /dom/events/EventDispatcher.cpp:348:17
        #22 0x7f2d870b1da2 in mozilla::EventTargetChainItem::HandleEventTargetChain(nsTArray<mozilla::EventTargetChainItem>&, mozilla::EventChainPostVisitor&, mozilla::EventDispatchingCallback*, mozilla::ELMCreationDetector&) /dom/events/EventDispatcher.cpp:550:16
        #23 0x7f2d870b4641 in mozilla::EventDispatcher::Dispatch(nsISupports*, nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsEventStatus*, mozilla::EventDispatchingCallback*, nsTArray<mozilla::dom::EventTarget*>*) /dom/events/EventDispatcher.cpp:1119:11
        #24 0x7f2d870b70b6 in mozilla::EventDispatcher::DispatchDOMEvent(nsISupports*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsPresContext*, nsEventStatus*) /dom/events/EventDispatcher.cpp
        #25 0x7f2d8708bffb in mozilla::DOMEventTargetHelper::DispatchEvent(mozilla::dom::Event&, mozilla::dom::CallerType, mozilla::ErrorResult&) /dom/events/DOMEventTargetHelper.cpp:176:17
        #26 0x7f2d870c4322 in mozilla::dom::EventTarget::DispatchEvent(mozilla::dom::Event&) /dom/events/EventTarget.cpp:180:13
        #27 0x7f2d8514c982 in mozilla::dom::AbortSignal::SignalAbort(JS::Handle<JS::Value>) /dom/abort/AbortSignal.cpp:283:3
        #28 0x7f2d8514db13 in mozilla::dom::AbortSignalTimeoutHandler::Call(char const*) /dom/abort/AbortSignal.cpp:176:14
        #29 0x7f2d8848af72 in mozilla::dom::WorkerPrivate::RunExpiredTimeouts(JSContext*) /dom/workers/WorkerPrivate.cpp:4984:7
        #30 0x7f2d88492d0e in mozilla::dom::WorkerRunnable::Run() /dom/workers/WorkerRunnable.cpp:377:12
        #31 0x7f2d839d35ac in operator() /xpcom/threads/nsTimerImpl.cpp:657:44
        #32 0x7f2d839d35ac in matchN<mozilla::Variant<nsTimerImpl::UnknownCallback, nsCOMPtr<nsITimerCallback>, nsCOMPtr<nsIObserver>, nsTimerImpl::FuncCallback, nsTimerImpl::ClosureCallback> &, (lambda at /xpcom/threads/nsTimerImpl.cpp:657:7), (lambda at /xpcom/threads/nsTimerImpl.cpp:658:7), (lambda at /xpcom/threads/nsTimerImpl.cpp:661:7), (lambda at /xpcom/threads/nsTimerImpl.cpp:662:7)> /builds/worker/workspace/obj-build/dist/include/mozilla/Variant.h:309:16
        #33 0x7f2d839d35ac in matchN<mozilla::Variant<nsTimerImpl::UnknownCallback, nsCOMPtr<nsITimerCallback>, nsCOMPtr<nsIObserver>, nsTimerImpl::FuncCallback, nsTimerImpl::ClosureCallback> &, (lambda at /xpcom/threads/nsTimerImpl.cpp:656:7), (lambda at /xpcom/threads/nsTimerImpl.cpp:657:7), (lambda at /xpcom/threads/nsTimerImpl.cpp:658:7), (lambda at /xpcom/threads/nsTimerImpl.cpp:661:7), (lambda at /xpcom/threads/nsTimerImpl.cpp:662:7)> /builds/worker/workspace/obj-build/dist/include/mozilla/Variant.h:318:14
        #34 0x7f2d839d35ac in matchN<mozilla::Variant<nsTimerImpl::UnknownCallback, nsCOMPtr<nsITimerCallback>, nsCOMPtr<nsIObserver>, nsTimerImpl::FuncCallback, nsTimerImpl::ClosureCallback> &, (lambda at /xpcom/threads/nsTimerImpl.cpp:656:7), (lambda at /xpcom/threads/nsTimerImpl.cpp:657:7), (lambda at /xpcom/threads/nsTimerImpl.cpp:658:7), (lambda at /xpcom/threads/nsTimerImpl.cpp:661:7), (lambda at /xpcom/threads/nsTimerImpl.cpp:662:7)> /builds/worker/workspace/obj-build/dist/include/mozilla/Variant.h:902:12
        #35 0x7f2d839d35ac in match<(lambda at /xpcom/threads/nsTimerImpl.cpp:656:7), (lambda at /xpcom/threads/nsTimerImpl.cpp:657:7), (lambda at /xpcom/threads/nsTimerImpl.cpp:658:7), (lambda at /xpcom/threads/nsTimerImpl.cpp:661:7), (lambda at /xpcom/threads/nsTimerImpl.cpp:662:7)> /builds/worker/workspace/obj-build/dist/include/mozilla/Variant.h:857:12
        #36 0x7f2d839d35ac in nsTimerImpl::Fire(int) /xpcom/threads/nsTimerImpl.cpp:655:22
        #37 0x7f2d839a284e in nsTimerEvent::Run() /xpcom/threads/TimerThread.cpp:365:11
        #38 0x7f2d839aeaa7 in nsThread::ProcessNextEvent(bool, bool*) /xpcom/threads/nsThread.cpp:1199:16
        #39 0x7f2d839b4fed in NS_ProcessNextEvent(nsIThread*, bool) /xpcom/threads/nsThreadUtils.cpp:465:10
        #40 0x7f2d88481a74 in mozilla::dom::WorkerPrivate::DoRunLoop(JSContext*) /dom/workers/WorkerPrivate.cpp:3204:7
        #41 0x7f2d8846ab3b in mozilla::dom::workerinternals::(anonymous namespace)::WorkerThreadPrimaryRunnable::Run() /dom/workers/RuntimeService.cpp:2042:42
        #42 0x7f2d839aeaa7 in nsThread::ProcessNextEvent(bool, bool*) /xpcom/threads/nsThread.cpp:1199:16
        #43 0x7f2d839b4fed in NS_ProcessNextEvent(nsIThread*, bool) /xpcom/threads/nsThreadUtils.cpp:465:10
        #44 0x7f2d8459680b in mozilla::ipc::MessagePumpForNonMainThreads::Run(base::MessagePump::Delegate*) /ipc/glue/MessagePump.cpp:300:20
        #45 0x7f2d844baca7 in MessageLoop::RunInternal() /ipc/chromium/src/base/message_loop.cc:381:10
        #46 0x7f2d844babb2 in RunHandler /ipc/chromium/src/base/message_loop.cc:374:3
        #47 0x7f2d844babb2 in MessageLoop::Run() /ipc/chromium/src/base/message_loop.cc:356:3
        #48 0x7f2d839a9dd6 in nsThread::ThreadFunc(void*) /xpcom/threads/nsThread.cpp:384:10
        #49 0x7f2d99d31557 in _pt_root /nsprpub/pr/src/pthreads/ptthread.c:201:5
        #50 0x7f2d9a5dfb42 in start_thread nptl/./nptl/pthread_create.c:442:8
        #51 0x7f2d9a6719ff  misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
    
    UndefinedBehaviorSanitizer can not provide additional info.
    SUMMARY: UndefinedBehaviorSanitizer: SEGV /layout/style/FontFaceSet.cpp:444:11 in mozilla::dom::FontFaceSet::MaybeResolve()::$_13::operator()(nsTArray<mozilla::dom::FontFaceSet::FontFaceRecord>&) const
    ==1283327==ABORTING
Attached file Testcase (deleted) —

Bugmon Analysis
Verified bug as reproducible on mozilla-central 20220920092542-45d33d6757ba.
The bug appears to have been introduced in the following build range:

Start: 14bbdad41ca8f9cbe874b8e1adf10a701ff81517 (20220711154729)
End: 0fa881dedc30efcf53f1419737a9f3d7d2fc5521 (20220711143742)
Pushlog: https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=14bbdad41ca8f9cbe874b8e1adf10a701ff81517&tochange=0fa881dedc30efcf53f1419737a9f3d7d2fc5521

Keywords: regression
Whiteboard: [bugmon:confirm] → [bugmon:bisected,confirmed]

The severity field is not set for this bug.
:alaskanemily, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(emcdonough)

@jfkthame Can you take a look at this?

Flags: needinfo?(emcdonough) → needinfo?(jfkthame)

Andrew has a couple patches in progress that relate to workers and @font-face; let's see if this is still an issue once the dust settles on those.

Severity: -- → S3
Flags: needinfo?(jfkthame)

This is a different issue. Trips an assert in debug, but should be safe in opt builds. It is falling through because it has the Loading status:
https://searchfox.org/mozilla-central/rev/bfa4dfd40b8fe6f1a6504e86b5ad2c5fd402bfc0/layout/style/FontFaceSet.cpp#441

We assert this shouldn't happen because loading shouldn't have finished if there were any fonts left:
https://searchfox.org/mozilla-central/rev/bfa4dfd40b8fe6f1a6504e86b5ad2c5fd402bfc0/layout/style/FontFaceSetImpl.cpp#926

Unfortunately it is still in the FontFaceSet list (not the FontFaceSetImpl) because we delete it after that operation:
https://searchfox.org/mozilla-central/rev/bfa4dfd40b8fe6f1a6504e86b5ad2c5fd402bfc0/layout/style/FontFaceSet.cpp#269

FontFaceSet and FontFaceSetImpl maintain independent but matching lists
of FontFace and FontFaceImpl objects respectively. When
FontFaceSet::Delete is called, we should remove from the FontFaceSet
first instead of the FontFaceSetImpl because FontFaceSetImpl::Delete
calls back into FontFaceSet to update its status if the removed FontFace
was the last object holding it back from a status change.

Assignee: nobody → aosmond
Status: NEW → ASSIGNED
Pushed by aosmond@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/098c18154cb1 Ensure FontFaceSet::Delete removes entries in the correct order. r=jfkthame
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 108 Branch

Can we land a test for this? Also, is there a user-facing impact which might make us want to consider Beta uplift?

Flags: needinfo?(aosmond)
Regressed by: 1771493

Verified bug as fixed on rev mozilla-central 20221026034746-8a97830c36c3.
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
Flags: needinfo?(aosmond)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: