Closed Bug 1561404 Opened 5 years ago Closed 5 years ago

AddressSanitizer: attempting to call malloc_usable_size() for pointer which is not owned: 0x60c00854c800 [@ __interceptor_malloc_usable_size] through [@ mozilla::MediaCacheStream::SizeOfExcludingThis]

Categories

(Core :: Audio/Video, defect, P1)

x86_64
Linux
defect

Tracking

()

RESOLVED FIXED
mozilla70
Tracking Status
firefox-esr60 --- unaffected
firefox-esr68 69+ fixed
firefox68 --- wontfix
firefox69 --- fixed
firefox70 + fixed

People

(Reporter: decoder, Assigned: tarek)

References

(Blocks 1 open bug, Regression)

Details

(4 keywords, Whiteboard: [post-critsmash-triage][adv-main69+][adv-esr68.1+])

Attachments

(2 files)

The attached crash information was submitted via the ASan Nightly Reporter on mozilla-central-asan-nightly revision 69.0a1-20190618041042-https://hg.mozilla.org/mozilla-central/rev/9b4c8fb46d850db196b0ed6aad0a35b85b178745.

For detailed crash information, see attachment.

Flags: sec-bounty?
Group: core-security → media-core-security
Keywords: sec-high

Jean-Yves can you please have a look at this or redirect to someone else if you are too swamped right now?

Assignee: nobody → jyavenard
Flags: needinfo?(jyavenard)
Priority: -- → P1

It seems that the MediaCacheStream member are accessed for memory accounting in a non-threadsafe fashion

MediaCache methods requires a "proof of lock" since bug 1420798. The threading model was rather simple previously, all was happening on the main thread. However following project quantum this is now mostly done in a dedicated thread.

The MediaCache access the MediaCacheStream::BlockList on MediaCache::sThread and with a lock.

However, when attempting to report the memory use, it's all done without.

Here we need to make MediaCache::SizeOfExcludingThis only ever called on the MediaCache::sThread.

This code is already called from an asynchronous method. Needs to extend on that so that we don't attempt to read MediaCache elements outside its thread. Most of the infrastucture is already in place.

This bug is a regression due to bug 1497124

Flags: needinfo?(jyavenard)
Regressed by: 1497124
Assignee: jyavenard → tarek

Hello, can I have access to bug 1479399 please?

Flags: needinfo?(dveditz)

A bit silly if you can be assigned a bug, yet still require to be CCed on it

Flags: needinfo?(dveditz)

Adds a lock in MediaCacheStream::SizeOfExcludingThis to prevent a race
condition with MediaCache::NoteSeek

Attachment #9075900 - Attachment description: Bug 1561404 - Fix race condition in mozilla::MediaCacheStream::SizeOfExcludingThis r?jya → Bug 1561404 - Ensure thread safety

I guess I can't land myself?

Christian I guess I'll let you take it from here

Flags: needinfo?(choller)

Comment on attachment 9075900 [details]
Bug 1561404 - Ensure thread safety

Security Approval Request

  • How easily could an exploit be constructed based on the patch?: I don't know
  • 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?:
  • If not all supported branches, which bug introduced the flaw?: Bug 1497124
  • Do you have backports for the affected branches?: No
  • If not, how different, hard to create, and risky will they be?:
  • How likely is this patch to cause regressions; how much testing does it need?: The crash should go away with this patch and we should not be affected by a new regression. ChromeUtils::requestPerformanceMetrics() (via about:performance) is the only place where this race condition might occur.
Attachment #9075900 - Flags: sec-approval?

Marking affected flags as Firefox 65 and higher based on this being broken by Bug 1497124.

Sec-approval+ for trunk. We'll want this on Beta as well.

Attachment #9075900 - Flags: sec-approval? → sec-approval+

Marking for sheriffs to land.

Flags: needinfo?(choller)
Keywords: checkin-needed
Group: media-core-security → core-security-release
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla70
Flags: sec-bounty? → sec-bounty+

Please request beta and esr68 approval when you get a chance.

Flags: needinfo?(tarek)

Comment on attachment 9075900 [details]
Bug 1561404 - Ensure thread safety

Beta/Release Uplift Approval Request

  • User impact if declined:
  • 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): ony called via about:performance and this potential race condition was only detected by asan
  • String changes made/needed:

ESR Uplift Approval Request

  • If this is not a sec:{high,crit} bug, please state case for ESR consideration:
  • User impact if declined:
  • Fix Landed on Version:
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): ony called via about:performance and this potential race condition was only detected by asan
  • String or UUID changes made by this patch:
Flags: needinfo?(tarek)
Attachment #9075900 - Flags: approval-mozilla-esr68?
Attachment #9075900 - Flags: approval-mozilla-beta?

Comment on attachment 9075900 [details]
Bug 1561404 - Ensure thread safety

Fixes a sec issue in about:performance. Approved for 69.0b6 and 68.1esr.

Attachment #9075900 - Flags: approval-mozilla-esr68?
Attachment #9075900 - Flags: approval-mozilla-esr68+
Attachment #9075900 - Flags: approval-mozilla-beta?
Attachment #9075900 - Flags: approval-mozilla-beta+
Flags: qe-verify-
Whiteboard: [post-critsmash-triage]
Whiteboard: [post-critsmash-triage] → [post-critsmash-triage][adv-main69+][adv-esr68.1+]
Group: core-security-release
Has Regression Range: --- → yes
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: