Closed Bug 2018012 Opened 8 months ago Closed 8 months ago

crash near null in [@ mozilla::dom::Element::ClearServoData]

Categories

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

defect

Tracking

()

VERIFIED FIXED
149 Branch
Tracking Status
firefox-esr115 --- wontfix
firefox-esr140 --- wontfix
firefox148 --- wontfix
firefox149 --- verified

People

(Reporter: tsmith, Assigned: emilio)

References

(Blocks 1 open bug, Regression)

Details

(5 keywords, Whiteboard: [bugmon:bisected,confirmed], [wptsync upstream])

Crash Data

Attachments

(1 file, 1 external file)

Attached file testcase.html —

Found while fuzzing m-c 20260213-0d74a4189e30 (--enable-address-sanitizer --enable-fuzzing)

To reproduce via Grizzly Replay:

$ pip install fuzzfetch grizzly-framework --upgrade
$ python -m fuzzfetch -a --fuzzing -n firefox
$ python -m grizzly.replay.bugzilla ./firefox/firefox <bugid>
==46817==ERROR: AddressSanitizer: SEGV on unknown address 0x0000000009e0 (pc 0x78c9177026f3 bp 0x7ffd72a70c70 sp 0x7ffd72a70c60 T0)
==46817==The signal is caused by a READ memory access.
==46817==Hint: address points to the zero page.
    #0 0x78c9177026f3 in get /builds/worker/checkouts/gecko/xpcom/base/nsCOMPtr.h:750:48
    #1 0x78c9177026f3 in operator nsINode * /builds/worker/checkouts/gecko/xpcom/base/nsCOMPtr.h:758:33
    #2 0x78c9177026f3 in GetServoRestyleRoot /builds/worker/workspace/obj-build/dist/include/mozilla/dom/Document.h:4304:49
    #3 0x78c9177026f3 in mozilla::dom::Element::ClearServoData(mozilla::dom::Document*) /builds/worker/checkouts/gecko/dom/base/Element.cpp:5506:13
    #4 0x78c91eaf4afa in ClearServoData /builds/worker/workspace/obj-build/dist/include/mozilla/dom/Element.h:601:27
    #5 0x78c91eaf4afa in mozilla::RestyleManager::ClearServoDataFromSubtree(mozilla::dom::Element*, mozilla::RestyleManager::IncludeRoot) /builds/worker/checkouts/gecko/layout/style/RestyleManager.cpp:2489:15
    #6 0x78c91eaf49b1 in mozilla::RestyleManager::ClearServoDataFromSubtree(mozilla::dom::Element*, mozilla::RestyleManager::IncludeRoot) /builds/worker/checkouts/gecko/layout/style/RestyleManager.cpp:2483:9
    #7 0x78c91eaf49b1 in mozilla::RestyleManager::ClearServoDataFromSubtree(mozilla::dom::Element*, mozilla::RestyleManager::IncludeRoot) /builds/worker/checkouts/gecko/layout/style/RestyleManager.cpp:2483:9
    #8 0x78c91eaf49b1 in mozilla::RestyleManager::ClearServoDataFromSubtree(mozilla::dom::Element*, mozilla::RestyleManager::IncludeRoot) /builds/worker/checkouts/gecko/layout/style/RestyleManager.cpp:2483:9
    #9 0x78c91eaf49b1 in mozilla::RestyleManager::ClearServoDataFromSubtree(mozilla::dom::Element*, mozilla::RestyleManager::IncludeRoot) /builds/worker/checkouts/gecko/layout/style/RestyleManager.cpp:2483:9
    #10 0x78c91eaf49b1 in mozilla::RestyleManager::ClearServoDataFromSubtree(mozilla::dom::Element*, mozilla::RestyleManager::IncludeRoot) /builds/worker/checkouts/gecko/layout/style/RestyleManager.cpp:2483:9
    #11 0x78c91763fe19 in mozilla::dom::Document::ClearStaleServoData() /builds/worker/checkouts/gecko/dom/base/Document.cpp:19131:5
    #12 0x78c91763faff in mozilla::dom::Document::DeletePresShell() /builds/worker/checkouts/gecko/dom/base/Document.cpp:7664:3
    #13 0x78c91ec6889c in mozilla::PresShell::Destroy() /builds/worker/checkouts/gecko/layout/base/PresShell.cpp:1214:16
    #14 0x78c91ed55aaf in nsDocumentViewer::DestroyPresShell() /builds/worker/checkouts/gecko/layout/base/nsDocumentViewer.cpp:3279:15
    #15 0x78c91ed4ca00 in nsDocumentViewer::Destroy() /builds/worker/checkouts/gecko/layout/base/nsDocumentViewer.cpp:1639:5
    #16 0x78c91f5fe469 in DestroyDocumentViewer /builds/worker/checkouts/gecko/docshell/base/nsDocShell.cpp:403:20
    #17 0x78c91f5fe469 in nsDocShell::Destroy() /builds/worker/checkouts/gecko/docshell/base/nsDocShell.cpp:4659:3
    #18 0x78c91fe40b22 in nsWebBrowser::SetDocShell(nsDocShell*) /builds/worker/checkouts/gecko/toolkit/components/browser/nsWebBrowser.cpp:1043:18
    #19 0x78c91fe46354 in InternalDestroy /builds/worker/checkouts/gecko/toolkit/components/browser/nsWebBrowser.cpp:154:3
    #20 0x78c91fe46354 in Destroy /builds/worker/checkouts/gecko/toolkit/components/browser/nsWebBrowser.cpp:850:3
    #21 0x78c91fe46354 in non-virtual thunk to nsWebBrowser::Destroy() /builds/worker/checkouts/gecko/toolkit/components/browser/nsWebBrowser.cpp:0:0
    #22 0x78c91d49b651 in mozilla::dom::BrowserChild::DestroyWindow() /builds/worker/checkouts/gecko/dom/ipc/BrowserChild.cpp:774:31
    #23 0x78c91d4bccf0 in mozilla::dom::BrowserChild::RecvDestroy() /builds/worker/checkouts/gecko/dom/ipc/BrowserChild.cpp:3012:3
    #24 0x78c91d689fe8 in mozilla::dom::PBrowserChild::OnMessageReceived(IPC::Message const&) /builds/worker/workspace/obj-build/ipc/ipdl/PBrowserChild.cpp:7286:80
    #25 0x78c91d766c0e in mozilla::dom::PContentChild::OnMessageReceived(IPC::Message const&) /builds/worker/workspace/obj-build/ipc/ipdl/PContentChild.cpp:8340:32
    #26 0x78c914b35815 in mozilla::ipc::MessageChannel::DispatchAsyncMessage(mozilla::ipc::ActorLifecycleProxy*, IPC::Message const&) /builds/worker/checkouts/gecko/ipc/glue/MessageChannel.cpp:1801:25
    #27 0x78c914b31d09 in mozilla::ipc::MessageChannel::DispatchMessage(mozilla::ipc::ActorLifecycleProxy*, std::unique_ptr<IPC::Message, std::default_delete<IPC::Message>>) /builds/worker/checkouts/gecko/ipc/glue/MessageChannel.cpp:1727:9
    #28 0x78c914b32b27 in mozilla::ipc::MessageChannel::RunMessage(mozilla::ipc::ActorLifecycleProxy*, mozilla::ipc::MessageChannel::MessageTask&) /builds/worker/checkouts/gecko/ipc/glue/MessageChannel.cpp:1516:3
    #29 0x78c914b34043 in mozilla::ipc::MessageChannel::MessageTask::Run() /builds/worker/checkouts/gecko/ipc/glue/MessageChannel.cpp:1618:14
    #30 0x78c9133c076a in mozilla::RunnableTask::Run() /builds/worker/checkouts/gecko/xpcom/threads/TaskController.cpp:721:16
    #31 0x78c9133afbab in mozilla::TaskController::RunTask(mozilla::Task*) /builds/worker/checkouts/gecko/xpcom/threads/TaskController.cpp:212:19
    #32 0x78c9133b6ead in mozilla::TaskController::DoExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) /builds/worker/checkouts/gecko/xpcom/threads/TaskController.cpp:1342:20
    #33 0x78c9133b4988 in mozilla::TaskController::ExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) /builds/worker/checkouts/gecko/xpcom/threads/TaskController.cpp:1165:15
    #34 0x78c9133b4fa6 in mozilla::TaskController::ProcessPendingMTTask(bool) /builds/worker/checkouts/gecko/xpcom/threads/TaskController.cpp:657:36
    #35 0x78c9133d5d44 in operator() /builds/worker/checkouts/gecko/xpcom/threads/TaskController.cpp:352:37
    #36 0x78c9133d5d44 in mozilla::detail::RunnableFunction<mozilla::TaskController::TaskController()::$_1>::Run() /builds/worker/checkouts/gecko/xpcom/threads/nsThreadUtils.h:549:5
    #37 0x78c9133f6e5a in nsThread::ProcessNextEvent(bool, bool*) /builds/worker/checkouts/gecko/xpcom/threads/nsThread.cpp:1169:16
    #38 0x78c913400059 in NS_ProcessNextEvent(nsIThread*, bool) /builds/worker/checkouts/gecko/xpcom/threads/nsThreadUtils.cpp:467:10
    #39 0x78c91df5e1e7 in SpinEventLoopUntil<(mozilla::ProcessFailureBehavior)1, (lambda at /builds/worker/checkouts/gecko/dom/xhr/XMLHttpRequestMainThread.cpp:3262:74)> /builds/worker/workspace/obj-build/dist/include/mozilla/SpinEventLoopUntil.h:176:25
    #40 0x78c91df5e1e7 in mozilla::dom::XMLHttpRequestMainThread::SendInternal(mozilla::dom::BodyExtractorBase const*, bool, mozilla::ErrorResult&) /builds/worker/checkouts/gecko/dom/xhr/XMLHttpRequestMainThread.cpp:3262:10
    #41 0x78c91df5c4b2 in mozilla::dom::XMLHttpRequestMainThread::Send(mozilla::dom::Nullable<mozilla::dom::DocumentOrBlobOrArrayBufferViewOrArrayBufferOrFormDataOrURLSearchParamsOrUSVString> const&, mozilla::ErrorResult&) /builds/worker/checkouts/gecko/dom/xhr/XMLHttpRequestMainThread.cpp:2998:5
    #42 0x78c918f2feb9 in mozilla::dom::XMLHttpRequest_Binding::send(JSContext*, JS::Handle<JSObject*>, void*, JSJitMethodCallArgs const&) /builds/worker/workspace/obj-build/dom/bindings/./XMLHttpRequestBinding.cpp:1663:24
    #43 0x78c9195e7d7d in bool mozilla::dom::binding_detail::GenericMethod<mozilla::dom::binding_detail::NormalThisPolicy, mozilla::dom::binding_detail::ThrowExceptions>(JSContext*, unsigned int, JS::Value*) /builds/worker/checkouts/gecko/dom/bindings/BindingUtils.cpp:3310:13
    #44 0x78c9221f191d in CallJSNative /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:490:13
    #45 0x78c9221f191d in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /builds/worker/checkouts/gecko/js/src/vm/Interpreter.cpp:586:12
    #46 0x78c921432e70 in js::jit::DoCallFallback(JSContext*, js::jit::BaselineFrame*, js::jit::ICFallbackStub*, unsigned int, JS::Value*, JS::MutableHandle<JS::Value>) /builds/worker/checkouts/gecko/js/src/jit/BaselineIC.cpp:1698:10
    #47 0x2839e3452953  ([anon:js-executable-memory]+0x2953)

When calling HTMLSlotElement.assign(), we might end up removing the
manual assignment from an earlier slot.

That was unconditionally calling RemoveAssignedSlot tho, even if we
weren't in a manually-assigned shadow tree, causing the flat tree to end
up in an inconsistent state.

Assignee: nobody → emilio
Status: NEW → ASSIGNED

Verified bug as reproducible on mozilla-central 20260219215206-64b3c91301e8.
The bug appears to have been introduced in the following build range:

Start: dc8b5887c8720bba979d6e8b19349ed95daca2c8 (20260203125751)
End: 6204449ef95542f67bdc2ad633c9ca14b9d150b4 (20260203143642)
Pushlog: https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=dc8b5887c8720bba979d6e8b19349ed95daca2c8&tochange=6204449ef95542f67bdc2ad633c9ca14b9d150b4

Keywords: regression
Whiteboard: [bugmon:bisected,confirmed]
Crash Signature: [@ mozilla::dom::Document::GetServoRestyleRoot ]
Keywords: regression
See Also: → 1951433
Whiteboard: [bugmon:bisected,confirmed]

I assume these were removed by accident

Keywords: regression
Whiteboard: [bugmon:bisected,confirmed]
Severity: -- → S3
Pushed by ealvarez@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/5a4023b87bbe https://hg.mozilla.org/integration/autoland/rev/32c51c7ae9a5 Don't try to unassign from the wrong slot when using manual assignment. r=dom-core,farre
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/57919 for changes under testing/web-platform/tests
Whiteboard: [bugmon:bisected,confirmed] → [bugmon:bisected,confirmed], [wptsync upstream]

This test case in particular got regressed by bug 2011709 but it repros earlier if you swap the select and options with a regular shadow host.

Regressed by: 2011709
Regressed by: 1705141
See Also: → CVE-2026-6746
Status: ASSIGNED → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → 149 Branch
Upstream PR merged by moz-wptsync-bot

Verified bug as fixed on rev mozilla-central 20260220162739-d46c04335970.
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
Duplicate of this bug: 2017509
Keywords: ai-involved
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: