Closed Bug 2043213 Opened 6 months ago Closed 6 months ago

Crash in [@ mozilla::dom::indexedDB::KeyPath::ExtractKey]

Categories

(Core :: Storage: IndexedDB, defect)

Unspecified
Windows 11
defect

Tracking

()

RESOLVED FIXED
153 Branch
Tracking Status
firefox-esr115 152+ fixed
firefox-esr140 152+ fixed
firefox151 --- wontfix
firefox152 + fixed
firefox153 + fixed

People

(Reporter: mccr8, Assigned: jari)

References

Details

(4 keywords, Whiteboard: [adv-main152+r][adv-esr115.37+r][adv-esr140.12+r])

Crash Data

Attachments

(4 external files)

Crash report: https://crash-stats.mozilla.org/report/index/d5f57c1f-d0ea-4d72-854e-3fd0d0260525

This crash signature has shown up recently on Nightly, first in the 20260523100109 build (though the volume is low enough we can't be sure that's anything was introduced there). About half of these crashes are on poison values, indicating a use-after-free, but around half of the use-after-free crashes are on family 6 model 183 stepping 1 CPUs so maybe the poison crash part is just hardware failures?

I'm not sure how actionable this is. The ones I looked at all had DeserializeIndexValueHelper::Run() in the stack. The thing to check would be if something in here is following a weak pointer.

Reason:

EXCEPTION_ACCESS_VIOLATION_READ

Top 10 frames:

0  xul.dll  nsTArray_base<nsTArray_RelocateUsingMemutils>::Length() const  xpcom/ds/nsTArray.h:365
0  xul.dll  mozilla::dom::indexedDB::KeyPath::ExtractKey(JSContext*, JS::Value const&, mo...  dom/indexedDB/KeyPath.cpp:332
1  xul.dll  mozilla::dom::IDBObjectStore::AppendIndexUpdateInfo(long long, mozilla::dom::...  dom/indexedDB/IDBObjectStore.cpp:623
2  xul.dll  mozilla::dom::indexedDB::(anonymous namespace)::DeserializeIndexValueHelper::...  dom/indexedDB/ActorsParent.cpp:6646
3  xul.dll  mozilla::RunnableTask::Run()  xpcom/threads/TaskController.cpp:719
3  xul.dll  mozilla::TaskController::RunTask(mozilla::Task*)  xpcom/threads/TaskController.cpp:210
3  xul.dll  mozilla::TaskController::DoExecuteNextTaskOnlyMainThreadInternal(mozilla::det...  xpcom/threads/TaskController.cpp:1358
4  xul.dll  mozilla::TaskController::ExecuteNextTaskOnlyMainThreadInternal(mozilla::detai...  xpcom/threads/TaskController.cpp:1181
4  xul.dll  mozilla::TaskController::ProcessPendingMTTask(bool)  xpcom/threads/TaskController.cpp:655
4  xul.dll  mozilla::TaskController::TaskController::<lambda_5>::operator()() const  xpcom/threads/TaskController.cpp:347

It could be some bogus bad CPU thing like I said, but I'll mark it as a regression for now.

There's a handful of Raptor Lakes in there, but there are also other CPUs so this look like a legit crash.

The earliest affected build is buildid 20260527085321 but there doesn't seem to be changes to IndexedDB around that date.

The cause might be the spurious wake ups of condition variables at https://searchfox.org/firefox-main/rev/e28b34ab33dbf49364999070168cbb7e11e8e5bd/xpcom/threads/Monitor.h#35 which is used to wait that the deserialization of the index values on the main thread is done at https://searchfox.org/firefox-main/rev/e28b34ab33dbf49364999070168cbb7e11e8e5bd/dom/indexedDB/ActorsParent.cpp#6708 before returning to connection thread. So when the condVar spuriously wakes up, the code running in the condition thread assumes we're done, the CreateIndexOp and its members go out of scope, releasing keyPath while the main thread is still busy with the deserialization.

Attached file (secure) —
Assignee: nobody → jjalkanen
Status: NEW → ASSIGNED
Blocks: 2041909

[Tracking Requested - why for this release]: sec-high regression. Also showing up in Nightly and tree herder (see bug 2041909).

Comment on attachment 9591406 [details]
(secure)

Security Approval Request

  • How easily could an exploit be constructed based on the patch?: Trying enough times it will create a UAF, especially on particular hardware.
  • Do comments in the patch, the check-in comment, or tests included in the patch paint a bulls-eye on the security problem?: No
  • Which branches (beta, release, and/or ESR) are affected by this flaw, and do the release status flags reflect this affected/unaffected state correctly?: all
  • If not all supported branches, which bug introduced the flaw?: None
  • Do you have backports for the affected branches?: No
  • If not, how different, hard to create, and risky will they be?: It will be easy and low risk
  • How likely is this patch to cause regressions; how much testing does it need?: The issue is handled via a common idiom, it's not likely to lead to further issues
  • Is the patch ready to land after security approval is given?: Yes
  • Is Android affected?: Yes
Attachment #9591406 - Flags: sec-approval?

From some discussion in Slack, it sounds like this is a pre-existing issue and we recently started seeing it much more often due to bug 2015967 affecting timing.

Flags: needinfo?(tom)
Flags: needinfo?(dveditz)
Flags: needinfo?(tom)
Attachment #9591406 - Flags: sec-approval? → sec-approval+
Flags: needinfo?(dveditz)
Group: dom-core-security → core-security-release
Status: ASSIGNED → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → 153 Branch

The patch landed in nightly and beta is affected.
:jari, is this bug important enough to require an uplift?

For more information, please visit BugBot documentation.

Flags: needinfo?(jjalkanen)

Along with Beta, we'll need ESR140 and ESR115 nominations also.

Whiteboard: [adv-esr115.37+r]
Whiteboard: [adv-esr115.37+r]

firefox-beta Uplift Approval Request

  • User impact if declined/Reason for urgency: Security issue
  • Code covered by automated testing?: yes
  • Fix verified in Nightly?: yes
  • Needs manual QE testing?: no
  • Steps to reproduce for manual QE testing: Not easy to test manually
  • Risk associated with taking this patch: low
  • Explanation of risk level: Small change using a standard idiom
  • String changes made/needed?: -
  • Is Android affected?: yes
Attachment #9593124 - Flags: approval-mozilla-beta?
Attached file (secure) —

firefox-esr115 Uplift Approval Request

  • User impact if declined/Reason for urgency: Security issue
  • Code covered by automated testing?: yes
  • Fix verified in Nightly?: yes
  • Needs manual QE testing?: no
  • Steps to reproduce for manual QE testing: Not easy to test manually
  • Risk associated with taking this patch: low
  • Explanation of risk level: Small change using a standard idiom
  • String changes made/needed?: -
  • Is Android affected?: yes
Attachment #9593125 - Flags: approval-mozilla-esr115?
Attached file (secure) —

firefox-esr140 Uplift Approval Request

  • User impact if declined/Reason for urgency: Security issue
  • Code covered by automated testing?: yes
  • Fix verified in Nightly?: yes
  • Needs manual QE testing?: no
  • Steps to reproduce for manual QE testing: Not easy to test manually
  • Risk associated with taking this patch: low
  • Explanation of risk level: Small change using a standard idiom
  • String changes made/needed?: -
  • Is Android affected?: yes
Attachment #9593129 - Flags: approval-mozilla-esr140?
Attached file (secure) —
Attachment #9593124 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Attachment #9593129 - Flags: approval-mozilla-esr140? → approval-mozilla-esr140+
Attachment #9593125 - Flags: approval-mozilla-esr115? → approval-mozilla-esr115+
Flags: needinfo?(jjalkanen)
QA Whiteboard: [sec] [uplift] [qa-triage-done-c153/b152]
Whiteboard: [adv-main152+r]
Whiteboard: [adv-main152+r] → [adv-main152+r][adv-esr115.37+r]
Whiteboard: [adv-main152+r][adv-esr115.37+r] → [adv-main152+r][adv-esr115.37+r][adv-esr140.12+]
Whiteboard: [adv-main152+r][adv-esr115.37+r][adv-esr140.12+] → [adv-main152+r][adv-esr115.37+r][adv-esr140.12+r]
Group: core-security-release
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: