Closed Bug 1791152 Opened 4 years ago Closed 3 years ago

Crash in [@ mozilla::a11y::Accessible::IsLocal]

Categories

(Core :: Disability Access APIs, defect)

Unspecified
Android
defect

Tracking

()

RESOLVED FIXED
108 Branch
Tracking Status
firefox-esr102 --- unaffected
firefox106 --- wontfix
firefox107 + fixed
firefox108 + fixed

People

(Reporter: gsvelto, Assigned: eeejay)

References

(Regression)

Details

(5 keywords, Whiteboard: [post-critsmash-triage][adv-main107+r])

Crash Data

Attachments

(2 obsolete files)

Crash report: https://crash-stats.mozilla.org/report/index/08e245ee-3c68-49bb-a309-0c1a60220915

Reason: SIGSEGV / SEGV_MAPERR

Top 10 frames of crashing thread:

0 libxul.so mozilla::a11y::AccessibleWrap::SetVirtualViewID accessible/android/AccessibleWrap.cpp:574
1 libxul.so mozilla::a11y::SessionAccessibility::UnregisterAll accessible/android/SessionAccessibility.cpp:1100
2 libxul.so mozilla::a11y::DocAccessibleWrap::Shutdown accessible/android/DocAccessibleWrap.cpp:57
3 libxul.so mozilla::a11y::DocManager::HandleEvent accessible/base/DocManager.cpp:361
4 libxul.so {virtual override thunk} accessible/base/DocManager.cpp
5 libxul.so mozilla::EventListenerManager::HandleEventSubType dom/events/EventListenerManager.cpp:1316
6 libxul.so mozilla::EventListenerManager::HandleEventInternal dom/events/EventListenerManager.cpp:1506
7 libxul.so mozilla::EventTargetChainItem::HandleEventTargetChain dom/events/EventDispatcher.cpp:480
8 libxul.so mozilla::EventDispatcher::Dispatch dom/events/EventDispatcher.cpp:1119
9 libxul.so mozilla::dom::Document::DispatchPageTransition dom/base/Document.cpp:11530

This is a use-after-free access via the aAccessible pointer here.

Flags: needinfo?(eitan)
Group: core-security → dom-core-security
Group: dom-core-security → layout-core-security

The bug is linked to a topcrash signature, which matches the following criterion:

  • Top 10 AArch64 and ARM crashes on nightly

For more information, please visit auto_nag documentation.

Keywords: topcrash

This looks like a fission crash. Once bug 1789474 lands I am curious to see if this persists since there were some doc accessible lifecycle issues that were discovered with Fission.

Flags: needinfo?(eitan)
Assignee: nobody → eitan

Bug 1793126 is almost certainly a duplicate.

Hi Eitan, It looks like the crash is still present (looking at the most recent crash-stats).

Flags: needinfo?(eitan)

Yeah I first thought this was fission only which is not the case. Trying to reproduce and come up with something.

Flags: needinfo?(eitan)

While I wasn't able to reproduce anything locally, it does look like we occasionally get into a state where the parent's PresShell is gone before a RemoteAccessible is shut down. This intermittent failure is evidence of that.

That MOZ_ASSERT should arguably be changed to a diagnostic assert since it means we failed to remove a raw pointer reference from SessionAccessibility's table, and we can potentially have a UAF.

My proposed fix is to stop relying on a top-level PresShell for retrieving any given accessible's SessionAccessibility instance, but instead to rely on the parent's document to hold a strong reference to SessionAccessibility. This should help eliminate any shutdown bugs where the PresShell disappears before an accessible or its doc.

I have a higher degree of confidence that an outer doc will be available because there is a debug assert for that as well, and that hasn't been tripped.

For the record, this is the "regressing" bug in that it enables caching in beta/release: https://bugzilla.mozilla.org/show_bug.cgi?id=1786584

Regressed by: 1786584

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

That doesn't seem right: bug 1786584 landed in 106, but this signature goes back to 104. The signature change was because Socorro learned how to handle inlined functions.

Ah.. the regression is for when it started crashing in release. It was enabled in nightly in bug 1758540, but that was 102.. so I am not sure why it started failing in 104. There is probably some other regressing bug somewhere in the middle.

I failed to reach the root of the matter and figure out in what circumstances a remote doc shuts down after a root presshell. But it definitely happens. Since this is a shut down crash, I think we should just drop the id/accessible table without trying to recover the used IDs and reset the IDs on the accessibles themselves.

