Closed Bug 1555786 Opened 2 years ago Closed 1 year ago

AddressSanitizer: SEGV /builds/worker/workspace/build/src/dom/base/nsPIDOMWindow.h:707:62 in GetCurrentInnerWindow

Categories

(Core :: DOM: Core & HTML, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla69
Tracking Status
firefox-esr60 --- unaffected
firefox67 --- unaffected
firefox68 --- disabled
firefox69 --- fixed

People

(Reporter: jkratzer, Assigned: boris)

References

(Blocks 2 open bugs, Regression)

Details

(Keywords: crash, regression, testcase)

Attachments

(3 files)

Attached file testcase.html

Testcase found while fuzzing mozilla-central rev 462fc9264901.

==5214==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000060 (pc 0x7f8f1a43b365 bp 0x7ffcac3b97d0 sp 0x7ffcac3b9460 T0)
==5214==The signal is caused by a READ memory access.
==5214==Hint: address points to the zero page.
    #0 0x7f8f1a43b364 in GetCurrentInnerWindow /builds/worker/workspace/build/src/dom/base/nsPIDOMWindow.h:707:62
    #1 0x7f8f1a43b364 in mozilla::dom::ResizeObserverController::Notify() /builds/worker/workspace/build/src/dom/base/ResizeObserverController.cpp:151
    #2 0x7f8f20e69094 in nsRefreshDriver::Tick(mozilla::layers::BaseTransactionId<mozilla::VsyncIdType>, mozilla::TimeStamp) /builds/worker/workspace/build/src/layout/base/nsRefreshDriver.cpp:1900:12
    #3 0x7f8f20e7f319 in TickDriver /builds/worker/workspace/build/src/layout/base/nsRefreshDriver.cpp:349:13
    #4 0x7f8f20e7f319 in mozilla::RefreshDriverTimer::TickRefreshDrivers(mozilla::layers::BaseTransactionId<mozilla::VsyncIdType>, mozilla::TimeStamp, nsTArray<RefPtr<nsRefreshDriver> >&) /builds/worker/workspace/build/src/layout/base/nsRefreshDriver.cpp:326
    #5 0x7f8f20e7ebb2 in mozilla::RefreshDriverTimer::Tick(mozilla::layers::BaseTransactionId<mozilla::VsyncIdType>, mozilla::TimeStamp) /builds/worker/workspace/build/src/layout/base/nsRefreshDriver.cpp:343:5
    #6 0x7f8f20e830ef in RunRefreshDrivers /builds/worker/workspace/build/src/layout/base/nsRefreshDriver.cpp:789:5
    #7 0x7f8f20e830ef in mozilla::VsyncRefreshDriverTimer::RefreshDriverVsyncObserver::TickRefreshDriver(mozilla::layers::BaseTransactionId<mozilla::VsyncIdType>, mozilla::TimeStamp) /builds/worker/workspace/build/src/layout/base/nsRefreshDriver.cpp:709
    #8 0x7f8f20e82143 in mozilla::VsyncRefreshDriverTimer::RefreshDriverVsyncObserver::NotifyVsync(mozilla::VsyncEvent const&) /builds/worker/workspace/build/src/layout/base/nsRefreshDriver.cpp:604:9
    #9 0x7f8f219f9625 in mozilla::layout::VsyncChild::RecvNotify(mozilla::VsyncEvent const&) /builds/worker/workspace/build/src/layout/ipc/VsyncChild.cpp:65:16
    #10 0x7f8f17e1c894 in mozilla::layout::PVsyncChild::OnMessageReceived(IPC::Message const&) /builds/worker/workspace/build/src/obj-firefox/ipc/ipdl/PVsyncChild.cpp:187:54
    #11 0x7f8f1799e2e5 in mozilla::ipc::PBackgroundChild::OnMessageReceived(IPC::Message const&) /builds/worker/workspace/build/src/obj-firefox/ipc/ipdl/PBackgroundChild.cpp:4717:32
    #12 0x7f8f171ce306 in mozilla::ipc::MessageChannel::DispatchAsyncMessage(mozilla::ipc::ActorLifecycleProxy*, IPC::Message const&) /builds/worker/workspace/build/src/ipc/glue/MessageChannel.cpp:2158:25
    #13 0x7f8f171c9d1b in mozilla::ipc::MessageChannel::DispatchMessage(IPC::Message&&) /builds/worker/workspace/build/src/ipc/glue/MessageChannel.cpp:2082:9
    #14 0x7f8f171cc2d7 in mozilla::ipc::MessageChannel::RunMessage(mozilla::ipc::MessageChannel::MessageTask&) /builds/worker/workspace/build/src/ipc/glue/MessageChannel.cpp:1939:3
    #15 0x7f8f171cd067 in mozilla::ipc::MessageChannel::MessageTask::Run() /builds/worker/workspace/build/src/ipc/glue/MessageChannel.cpp:1970:13
    #16 0x7f8f15df9d87 in nsThread::ProcessNextEvent(bool, bool*) /builds/worker/workspace/build/src/xpcom/threads/nsThread.cpp:1176:14
    #17 0x7f8f15e019c4 in NS_ProcessNextEvent(nsIThread*, bool) /builds/worker/workspace/build/src/xpcom/threads/nsThreadUtils.cpp:486:10
    #18 0x7f8f171d771f in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /builds/worker/workspace/build/src/ipc/glue/MessagePump.cpp:88:21
    #19 0x7f8f170af1ee in RunInternal /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:315:10
    #20 0x7f8f170af1ee in RunHandler /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:308
    #21 0x7f8f170af1ee in MessageLoop::Run() /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:290
    #22 0x7f8f207836d3 in nsBaseAppShell::Run() /builds/worker/workspace/build/src/widget/nsBaseAppShell.cpp:137:27
    #23 0x7f8f24db231e in XRE_RunAppShell() /builds/worker/workspace/build/src/toolkit/xre/nsEmbedFunctions.cpp:911:20
    #24 0x7f8f170af1ee in RunInternal /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:315:10
    #25 0x7f8f170af1ee in RunHandler /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:308
    #26 0x7f8f170af1ee in MessageLoop::Run() /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:290
    #27 0x7f8f24db148c in XRE_InitChildProcess(int, char**, XREChildData const*) /builds/worker/workspace/build/src/toolkit/xre/nsEmbedFunctions.cpp:749:34
    #28 0x55d22a15666e in content_process_main /builds/worker/workspace/build/src/browser/app/../../ipc/contentproc/plugin-container.cpp:56:28
    #29 0x55d22a15666e in main /builds/worker/workspace/build/src/browser/app/nsBrowserApp.cpp:263
    #30 0x7f8f3a184b96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
Flags: in-testsuite?

Hi Jason, I am not able to reproduce this crash with the test you provide, is there any additional step to reproduce it, e.g. enable some preference or ...?

Flags: needinfo?(jkratzer)
Attached file prefs-default-e10s.js
Flags: needinfo?(jkratzer)

Edgar, sorry for the delay. The testcase must be served via HTTP due to the calls to XHR and ResizeObserver api must be enabled. I've attached the prefs I used to reproduce this crash.

Resize Observer API was landed recently in Bug 1272409. Boris may be able to take a look and suggest the next step.

Flags: needinfo?(boris.chiou)

I have no idea to reproduce this (so many prefs). However, I suspect this happened when we call Notify() after we close the window. Notify() calls nsCOMPtr<nsPIDOMWindowInner> window = doc->GetWindow()->GetCurrentInnerWindow();, and looks like GetWindow() might return nullptr. (Not 100% familiar with the expected behavior of GetWindow(), but the logical looks like it is possible.) I would upload a patch that handles this nullptr case, and let's see if this still happens after landing.

Flags: needinfo?(boris.chiou)

Bugbug thinks this bug is a regression, but please revert this change in case of error.

Keywords: regression
Priority: -- → P2
Attachment #9073691 - Attachment description: Bug 1555786 - Handle null outer window properly for resize observer. → Bug 1555786 - Get inner window from doc directly for resize observer.
Assignee: nobody → boris.chiou
Pushed by boris.chiou@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/a3cad1d7836c
Get inner window from doc directly for resize observer. r=smaug
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla69

IIUC, this feature is behind a pref and won't be shipping in 68.

Flags: in-testsuite? → in-testsuite+
Regressed by: resize-observer-v1

Yes. We shipped it in Firefox 69. Thanks for updating the tracking status.

You need to log in before you can comment on or make changes to this bug.