Closed Bug 1730689 Opened 3 years ago Closed 2 years ago

Assertion failure: mRespondWithHandler, at /dom/serviceworkers/ServiceWorkerEvents.cpp:796

Categories

(Core :: DOM: Service Workers, defect, P2)

x86_64
Linux
defect

Tracking

()

VERIFIED FIXED
97 Branch
Tracking Status
firefox-esr91 --- wontfix
firefox95 --- wontfix
firefox96 --- wontfix
firefox97 --- verified

People

(Reporter: jkratzer, Assigned: edenchuang)

References

(Blocks 1 open bug)

Details

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

Crash Data

Attachments

(2 files)

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

Testcase can be reproduced using the following commands:

$ pip install fuzzfetch grizzly-framework
$ python -m fuzzfetch --build b50ef8e31c4c --debug --fuzzing -n firefox
$ python -m grizzly.replay ./firefox/firefox testcase.zip
Assertion failure: mRespondWithHandler, at /dom/serviceworkers/ServiceWorkerEvents.cpp:796

    ==2691625==ERROR: UndefinedBehaviorSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f228c76dd3d bp 0x7f227f34c750 sp 0x7f227f34c5d0 T2691760)
    ==2691625==The signal is caused by a WRITE memory access.
    ==2691625==Hint: address points to the zero page.
        #0 0x7f228c76dd3d in mozilla::dom::FetchEvent::RespondWith(JSContext*, mozilla::dom::Promise&, mozilla::ErrorResult&) /dom/serviceworkers/ServiceWorkerEvents.cpp:796:5
        #1 0x7f228ae8cc08 in mozilla::dom::FetchEvent_Binding::respondWith(JSContext*, JS::Handle<JSObject*>, void*, JSJitMethodCallArgs const&) /builds/worker/workspace/obj-build/dom/bindings/FetchEventBinding.cpp:385:24
        #2 0x7f228b13b158 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:3300:13
        #3 0x7f228e8c8110 in CallJSNative(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), js::CallReason, JS::CallArgs const&) /js/src/vm/Interpreter.cpp:401:13
        #4 0x7f228e8c780e in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /js/src/vm/Interpreter.cpp:488:12
        #5 0x7f228e8c920e in InternalCall(JSContext*, js::AnyInvokeArgs const&, js::CallReason) /js/src/vm/Interpreter.cpp:548:10
        #6 0x7f228e8be7e0 in CallFromStack /js/src/vm/Interpreter.cpp:552:10
        #7 0x7f228e8be7e0 in Interpret(JSContext*, js::RunState&) /js/src/vm/Interpreter.cpp:3255:16
        #8 0x7f228e8b5435 in js::RunScript(JSContext*, js::RunState&) /js/src/vm/Interpreter.cpp:370:13
        #9 0x7f228e8c7707 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /js/src/vm/Interpreter.cpp:520:13
        #10 0x7f228e8c920e in InternalCall(JSContext*, js::AnyInvokeArgs const&, js::CallReason) /js/src/vm/Interpreter.cpp:548:10
        #11 0x7f228e8c9411 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:565:8
        #12 0x7f228eaaaf13 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
        #13 0x7f228ae3ce4e 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
        #14 0x7f228b5478d6 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
        #15 0x7f228b54762a in mozilla::EventListenerManager::HandleEventSubType(mozilla::EventListenerManager::Listener*, mozilla::dom::Event*, mozilla::dom::EventTarget*) /dom/events/EventListenerManager.cpp:1115:43
        #16 0x7f228b548382 in mozilla::EventListenerManager::HandleEventInternal(nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event**, mozilla::dom::EventTarget*, nsEventStatus*, bool) /dom/events/EventListenerManager.cpp:1312:17
        #17 0x7f228b53d1c5 in HandleEvent /dom/events/EventListenerManager.h:394:5
        #18 0x7f228b53d1c5 in mozilla::EventTargetChainItem::HandleEvent(mozilla::EventChainPostVisitor&, mozilla::ELMCreationDetector&) /dom/events/EventDispatcher.cpp:348:17
        #19 0x7f228b53c6df in mozilla::EventTargetChainItem::HandleEventTargetChain(nsTArray<mozilla::EventTargetChainItem>&, mozilla::EventChainPostVisitor&, mozilla::EventDispatchingCallback*, mozilla::ELMCreationDetector&) /dom/events/EventDispatcher.cpp:550:16
        #20 0x7f228b53f304 in mozilla::EventDispatcher::Dispatch(nsISupports*, nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsEventStatus*, mozilla::EventDispatchingCallback*, nsTArray<mozilla::dom::EventTarget*>*) /dom/events/EventDispatcher.cpp:1081:11
        #21 0x7f228b541f46 in mozilla::EventDispatcher::DispatchDOMEvent(nsISupports*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsPresContext*, nsEventStatus*) /dom/events/EventDispatcher.cpp
        #22 0x7f228b517f8b in mozilla::DOMEventTargetHelper::DispatchEvent(mozilla::dom::Event&, mozilla::dom::CallerType, mozilla::ErrorResult&) /dom/events/DOMEventTargetHelper.cpp:181:17
        #23 0x7f228ae788e6 in mozilla::dom::EventTarget_Binding::dispatchEvent(JSContext*, JS::Handle<JSObject*>, void*, JSJitMethodCallArgs const&) /builds/worker/workspace/obj-build/dom/bindings/EventTargetBinding.cpp:851:36
        #24 0x7f228b13cad4 in bool mozilla::dom::binding_detail::GenericMethod<mozilla::dom::binding_detail::MaybeCrossOriginObjectThisPolicy, mozilla::dom::binding_detail::ThrowExceptions>(JSContext*, unsigned int, JS::Value*) /dom/bindings/BindingUtils.cpp:3300:13
        #25 0x7f228e8c8110 in CallJSNative(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), js::CallReason, JS::CallArgs const&) /js/src/vm/Interpreter.cpp:401:13
        #26 0x7f228e8c780e in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /js/src/vm/Interpreter.cpp:488:12
        #27 0x7f228e8c920e in InternalCall(JSContext*, js::AnyInvokeArgs const&, js::CallReason) /js/src/vm/Interpreter.cpp:548:10
        #28 0x7f228e8be7e0 in CallFromStack /js/src/vm/Interpreter.cpp:552:10
        #29 0x7f228e8be7e0 in Interpret(JSContext*, js::RunState&) /js/src/vm/Interpreter.cpp:3255:16
        #30 0x7f228e8b5435 in js::RunScript(JSContext*, js::RunState&) /js/src/vm/Interpreter.cpp:370:13
        #31 0x7f228e8c7707 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /js/src/vm/Interpreter.cpp:520:13
        #32 0x7f228e8c920e in InternalCall(JSContext*, js::AnyInvokeArgs const&, js::CallReason) /js/src/vm/Interpreter.cpp:548:10
        #33 0x7f228e8c9411 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:565:8
        #34 0x7f228eaaaf13 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
        #35 0x7f228ae3ce4e 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
        #36 0x7f228b5478d6 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
        #37 0x7f228b54762a in mozilla::EventListenerManager::HandleEventSubType(mozilla::EventListenerManager::Listener*, mozilla::dom::Event*, mozilla::dom::EventTarget*) /dom/events/EventListenerManager.cpp:1115:43
        #38 0x7f228b548382 in mozilla::EventListenerManager::HandleEventInternal(nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event**, mozilla::dom::EventTarget*, nsEventStatus*, bool) /dom/events/EventListenerManager.cpp:1312:17
        #39 0x7f228b53d1c5 in HandleEvent /dom/events/EventListenerManager.h:394:5
        #40 0x7f228b53d1c5 in mozilla::EventTargetChainItem::HandleEvent(mozilla::EventChainPostVisitor&, mozilla::ELMCreationDetector&) /dom/events/EventDispatcher.cpp:348:17
        #41 0x7f228b53c6df in mozilla::EventTargetChainItem::HandleEventTargetChain(nsTArray<mozilla::EventTargetChainItem>&, mozilla::EventChainPostVisitor&, mozilla::EventDispatchingCallback*, mozilla::ELMCreationDetector&) /dom/events/EventDispatcher.cpp:550:16
        #42 0x7f228b53f304 in mozilla::EventDispatcher::Dispatch(nsISupports*, nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsEventStatus*, mozilla::EventDispatchingCallback*, nsTArray<mozilla::dom::EventTarget*>*) /dom/events/EventDispatcher.cpp:1081:11
        #43 0x7f228b541f46 in mozilla::EventDispatcher::DispatchDOMEvent(nsISupports*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsPresContext*, nsEventStatus*) /dom/events/EventDispatcher.cpp
        #44 0x7f228b517f8b in mozilla::DOMEventTargetHelper::DispatchEvent(mozilla::dom::Event&, mozilla::dom::CallerType, mozilla::ErrorResult&) /dom/events/DOMEventTargetHelper.cpp:181:17
        #45 0x7f228b54ee92 in mozilla::dom::EventTarget::DispatchEvent(mozilla::dom::Event&, mozilla::ErrorResult&) /dom/events/EventTarget.cpp:183:13
        #46 0x7f228c792424 in mozilla::dom::(anonymous namespace)::DispatchExtendableEventOnWorkerScope(JSContext*, mozilla::dom::WorkerGlobalScope*, mozilla::dom::ExtendableEvent*, RefPtr<mozilla::dom::ExtendableEventCallback>) /dom/serviceworkers/ServiceWorkerOp.cpp:246:17
        #47 0x7f228c7ad067 in mozilla::dom::NotificationEventOp::Exec(JSContext*, mozilla::dom::WorkerPrivate*) /dom/serviceworkers/ServiceWorkerOp.cpp:898:19
        #48 0x7f228c7ac6f8 in mozilla::dom::ServiceWorkerOp::ServiceWorkerOpRunnable::WorkerRun(JSContext*, mozilla::dom::WorkerPrivate*) /dom/serviceworkers/ServiceWorkerOp.cpp:291:23
        #49 0x7f228c4d690f in mozilla::dom::WorkerRunnable::Run() /dom/workers/WorkerRunnable.cpp:378:12
        #50 0x7f2287fb0a18 in nsThread::ProcessNextEvent(bool, bool*) /xpcom/threads/nsThread.cpp:1142:16
        #51 0x7f2287fb769a in NS_ProcessNextEvent(nsIThread*, bool) /xpcom/threads/nsThreadUtils.cpp:466:10
        #52 0x7f228c4c59f8 in mozilla::dom::WorkerPrivate::DoRunLoop(JSContext*) /dom/workers/WorkerPrivate.cpp:3073:7
        #53 0x7f228c4a5e87 in mozilla::dom::workerinternals::(anonymous namespace)::WorkerThreadPrimaryRunnable::Run() /dom/workers/RuntimeService.cpp:2241:42
        #54 0x7f2287fb0a18 in nsThread::ProcessNextEvent(bool, bool*) /xpcom/threads/nsThread.cpp:1142:16
        #55 0x7f2287fb769a in NS_ProcessNextEvent(nsIThread*, bool) /xpcom/threads/nsThreadUtils.cpp:466:10
        #56 0x7f2288a125cb in mozilla::ipc::MessagePumpForNonMainThreads::Run(base::MessagePump::Delegate*) /ipc/glue/MessagePump.cpp:300:20
        #57 0x7f2288931937 in MessageLoop::RunInternal() /ipc/chromium/src/base/message_loop.cc:331:10
        #58 0x7f2288931842 in RunHandler /ipc/chromium/src/base/message_loop.cc:324:3
        #59 0x7f2288931842 in MessageLoop::Run() /ipc/chromium/src/base/message_loop.cc:306:3
        #60 0x7f2287facedf in nsThread::ThreadFunc(void*) /xpcom/threads/nsThread.cpp:390:10
        #61 0x7f229cf57957 in _pt_root /nsprpub/pr/src/pthreads/ptthread.c:201:5
        #62 0x7f229dccb608 in start_thread /build/glibc-eX1tMB/glibc-2.31/nptl/pthread_create.c:477:8
        #63 0x7f229d893292 in clone /build/glibc-eX1tMB/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95
    
    UndefinedBehaviorSanitizer can not provide additional info.
    SUMMARY: UndefinedBehaviorSanitizer: SEGV /dom/serviceworkers/ServiceWorkerEvents.cpp:796:5 in mozilla::dom::FetchEvent::RespondWith(JSContext*, mozilla::dom::Promise&, mozilla::ErrorResult&)
    ==2691625==ABORTING
Attached file Testcase
Flags: needinfo?(echuang)

Bugmon Analysis
Verified bug as reproducible on mozilla-central 20210914143556-ae68c3ee95d6.
Failed to bisect testcase (Testcase reproduces on start build!):

Start: 8c8f6d93ade332edc31bba40a8bddb6aab1ef963 (20200915032959)
End: b50ef8e31c4c2dd8993366c68c2f6f87e5a4f68a (20210913213224)
BuildFlags: BuildFlags(asan=False, tsan=False, debug=True, fuzzing=True, coverage=False, valgrind=False, no_opt=False, fuzzilli=False)

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

The root cause is we do not create a RespondWithHandler for self-dispatch FetchEvent.

Assignee: nobody → echuang
Status: NEW → ASSIGNED
Flags: needinfo?(echuang)
Priority: -- → P2
Pushed by echuang@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/0e78fa0d91cd
FetchEvent.mRespondWithHandler could be nullptr when self dispatching events in ServiceWorker. r=dom-worker-reviewers,jstutte
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 97 Branch

Bugmon Analysis
Verified bug as fixed on rev mozilla-central 20211222092845-78c7b6de3187.
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

:edenchuang, since this bug contains a bisection range, could you fill (if possible) the regressed_by field?
For more information, please visit auto_nag documentation.

Flags: needinfo?(echuang)

Sorry, bug in the bot.

Flags: needinfo?(echuang)
Duplicate of this bug: 1605371

Copying crash signatures from duplicate bugs.

Crash Signature: [@ mozilla::ipc::ProcessLink::SendMessage | IPC_Message_Name=PContent::Msg_SetURITitle]
You need to log in before you can comment on or make changes to this bug.