Closed Bug 1755580 Opened 3 years ago Closed 3 years ago

Crash [@ mozilla::ClientWebGLContext::GetPrincipalHashValue]

Categories

(Core :: Graphics: CanvasWebGL, defect, P1)

x86_64
Linux
defect

Tracking

()

VERIFIED FIXED
99 Branch
Tracking Status
firefox-esr91 --- unaffected
firefox97 --- disabled
firefox98 --- disabled
firefox99 --- verified

People

(Reporter: jkratzer, Assigned: aosmond)

References

(Blocks 1 open bug, Regression)

Details

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

Crash Data

Attachments

(3 files)

Testcase found while fuzzing mozilla-central rev 2bbcda1a3414 (built with: --enable-address-sanitizer --enable-fuzzing).

Testcase can be reproduced using the following commands:

$ pip install fuzzfetch grizzly-framework
$ python -m fuzzfetch --build 2bbcda1a3414 --asan --fuzzing -n firefox
$ python -m grizzly.replay ./firefox/firefox testcase.zip
[@ mozilla::ClientWebGLContext::GetPrincipalHashValue]

    =================================================================
    ==3953463==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7ff6669dded1 bp 0x7ffde6275e30 sp 0x7ffde6275e20 T0)
    ==3953463==The signal is caused by a READ memory access.
    ==3953463==Hint: address points to the zero page.
        #0 0x7ff6669dded1 in mozilla::ClientWebGLContext::GetPrincipalHashValue() const /dom/canvas/ClientWebGLContext.cpp:5440:48
        #1 0x7ff6669715e1 in operator() /dom/canvas/ClientWebGLContext.cpp:644:31
        #2 0x7ff6669715e1 in mozilla::ClientWebGLContext::CreateHostContext(mozilla::avec2<unsigned int> const&) /dom/canvas/ClientWebGLContext.cpp:624:14
        #3 0x7ff666977392 in mozilla::ClientWebGLContext::SetDimensions(int, int) /dom/canvas/ClientWebGLContext.cpp:596:8
        #4 0x7ff66696bd37 in mozilla::dom::CanvasRenderingContextHelper::UpdateContext(JSContext*, JS::Handle<JS::Value>, mozilla::ErrorResult&) /dom/canvas/CanvasRenderingContextHelper.cpp:260:24
        #5 0x7ff66696b8c2 in mozilla::dom::CanvasRenderingContextHelper::GetOrCreateContext(JSContext*, mozilla::dom::CanvasContextType, JS::Handle<JS::Value>, mozilla::ErrorResult&) /dom/canvas/CanvasRenderingContextHelper.cpp:212:19
        #6 0x7ff666a1e3bd in mozilla::dom::OffscreenCanvas::GetContext(JSContext*, mozilla::dom::OffscreenRenderingContextId const&, JS::Handle<JS::Value>, mozilla::dom::Nullable<mozilla::dom::OwningOffscreenCanvasRenderingContext2DOrImageBitmapRenderingContextOrWebGLRenderingContextOrWebGL2RenderingContextOrGPUCanvasContext>&, mozilla::ErrorResult&) /dom/canvas/OffscreenCanvas.cpp:144:62
        #7 0x7ff6654828ad in mozilla::dom::OffscreenCanvas_Binding::getContext(JSContext*, JS::Handle<JSObject*>, void*, JSJitMethodCallArgs const&) /builds/worker/workspace/obj-build/dom/bindings/OffscreenCanvasBinding.cpp:891:24
        #8 0x7ff6667d249d 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
        #9 0x7ff66e4f9db4 in CallJSNative /js/src/vm/Interpreter.cpp:425:13
        #10 0x7ff66e4f9db4 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /js/src/vm/Interpreter.cpp:512:12
        #11 0x7ff66e4e62ce in CallFromStack /js/src/vm/Interpreter.cpp:576:10
        #12 0x7ff66e4e62ce in Interpret(JSContext*, js::RunState&) /js/src/vm/Interpreter.cpp:3309:16
        #13 0x7ff66e4cb0d1 in js::RunScript(JSContext*, js::RunState&) /js/src/vm/Interpreter.cpp:394:13
        #14 0x7ff66e4f9eef in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /js/src/vm/Interpreter.cpp:544:13
        #15 0x7ff66e4fc03b 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
        #16 0x7ff66e77aa8d 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
        #17 0x7ff6663fdee9 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
        #18 0x7ff6670c81e4 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
        #19 0x7ff6670c7ca0 in mozilla::EventListenerManager::HandleEventSubType(mozilla::EventListenerManager::Listener*, mozilla::dom::Event*, mozilla::dom::EventTarget*) /dom/events/EventListenerManager.cpp:1308:43
        #20 0x7ff6670c934c in mozilla::EventListenerManager::HandleEventInternal(nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event**, mozilla::dom::EventTarget*, nsEventStatus*, bool) /dom/events/EventListenerManager.cpp:1505:17
        #21 0x7ff6670b746e in mozilla::EventTargetChainItem::HandleEvent(mozilla::EventChainPostVisitor&, mozilla::ELMCreationDetector&) /dom/events/EventDispatcher.cpp:348:17
        #22 0x7ff6670b5c7d in mozilla::EventTargetChainItem::HandleEventTargetChain(nsTArray<mozilla::EventTargetChainItem>&, mozilla::EventChainPostVisitor&, mozilla::EventDispatchingCallback*, mozilla::ELMCreationDetector&) /dom/events/EventDispatcher.cpp:550:16
        #23 0x7ff6670b9ef5 in mozilla::EventDispatcher::Dispatch(nsISupports*, nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsEventStatus*, mozilla::EventDispatchingCallback*, nsTArray<mozilla::dom::EventTarget*>*) /dom/events/EventDispatcher.cpp:1085:11
        #24 0x7ff669b25867 in nsDocumentViewer::LoadComplete(nsresult) /layout/base/nsDocumentViewer.cpp:1084:7
        #25 0x7ff66d588c93 in nsDocShell::EndPageLoad(nsIWebProgress*, nsIChannel*, nsresult) /docshell/base/nsDocShell.cpp:6403:20
        #26 0x7ff66d587f8b in nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, nsresult) /docshell/base/nsDocShell.cpp:5792:7
        #27 0x7ff66d589f5f in non-virtual thunk to nsDocShell::OnStateChange(nsIWebProgress*, nsIRequest*, unsigned int, nsresult) /docshell/base/nsDocShell.cpp
        #28 0x7ff663685b60 in nsDocLoader::DoFireOnStateChange(nsIWebProgress*, nsIRequest*, int&, nsresult) /uriloader/base/nsDocLoader.cpp:1377:3
        #29 0x7ff663684774 in nsDocLoader::doStopDocumentLoad(nsIRequest*, nsresult) /uriloader/base/nsDocLoader.cpp:975:14
        #30 0x7ff663680fa2 in nsDocLoader::DocLoaderIsEmpty(bool, mozilla::Maybe<nsresult> const&) /uriloader/base/nsDocLoader.cpp:794:9
        #31 0x7ff663683165 in nsDocLoader::OnStopRequest(nsIRequest*, nsresult) /uriloader/base/nsDocLoader.cpp:677:5
        #32 0x7ff66d5c2b7b in nsDocShell::OnStopRequest(nsIRequest*, nsresult) /docshell/base/nsDocShell.cpp:13715:23
        #33 0x7ff661374d1e in mozilla::net::nsLoadGroup::NotifyRemovalObservers(nsIRequest*, nsresult) /netwerk/base/nsLoadGroup.cpp:614:22
        #34 0x7ff661377763 in mozilla::net::nsLoadGroup::RemoveRequest(nsIRequest*, nsISupports*, nsresult) /netwerk/base/nsLoadGroup.cpp:518:10
        #35 0x7ff6648edcc2 in mozilla::dom::Document::DoUnblockOnload() /dom/base/Document.cpp:11554:18
        #36 0x7ff66489b0c7 in mozilla::dom::Document::UnblockOnload(bool) /dom/base/Document.cpp:11484:9
        #37 0x7ff6648c5a7c in mozilla::dom::Document::DispatchContentLoadedEvents() /dom/base/Document.cpp:7999:3
        #38 0x7ff6649b56fd in applyImpl<mozilla::dom::Document, void (mozilla::dom::Document::*)()> /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1147:12
        #39 0x7ff6649b56fd in apply<mozilla::dom::Document, void (mozilla::dom::Document::*)()> /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1153:12
        #40 0x7ff6649b56fd 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
        #41 0x7ff660fd71cf in mozilla::SchedulerGroup::Runnable::Run() /xpcom/threads/SchedulerGroup.cpp:140:20
        #42 0x7ff661026002 in mozilla::RunnableTask::Run() /xpcom/threads/TaskController.cpp:467:16
        #43 0x7ff660fea68d in mozilla::TaskController::DoExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) /xpcom/threads/TaskController.cpp:770:26
        #44 0x7ff660fe7be8 in mozilla::TaskController::ExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) /xpcom/threads/TaskController.cpp:606:15
        #45 0x7ff660fe82f9 in mozilla::TaskController::ProcessPendingMTTask(bool) /xpcom/threads/TaskController.cpp:390:36
        #46 0x7ff66102e701 in operator() /xpcom/threads/TaskController.cpp:124:37
        #47 0x7ff66102e701 in mozilla::detail::RunnableFunction<mozilla::TaskController::InitializeInternal()::$_0>::Run() /xpcom/threads/nsThreadUtils.h:531:5
        #48 0x7ff66100b3f7 in nsThread::ProcessNextEvent(bool, bool*) /xpcom/threads/nsThread.cpp:1171:16
        #49 0x7ff66101696c in NS_ProcessNextEvent(nsIThread*, bool) /xpcom/threads/nsThreadUtils.cpp:467:10
        #50 0x7ff66253cf9f in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /ipc/glue/MessagePump.cpp:85:21
        #51 0x7ff6623b5611 in RunInternal /ipc/chromium/src/base/message_loop.cc:331:10
        #52 0x7ff6623b5611 in RunHandler /ipc/chromium/src/base/message_loop.cc:324:3
        #53 0x7ff6623b5611 in MessageLoop::Run() /ipc/chromium/src/base/message_loop.cc:306:3
        #54 0x7ff6694c1da7 in nsBaseAppShell::Run() /widget/nsBaseAppShell.cpp:137:27
        #55 0x7ff66e2165af in XRE_RunAppShell() /toolkit/xre/nsEmbedFunctions.cpp:878:20
        #56 0x7ff6623b5611 in RunInternal /ipc/chromium/src/base/message_loop.cc:331:10
        #57 0x7ff6623b5611 in RunHandler /ipc/chromium/src/base/message_loop.cc:324:3
        #58 0x7ff6623b5611 in MessageLoop::Run() /ipc/chromium/src/base/message_loop.cc:306:3
        #59 0x7ff66e2157e3 in XRE_InitChildProcess(int, char**, XREChildData const*) /toolkit/xre/nsEmbedFunctions.cpp:715:34
        #60 0x555b51e5a80d in content_process_main(mozilla::Bootstrap*, int, char**) /browser/app/../../ipc/contentproc/plugin-container.cpp:57:28
        #61 0x555b51e5ac40 in main /browser/app/nsBrowserApp.cpp:327:18
        #62 0x7ff685ad40b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16
        #63 0x555b51da98d9 in _start (/home/jkratzer/builds/mc-asan/firefox+0x5d8d9)
    
    AddressSanitizer can not provide additional info.
    SUMMARY: AddressSanitizer: SEGV /dom/canvas/ClientWebGLContext.cpp:5440:48 in mozilla::ClientWebGLContext::GetPrincipalHashValue() const
    ==3953463==ABORTING