This is just a mitigation of this crash. The next steps after this bug are:

  1. Remedy bug 1778916 by trial and error (probably by holding a weak reference to SessionAccessibility in DocAccessibleParent).
  2. Once that intermittent is gone, change the debug assertion to a diagnostic assertion here

Comment on attachment 9301216 [details]
Bug 1791152 - Drop entire accessible ID map in UnregisterAll. r?Jamie

Security Approval Request

  • How easily could an exploit be constructed based on the patch?: This UAF is hard to reproduce.
  • 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 older supported branches are affected by this flaw?: release,beta
  • If not all supported branches, which bug introduced the flaw?: Bug 1771934
  • Do you have backports for the affected branches?: No
  • If not, how different, hard to create, and risky will they be?: Very easy
  • How likely is this patch to cause regressions; how much testing does it need?:
  • Is Android affected?: Yes
Attachment #9301216 - Flags: sec-approval?

Comment on attachment 9301216 [details]
Bug 1791152 - Drop entire accessible ID map in UnregisterAll. r?Jamie

Approved to land and request uplift

Attachment #9301216 - Flags: sec-approval? → sec-approval+
Group: layout-core-security → core-security-release
Status: NEW → RESOLVED
Closed: 3 years ago
Flags: needinfo?(eitan)
Resolution: --- → FIXED
Target Milestone: --- → 108 Branch

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

  • If yes, please nominate the patch for beta approval.
  • If no, please set status-firefox107 to wontfix.

For more information, please visit auto_nag documentation.

Flags: needinfo?(eitan)

Curiously this crash doesn't appear in beta, but it does in release. I think this is because this is such a rare crash with fission off that the small beta audience isn't big enough. But it is strange that it is completely absent. Nonetheless, I recommend we uplift it to beta so it will be merged into release later.

Flags: needinfo?(eitan)

Comment on attachment 9301216 [details]
Bug 1791152 - Drop entire accessible ID map in UnregisterAll. r?Jamie

Beta/Release Uplift Approval Request

  • User impact if declined: Rare crash
  • Is this code covered by automated tests?: No
  • Has the fix been verified in Nightly?: Yes
  • 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): This patch removes non-essential code at shutdown.
  • String changes made/needed:
  • Is Android affected?: Yes
Attachment #9301216 - Flags: approval-mozilla-beta?

Comment on attachment 9301216 [details]
Bug 1791152 - Drop entire accessible ID map in UnregisterAll. r?Jamie

Approved for 107.0RC1

Attachment #9301216 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

Comment on attachment 9302367 [details]
Bug 1791152 - Drop entire accessible ID map in UnregisterAll.

Beta/Release Uplift Approval Request

  • User impact if declined: Potential shutdown crash
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: Yes
  • 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): This is a simplified shutdown routine
  • String changes made/needed:
  • Is Android affected?: Yes
Flags: needinfo?(eitan)
Attachment #9302367 - Flags: approval-mozilla-beta?

Got a 401 error from bugzilla when trying to fill out the uplift form in phabricator.

Comment on attachment 9302367 [details]
Bug 1791152 - Drop entire accessible ID map in UnregisterAll.

Switching beta uplift request to release, 107 is now in RC.
Keeping on the radar for potential uplift later for a ride-along.

Attachment #9302367 - Flags: approval-mozilla-beta? → approval-mozilla-release?

(In reply to Eitan Isaacson [:eeejay] from comment #25)

Got a 401 error from bugzilla when trying to fill out the uplift form in phabricator.

The Phabricator uplift request flow is still in development.
We are still using the Bugzilla flow until the Phabricator uplift flow is ready.

Flags: qe-verify-
Whiteboard: [post-critsmash-triage]
Duplicate of this bug: 1793126

Comment on attachment 9302367 [details]
Bug 1791152 - Drop entire accessible ID map in UnregisterAll.

Approved for 107.0RC2

Attachment #9302367 - Flags: approval-mozilla-release? → approval-mozilla-release+
Whiteboard: [post-critsmash-triage] → [post-critsmash-triage][adv-main107+r]
Attachment #9301216 - Attachment is obsolete: true
Attachment #9302367 - Attachment is obsolete: true
See Also: → 1819160
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: