Closed Bug 1749308 Opened 2 years ago Closed 2 years ago

Assertion failure: mTrack (How come we don't have a track here?), at /dom/media/webaudio/AudioNode.cpp:284

Categories

(Core :: Web Audio, defect)

x86_64
Linux
defect

Tracking

()

VERIFIED FIXED
98 Branch
Tracking Status
firefox98 --- verified

People

(Reporter: jkratzer, Assigned: padenot)

References

(Blocks 1 open bug)

Details

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

Attachments

(2 files)

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

Testcase can be reproduced using the following commands:

$ pip install fuzzfetch grizzly-framework
$ python -m fuzzfetch --build b81970e39db4 --debug --fuzzing -n firefox
$ python -m grizzly.replay ./firefox/firefox testcase.html
Assertion failure: mTrack (How come we don't have a track here?), at /dom/media/webaudio/AudioNode.cpp:284

    ==623419==ERROR: UndefinedBehaviorSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7fe791c70f33 bp 0x7fff152e4430 sp 0x7fff152e43f0 T623419)
    ==623419==The signal is caused by a WRITE memory access.
    ==623419==Hint: address points to the zero page.
        #0 0x7fe791c70f33 in mozilla::dom::AudioNode::SendInt32ParameterToTrack(unsigned int, int) /dom/media/webaudio/AudioNode.cpp:284:3
        #1 0x7fe791cc0ba8 in mozilla::dom::ScriptProcessorNode::UpdateConnectedStatus() /dom/media/webaudio/ScriptProcessorNode.cpp:525:3
        #2 0x7fe79140d71c in mozilla::EventListenerManager::NotifyEventListenerRemoved(nsAtom*) /dom/events/EventListenerManager.cpp:781:14
        #3 0x7fe79140d9a7 in mozilla::EventListenerManager::RemoveEventListenerInternal(mozilla::dom::CallbackObjectHolder<mozilla::dom::EventListener, nsIDOMEventListener>, mozilla::EventMessage, nsAtom*, mozilla::EventListenerFlags const&, bool) /dom/events/EventListenerManager.cpp:812:9
        #4 0x7fe791414905 in mozilla::EventListenerManager::ListenerSignalFollower::RunAbortAlgorithm() /dom/events/EventListenerManager.cpp:2161:10
        #5 0x7fe78f748f17 in mozilla::dom::AbortSignalImpl::SignalAbort(JS::Handle<JS::Value>) /dom/abort/AbortSignal.cpp:58:15
        #6 0x7fe78f7486ec in mozilla::dom::AbortSignal::SignalAbort(JS::Handle<JS::Value>) /dom/abort/AbortSignal.cpp:161:20
        #7 0x7fe78f748672 in mozilla::dom::AbortController::Abort(JSContext*, JS::Handle<JS::Value>) /dom/abort/AbortController.cpp:81:14
        #8 0x7fe78fd108d6 in mozilla::dom::AbortController_Binding::abort(JSContext*, JS::Handle<JSObject*>, void*, JSJitMethodCallArgs const&) /builds/worker/workspace/obj-build/dom/bindings/AbortControllerBinding.cpp:86:24
        #9 0x7fe790f47e88 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:3306:13
        #10 0x7fe7949afcaf in CallJSNative(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), js::CallReason, JS::CallArgs const&) /js/src/vm/Interpreter.cpp:425:13
        #11 0x7fe7949af3ad in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /js/src/vm/Interpreter.cpp:512:12
        #12 0x7fe7949b0e8e in InternalCall(JSContext*, js::AnyInvokeArgs const&, js::CallReason) /js/src/vm/Interpreter.cpp:572:10
        #13 0x7fe7949a6696 in CallFromStack /js/src/vm/Interpreter.cpp:576:10
        #14 0x7fe7949a6696 in Interpret(JSContext*, js::RunState&) /js/src/vm/Interpreter.cpp:3309:16
        #15 0x7fe79499d5b3 in js::RunScript(JSContext*, js::RunState&) /js/src/vm/Interpreter.cpp:394:13
        #16 0x7fe7949af2a8 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /js/src/vm/Interpreter.cpp:544:13
        #17 0x7fe7949b0e8e in InternalCall(JSContext*, js::AnyInvokeArgs const&, js::CallReason) /js/src/vm/Interpreter.cpp:572:10
        #18 0x7fe7949b1091 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:589:8
        #19 0x7fe794b70c71 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
        #20 0x7fe790c5d727 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
        #21 0x7fe791410e06 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
        #22 0x7fe791410b8a in mozilla::EventListenerManager::HandleEventSubType(mozilla::EventListenerManager::Listener*, mozilla::dom::Event*, mozilla::dom::EventTarget*) /dom/events/EventListenerManager.cpp:1303:43
        #23 0x7fe791411889 in mozilla::EventListenerManager::HandleEventInternal(nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event**, mozilla::dom::EventTarget*, nsEventStatus*, bool) /dom/events/EventListenerManager.cpp:1500:17
        #24 0x7fe7914068b4 in HandleEvent /dom/events/EventListenerManager.h:395:5
        #25 0x7fe7914068b4 in mozilla::EventTargetChainItem::HandleEvent(mozilla::EventChainPostVisitor&, mozilla::ELMCreationDetector&) /dom/events/EventDispatcher.cpp:348:17
        #26 0x7fe791405dd7 in mozilla::EventTargetChainItem::HandleEventTargetChain(nsTArray<mozilla::EventTargetChainItem>&, mozilla::EventChainPostVisitor&, mozilla::EventDispatchingCallback*, mozilla::ELMCreationDetector&) /dom/events/EventDispatcher.cpp:550:16
        #27 0x7fe791408638 in mozilla::EventDispatcher::Dispatch(nsISupports*, nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsEventStatus*, mozilla::EventDispatchingCallback*, nsTArray<mozilla::dom::EventTarget*>*) /dom/events/EventDispatcher.cpp:1085:11
        #28 0x7fe792bbb1d3 in nsDocumentViewer::LoadComplete(nsresult) /layout/base/nsDocumentViewer.cpp:1086:7
        #29 0x7fe7941b7ac4 in nsDocShell::EndPageLoad(nsIWebProgress*, nsIChannel*, nsresult) /docshell/base/nsDocShell.cpp:6278:20
        #30 0x7fe7941b75b3 in nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, nsresult) /docshell/base/nsDocShell.cpp:5667:7
        #31 0x7fe7941b844f in non-virtual thunk to nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, nsresult) /docshell/base/nsDocShell.cpp
        #32 0x7fe78f01f5bc in nsDocLoader::DoFireOnStateChange(nsIWebProgress*, nsIRequest*, int&, nsresult) /uriloader/base/nsDocLoader.cpp:1377:3
        #33 0x7fe78f01eb4a in nsDocLoader::doStopDocumentLoad(nsIRequest*, nsresult) /uriloader/base/nsDocLoader.cpp:975:14
        #34 0x7fe78f01ced0 in nsDocLoader::DocLoaderIsEmpty(bool, mozilla::Maybe<nsresult> const&) /uriloader/base/nsDocLoader.cpp:794:9
        #35 0x7fe78f01e08d in nsDocLoader::OnStopRequest(nsIRequest*, nsresult) /uriloader/base/nsDocLoader.cpp:677:5
        #36 0x7fe7941d8f0d in nsDocShell::OnStopRequest(nsIRequest*, nsresult) /docshell/base/nsDocShell.cpp:13540:23
        #37 0x7fe78dd9ac2a in mozilla::net::nsLoadGroup::NotifyRemovalObservers(nsIRequest*, nsresult) /netwerk/base/nsLoadGroup.cpp:614:22
        #38 0x7fe78dd9c213 in mozilla::net::nsLoadGroup::RemoveRequest(nsIRequest*, nsISupports*, nsresult) /netwerk/base/nsLoadGroup.cpp:518:10
        #39 0x7fe78f9eb3c5 in mozilla::dom::Document::DoUnblockOnload() /dom/base/Document.cpp:11554:18
        #40 0x7fe78f9b5f23 in mozilla::dom::Document::UnblockOnload(bool) /dom/base/Document.cpp:11484:9
        #41 0x7fe78f9d1deb in mozilla::dom::Document::DispatchContentLoadedEvents() /dom/base/Document.cpp:7999:3
        #42 0x7fe78fa8307b in applyImpl<mozilla::dom::Document, void (mozilla::dom::Document::*)()> /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1147:12
        #43 0x7fe78fa8307b in apply<mozilla::dom::Document, void (mozilla::dom::Document::*)()> /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1153:12
        #44 0x7fe78fa8307b in mozilla::detail::RunnableMethodImpl<mozilla::dom::Document*, void (mozilla::dom::Document::*)(), true, (mozilla::RunnableKind)0>::Run() /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1200:13
        #45 0x7fe78dba0b92 in mozilla::SchedulerGroup::Runnable::Run() /xpcom/threads/SchedulerGroup.cpp:144:20
        #46 0x7fe78dbd0ece in mozilla::RunnableTask::Run() /xpcom/threads/TaskController.cpp:468:16
        #47 0x7fe78dbaad26 in mozilla::TaskController::DoExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) /xpcom/threads/TaskController.cpp:771:26
        #48 0x7fe78dba99e8 in mozilla::TaskController::ExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) /xpcom/threads/TaskController.cpp:607:15
        #49 0x7fe78dba9c63 in mozilla::TaskController::ProcessPendingMTTask(bool) /xpcom/threads/TaskController.cpp:391:36
        #50 0x7fe78dbd3f06 in operator() /xpcom/threads/TaskController.cpp:124:37
        #51 0x7fe78dbd3f06 in mozilla::detail::RunnableFunction<mozilla::TaskController::InitializeInternal()::$_0>::Run() /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:531:5
        #52 0x7fe78dbbf623 in nsThread::ProcessNextEvent(bool, bool*) /xpcom/threads/nsThread.cpp:1195:16
        #53 0x7fe78dbc670a in NS_ProcessNextEvent(nsIThread*, bool) /xpcom/threads/nsThreadUtils.cpp:467:10
        #54 0x7fe78e669c86 in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /ipc/glue/MessagePump.cpp:85:21
        #55 0x7fe78e5897c7 in MessageLoop::RunInternal() /ipc/chromium/src/base/message_loop.cc:331:10
        #56 0x7fe78e5896d2 in RunHandler /ipc/chromium/src/base/message_loop.cc:324:3
        #57 0x7fe78e5896d2 in MessageLoop::Run() /ipc/chromium/src/base/message_loop.cc:306:3
        #58 0x7fe792808158 in nsBaseAppShell::Run() /widget/nsBaseAppShell.cpp:137:27
        #59 0x7fe794833a83 in XRE_RunAppShell() /toolkit/xre/nsEmbedFunctions.cpp:864:20
        #60 0x7fe78e66ab7a in mozilla::ipc::MessagePumpForChildProcess::Run(base::MessagePump::Delegate*) /ipc/glue/MessagePump.cpp:235:9
        #61 0x7fe78e5897c7 in MessageLoop::RunInternal() /ipc/chromium/src/base/message_loop.cc:331:10
        #62 0x7fe78e5896d2 in RunHandler /ipc/chromium/src/base/message_loop.cc:324:3
        #63 0x7fe78e5896d2 in MessageLoop::Run() /ipc/chromium/src/base/message_loop.cc:306:3
        #64 0x7fe7948330bb in XRE_InitChildProcess(int, char**, XREChildData const*) /toolkit/xre/nsEmbedFunctions.cpp:701:34
        #65 0x55a35f3f1029 in content_process_main /browser/app/../../ipc/contentproc/plugin-container.cpp:57:28
        #66 0x55a35f3f1029 in main /browser/app/nsBrowserApp.cpp:327:18
        #67 0x7fe7a40f00b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16
        #68 0x55a35f3cc7bc in _start (/home/jkratzer/builds/mc-debug/firefox-bin+0x157bc)
    
    UndefinedBehaviorSanitizer can not provide additional info.
    SUMMARY: UndefinedBehaviorSanitizer: SEGV /dom/media/webaudio/AudioNode.cpp:284:3 in mozilla::dom::AudioNode::SendInt32ParameterToTrack(unsigned int, int)
    ==623419==ABORTING
Attached file Testcase

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

Start: 7643eaee62a3f09e252eed29ff7d649a708757e9 (20210111093448)
End: b81970e39db444fa9a70eaf2e656f3e48c18a7c1 (20220110093702)
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]

Here's what's happening, considering that when an AbortController 's abort() method is called, EventListeners that received it are removed.

  processor = null
  FuzzingFunctions.garbageCollect()

no other ref on the ScriptProcessorNode, AudioNode::LastRelease is called, this clears out mTrack and other graph-related things.

    controller.abort()

this removes all listeners on onaudioprocess, and doing that, it wants to communicate that new status to the graph, but the ScriptProcessorNode has a refcount of 0 at this point, and there is nothing graph-side, so it asserts.

We can null-check when removing the listener in our case, I guess, but it's weird to have something calling into an object when it has a CC refcount of 0.

Assignee: nobody → padenot
Status: NEW → ASSIGNED

I don't think this is urgent, it can wait until Karl is back, he really is the right person to review this.

Severity: -- → S4
Pushed by padenot@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/3717408688bd
Don't attempt to send a message to the graph after a ScriptProcessorNode has been marked for collection. r=karlt
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 98 Branch

Bugmon Analysis
Verified bug as fixed on rev mozilla-central 20220131165143-bb528a123b65.
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: → 1752917

:padenot, 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?(padenot)

Sorry, wrong needinfo because of a bug in the bot.

Flags: needinfo?(padenot)
You need to log in before you can comment on or make changes to this bug.