Attached file Testcase

Bugmon Analysis
Verified bug as reproducible on mozilla-central 20220215210051-950c1613c97d.
The bug appears to have been introduced in the following build range:

Start: f7f7501a99f7aeb40a698b237cafc6dc3129e16f (20211210143634)
End: 34e079fbcc7616e07fd022e363ffef6f7acba756 (20211210090826)
Pushlog: https://hg.mozilla.org/mozilla-unified/pushloghtml?fromchange=f7f7501a99f7aeb40a698b237cafc6dc3129e16f&tochange=34e079fbcc7616e07fd022e363ffef6f7acba756

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

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

For more information, please visit auto_nag documentation.

Flags: needinfo?(jgilbert)

@aosmond, can you take this? OffscreenCanvas crash from fuzzers.

Severity: -- → S3
Flags: needinfo?(jgilbert) → needinfo?(aosmond)
Priority: -- → P1
Assignee: nobody → aosmond

:aosmond, 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?(aosmond)
Flags: needinfo?(aosmond)
Regressed by: 1657375

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

OffscreenCanvas::GetOwnerGlobal can return null when the document or
worker thread is closing. We should check for this when we need the
principal hash value. I have not been able to reproduce with the test
case but it is racy because it keeps reloading the document on a loop
with the last action to be create a WebGL context with OffscreenCanvas.

Pushed by aosmond@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e6d9c0dc39bd Fix a crash caused by a race with OffscreenCanvas and the document closing. r=gfx-reviewers,nical
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 99 Branch

Bugmon Analysis
Verified bug as fixed on rev mozilla-central 20220304041828-3dac5cfdfc06.
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
Has Regression Range: --- → yes
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: