Closed Bug 1691963 Opened 2 months ago Closed 2 months ago

Crash [@ get] near [@ mozilla::dom::WindowContext]

Categories

(Core :: DOM: Device Interfaces, defect, P3)

defect

Tracking

()

VERIFIED FIXED
88 Branch
Tracking Status
firefox-esr78 --- wontfix
firefox86 --- wontfix
firefox87 --- fixed
firefox88 --- verified

People

(Reporter: jkratzer, Assigned: kmag)

References

(Blocks 1 open bug)

Details

(Keywords: crash, testcase, Whiteboard: [bugmon:confirm])

Crash Data

Attachments

(2 files)

Attached file testcase.html

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

==3596100==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000090 (pc 0x7f42b176f1ab bp 0x7fffd72d7050 sp 0x7fffd72d7030 T0)
==3596100==The signal is caused by a READ memory access.
==3596100==Hint: address points to the zero page.
    #0 0x7f42b176f1ab in get /builds/worker/workspace/obj-build/dist/include/mozilla/RefPtr.h:286:27
    #1 0x7f42b176f1ab in operator mozilla::dom::WindowContext * /builds/worker/workspace/obj-build/dist/include/mozilla/RefPtr.h:299:12
    #2 0x7f42b176f1ab in WindowContext /builds/worker/workspace/obj-build/dist/include/mozilla/dom/WindowGlobalChild.h:52:54
    #3 0x7f42b176f1ab in mozilla::dom::IsSameOriginWithAncestors(nsPIDOMWindowInner*) /builds/worker/checkouts/gecko/dom/credentialmanagement/CredentialsContainer.cpp:70:17
    #4 0x7f42b176f0c7 in mozilla::dom::CredentialsContainer::Get(mozilla::dom::CredentialRequestOptions const&, mozilla::ErrorResult&) /builds/worker/checkouts/gecko/dom/credentialmanagement/CredentialsContainer.cpp:103:8
    #5 0x7f42b0ad004e in get /builds/worker/workspace/obj-build/dom/bindings/CredentialManagementBinding.cpp:680:60
    #6 0x7f42b0ad004e in mozilla::dom::CredentialsContainer_Binding::get_promiseWrapper(JSContext*, JS::Handle<JSObject*>, void*, JSJitMethodCallArgs const&) /builds/worker/workspace/obj-build/dom/bindings/CredentialManagementBinding.cpp:694:13
    #7 0x7f42b1091137 in bool mozilla::dom::binding_detail::GenericMethod<mozilla::dom::binding_detail::NormalThisPolicy, mozilla::dom::binding_detail::ConvertExceptionsToPromises>(JSContext*, unsigned int, JS::Value*) /builds/worker/checkouts/gecko/dom/bindings/BindingUtils.cpp:3233:13
    #8 0x7f42b7df9a5f in CallJSNative /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:435:13
    #9 0x7f42b7df9a5f in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:520:12
    #10 0x7f42b7dfb9ee in InternalCall(JSContext*, js::AnyInvokeArgs const&, js::CallReason) /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:580:10
    #11 0x7f42b7de4c85 in CallFromStack /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:584:10
    #12 0x7f42b7de4c85 in Interpret(JSContext*, js::RunState&) /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:3243:16
    #13 0x7f42b7dc576b in js::RunScript(JSContext*, js::RunState&) /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:405:13
    #14 0x7f42b7df9b9a in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:552:13
    #15 0x7f42b7dfb9ee in InternalCall(JSContext*, js::AnyInvokeArgs const&, js::CallReason) /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:580:10
    #16 0x7f42b7dfbd70 in js::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, js::AnyInvokeArgs const&, JS::MutableHandle<JS::Value>, js::CallReason) /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:597:8
    #17 0x7f42b8705ab2 in JS::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, JS::HandleValueArray const&, JS::MutableHandle<JS::Value>) /builds/worker/checkouts/gecko/js/src/jsapi.cpp:2861:10
    #18 0x7f42b0d46970 in mozilla::dom::Function::Call(mozilla::dom::BindingCallContext&, JS::Handle<JS::Value>, nsTArray<JS::Value> const&, JS::MutableHandle<JS::Value>, mozilla::ErrorResult&) /builds/worker/workspace/obj-build/dom/bindings/FunctionBinding.cpp:46:8
    #19 0x7f42af43b9da in void mozilla::dom::Function::Call<nsCOMPtr<nsIGlobalObject> >(nsCOMPtr<nsIGlobalObject> const&, nsTArray<JS::Value> const&, JS::MutableHandle<JS::Value>, mozilla::ErrorResult&, char const*, mozilla::dom::CallbackObject::ExceptionHandling, JS::Realm*) /builds/worker/workspace/obj-build/dist/include/mozilla/dom/FunctionBinding.h:72:12
    #20 0x7f42af43b643 in mozilla::dom::CallbackTimeoutHandler::Call(char const*) /builds/worker/checkouts/gecko/dom/base/TimeoutHandler.cpp:167:29
    #21 0x7f42af065ec4 in nsGlobalWindowInner::RunTimeoutHandler(mozilla::dom::Timeout*, nsIScriptContext*) /builds/worker/checkouts/gecko/dom/base/nsGlobalWindowInner.cpp:6233:38
    #22 0x7f42af437479 in mozilla::dom::TimeoutManager::RunTimeout(mozilla::TimeStamp const&, mozilla::TimeStamp const&, bool) /builds/worker/checkouts/gecko/dom/base/TimeoutManager.cpp:896:44
    #23 0x7f42af436315 in mozilla::dom::TimeoutExecutor::MaybeExecute() /builds/worker/checkouts/gecko/dom/base/TimeoutExecutor.cpp:179:11
    #24 0x7f42af4391d6 in Notify /builds/worker/checkouts/gecko/dom/base/TimeoutExecutor.cpp:246:5
    #25 0x7f42af4391d6 in non-virtual thunk to mozilla::dom::TimeoutExecutor::Notify(nsITimer*) /builds/worker/checkouts/gecko/dom/base/TimeoutExecutor.cpp
    #26 0x7f42abad26a9 in nsTimerImpl::Fire(int) /builds/worker/checkouts/gecko/xpcom/threads/nsTimerImpl.cpp:565:39
    #27 0x7f42abad1e8d in nsTimerEvent::Run() /builds/worker/checkouts/gecko/xpcom/threads/TimerThread.cpp:252:11
    #28 0x7f42abb11661 in mozilla::ThrottledEventQueue::Inner::ExecuteRunnable() /builds/worker/checkouts/gecko/xpcom/threads/ThrottledEventQueue.cpp:254:22
    #29 0x7f42abb043ff in mozilla::ThrottledEventQueue::Inner::Executor::Run() /builds/worker/checkouts/gecko/xpcom/threads/ThrottledEventQueue.cpp:81:15
    #30 0x7f42ababcc99 in mozilla::RunnableTask::Run() /builds/worker/checkouts/gecko/xpcom/threads/TaskController.cpp:472:16
    #31 0x7f42abab9494 in mozilla::TaskController::DoExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) /builds/worker/checkouts/gecko/xpcom/threads/TaskController.cpp:753:26
    #32 0x7f42abab6f87 in mozilla::TaskController::ExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) /builds/worker/checkouts/gecko/xpcom/threads/TaskController.cpp:611:15
    #33 0x7f42abab73dd in mozilla::TaskController::ProcessPendingMTTask(bool) /builds/worker/checkouts/gecko/xpcom/threads/TaskController.cpp:395:36
    #34 0x7f42abac4c44 in operator() /builds/worker/checkouts/gecko/xpcom/threads/TaskController.cpp:136:37
    #35 0x7f42abac4c44 in mozilla::detail::RunnableFunction<mozilla::TaskController::InitializeInternal()::$_4>::Run() /builds/worker/checkouts/gecko/xpcom/threads/nsThreadUtils.h:534:5
    #36 0x7f42abae4d3d in nsThread::ProcessNextEvent(bool, bool*) /builds/worker/checkouts/gecko/xpcom/threads/nsThread.cpp:1158:16
    #37 0x7f42abaf087c in NS_ProcessNextEvent(nsIThread*, bool) /builds/worker/checkouts/gecko/xpcom/threads/nsThreadUtils.cpp:548:10
    #38 0x7f42acdf7b24 in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /builds/worker/checkouts/gecko/ipc/glue/MessagePump.cpp:109:5
    #39 0x7f42acced721 in RunInternal /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:335:10
    #40 0x7f42acced721 in RunHandler /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:328:3
    #41 0x7f42acced721 in MessageLoop::Run() /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:310:3
    #42 0x7f42b3d98c47 in nsBaseAppShell::Run() /builds/worker/checkouts/gecko/widget/nsBaseAppShell.cpp:137:27
    #43 0x7f42b7b8ee5f in XRE_RunAppShell() /builds/worker/checkouts/gecko/toolkit/xre/nsEmbedFunctions.cpp:902:20
    #44 0x7f42acced721 in RunInternal /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:335:10
    #45 0x7f42acced721 in RunHandler /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:328:3
    #46 0x7f42acced721 in MessageLoop::Run() /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:310:3
    #47 0x7f42b7b8e3fc in XRE_InitChildProcess(int, char**, XREChildData const*) /builds/worker/checkouts/gecko/toolkit/xre/nsEmbedFunctions.cpp:733:34
    #48 0x556fdc92504d in content_process_main(mozilla::Bootstrap*, int, char**) /builds/worker/checkouts/gecko/browser/app/../../ipc/contentproc/plugin-container.cpp:57:28
    #49 0x556fdc925487 in main /builds/worker/checkouts/gecko/browser/app/nsBrowserApp.cpp:306:18
    #50 0x7f42cc9080b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16
Flags: in-testsuite?
Crash Signature: [@ mozilla::dom::IsSameOriginWithAncestors ]
Keywords: crash

assigning to kmag to add a null check to inner window

Assignee: nobody → kmaglione+bmo
Severity: -- → S3
Priority: -- → P3

The WindowGlobalChild for a window will be null after it's been destroyed
(such as by a frame being removed), so we need to null check and fail safe.

Pushed by maglione.k@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/524e3e31de9e
Handle destroyed inner window in IsSameOriginWithAncestors. r=nika
Status: NEW → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 88 Branch

Bugmon Analysis:
Verified bug as fixed on rev mozilla-central 20210223085042-916497e295fe.
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

The patch landed in nightly and beta is affected.
:kmag, is this bug important enough to require an uplift?
If not please set status_beta to wontfix.

For more information, please visit auto_nag documentation.

Flags: needinfo?(kmaglione+bmo)

Comment on attachment 9204675 [details]
Bug 1691963: Handle destroyed inner window in IsSameOriginWithAncestors. r=nika

Beta/Release Uplift Approval Request

  • User impact if declined: This bug causes (relatively safe) null pointer crashes in certain corner cases where a window is destroyed shortly after the credentials API is used.
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: No
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): It's a simple null pointer check.
  • String changes made/needed:
Flags: needinfo?(kmaglione+bmo)
Attachment #9204675 - Flags: approval-mozilla-beta?

Comment on attachment 9204675 [details]
Bug 1691963: Handle destroyed inner window in IsSameOriginWithAncestors. r=nika

from crash-stats it doesn't look like this gets hit a lot, but otoh it's a safe change, so approved for 87.0b9

Attachment #9204675 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
You need to log in before you can comment on or make changes to this bug.