Closed Bug 1791023 Opened 5 months ago Closed 4 months ago

Hit MOZ_CRASH(gfxFontFaceBufferSource not thread-safe) at /xpcom/base/nsISupportsImpl.cpp:43

Categories

(Core :: Graphics, defect, P2)

x86_64
Linux
defect

Tracking

()

VERIFIED FIXED
107 Branch
Tracking Status
firefox-esr102 --- unaffected
firefox105 --- wontfix
firefox106 --- fixed
firefox107 --- verified

People

(Reporter: jkratzer, Assigned: jfkthame)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression, testcase, Whiteboard: [bugmon:bisected,confirmed][fuzzblocker])

Attachments

(2 files)

Testcase found while fuzzing mozilla-central rev ae27c51dc6ca (built with: --enable-debug --enable-fuzzing).

This bug appears to be a recent regression and is triggering quite frequently. Marking as a fuzzblocker.

Testcase can be reproduced using the following commands:

$ pip install fuzzfetch grizzly-framework
$ python -m fuzzfetch --build ae27c51dc6ca --debug --fuzzing -n firefox
$ python -m grizzly.replay ./firefox/firefox testcase.zip
Hit MOZ_CRASH(gfxFontFaceBufferSource not thread-safe) at /xpcom/base/nsISupportsImpl.cpp:43

    ==950546==ERROR: UndefinedBehaviorSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f9c2de60faa bp 0x7ffdd0a8fa90 sp 0x7ffdd0a8fa80 T950546)
    ==950546==The signal is caused by a WRITE memory access.
    ==950546==Hint: address points to the zero page.
        #0 0x7f9c2de60faa in MOZ_Crash /builds/worker/workspace/obj-build/dist/include/mozilla/Assertions.h:261:3
        #1 0x7f9c2de60faa in nsAutoOwningThread::AssertCurrentThreadOwnsMe(char const*) const /xpcom/base/nsISupportsImpl.cpp:43:5
        #2 0x7f9c2f4e22b3 in AssertOwnership<40> /builds/worker/workspace/obj-build/dist/include/nsISupportsImpl.h:60:5
        #3 0x7f9c2f4e22b3 in AddRef /gfx/thebes/gfxUserFontSet.h:62:3
        #4 0x7f9c2f4e22b3 in AddRef /builds/worker/workspace/obj-build/dist/include/mozilla/RefPtr.h:49:39
        #5 0x7f9c2f4e22b3 in AddRef /builds/worker/workspace/obj-build/dist/include/mozilla/RefPtr.h:380:35
        #6 0x7f9c2f4e22b3 in RefPtr /builds/worker/workspace/obj-build/dist/include/mozilla/RefPtr.h:97:7
        #7 0x7f9c2f4e22b3 in gfxFontFaceSrc::gfxFontFaceSrc(gfxFontFaceSrc const&) /gfx/thebes/gfxUserFontSet.h:72:8
        #8 0x7f9c2f4e205e in Construct<const gfxFontFaceSrc &> /builds/worker/workspace/obj-build/dist/include/nsTArray.h:628:34
        #9 0x7f9c2f4e205e in implementation<gfxFontFaceSrc, gfxFontFaceSrc, unsigned long, unsigned long> /builds/worker/workspace/obj-build/dist/include/nsTArray.h:661:7
        #10 0x7f9c2f4e205e in AssignRange<gfxFontFaceSrc> /builds/worker/workspace/obj-build/dist/include/nsTArray.h:2418:5
        #11 0x7f9c2f4e205e in nsTArrayInfallibleAllocator::ResultType nsTArray_Impl<gfxFontFaceSrc, nsTArrayInfallibleAllocator>::AssignInternal<nsTArrayInfallibleAllocator, gfxFontFaceSrc>(gfxFontFaceSrc const*, unsigned long) /builds/worker/workspace/obj-build/dist/include/nsTArray.h:2449:5
        #12 0x7f9c2f4bf739 in Assign<nsTArrayInfallibleAllocator, nsTArrayInfallibleAllocator> /builds/worker/workspace/obj-build/dist/include/nsTArray.h:1452:12
        #13 0x7f9c2f4bf739 in Clone /builds/worker/workspace/obj-build/dist/include/nsTArray.h:2828:12
        #14 0x7f9c2f4bf739 in gfxUserFontEntry::gfxUserFontEntry(gfxUserFontSet*, nsTArray<gfxFontFaceSrc> const&, mozilla::WeightRange, mozilla::StretchRange, mozilla::SlantStyleRange, nsTArray<gfxFontFeature> const&, nsTArray<mozilla::gfx::FontVariation> const&, unsigned int, gfxCharacterMap*, mozilla::StyleFontDisplay, gfxFontEntry::RangeFlags, float, float, float, float) /gfx/thebes/gfxUserFontSet.cpp:58:31
        #15 0x7f9c331aba2f in Entry /builds/worker/workspace/obj-build/dist/include/mozilla/dom/FontFaceImpl.h:57:11
        #16 0x7f9c331aba2f in CreateUserFontEntry /layout/style/FontFaceSetImpl.cpp:982:40
        #17 0x7f9c331aba2f in non-virtual thunk to mozilla::dom::FontFaceSetImpl::CreateUserFontEntry(nsTArray<gfxFontFaceSrc> const&, mozilla::WeightRange, mozilla::StretchRange, mozilla::SlantStyleRange, nsTArray<gfxFontFeature> const&, nsTArray<mozilla::gfx::FontVariation> const&, unsigned int, gfxCharacterMap*, mozilla::StyleFontDisplay, gfxFontEntry::RangeFlags, float, float, float, float) /layout/style/FontFaceSetImpl.cpp
        #18 0x7f9c2f4c5846 in gfxUserFontSet::FindOrCreateUserFontEntry(nsTSubstring<char> const&, nsTArray<gfxFontFaceSrc> const&, mozilla::WeightRange, mozilla::StretchRange, mozilla::SlantStyleRange, nsTArray<gfxFontFeature> const&, nsTArray<mozilla::gfx::FontVariation> const&, unsigned int, gfxCharacterMap*, mozilla::StyleFontDisplay, gfxFontEntry::RangeFlags, float, float, float, float) /gfx/thebes/gfxUserFontSet.cpp:977:13
        #19 0x7f9c331a86ad in mozilla::dom::FontFaceSetImpl::FindOrCreateUserFontEntryFromFontFace(nsTSubstring<char> const&, mozilla::dom::FontFaceImpl*, mozilla::StyleOrigin) /layout/style/FontFaceSetImpl.cpp:633:41
        #20 0x7f9c3319e630 in FindOrCreateUserFontEntryFromFontFace /layout/style/FontFaceSetImpl.cpp:345:10
        #21 0x7f9c3319e630 in mozilla::dom::FontFaceImpl::CreateUserFontEntry() /layout/style/FontFaceImpl.cpp:326:9
        #22 0x7f9c3319e07b in mozilla::dom::FontFaceImpl::DoLoad() /layout/style/FontFaceImpl.cpp:342:8
        #23 0x7f9c331ae481 in operator() /layout/style/FontFaceImpl.cpp:338:65
        #24 0x7f9c331ae481 in mozilla::detail::RunnableFunction<mozilla::dom::FontFaceImpl::DoLoad()::$_9>::Run() /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:531:5
        #25 0x7f9c2df5594e in mozilla::RunnableTask::Run() /xpcom/threads/TaskController.cpp:538:16
        #26 0x7f9c2df2de69 in mozilla::TaskController::DoExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) /xpcom/threads/TaskController.cpp:851:26
        #27 0x7f9c2df2c9f3 in mozilla::TaskController::ExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) /xpcom/threads/TaskController.cpp:683:15
        #28 0x7f9c2df2cc63 in mozilla::TaskController::ProcessPendingMTTask(bool) /xpcom/threads/TaskController.cpp:461:36
        #29 0x7f9c2df59269 in operator() /xpcom/threads/TaskController.cpp:190:37
        #30 0x7f9c2df59269 in mozilla::detail::RunnableFunction<mozilla::TaskController::InitializeInternal()::$_1>::Run() /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:531:5
        #31 0x7f9c2df42abf in nsThread::ProcessNextEvent(bool, bool*) /xpcom/threads/nsThread.cpp:1205:16
        #32 0x7f9c2df490cd in NS_ProcessNextEvent(nsIThread*, bool) /xpcom/threads/nsThreadUtils.cpp:465:10
        #33 0x7f9c2eb29604 in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /ipc/glue/MessagePump.cpp:107:5
        #34 0x7f9c2ea4ecb7 in MessageLoop::RunInternal() /ipc/chromium/src/base/message_loop.cc:381:10
        #35 0x7f9c2ea4ebc2 in RunHandler /ipc/chromium/src/base/message_loop.cc:374:3
        #36 0x7f9c2ea4ebc2 in MessageLoop::Run() /ipc/chromium/src/base/message_loop.cc:356:3
        #37 0x7f9c32f02af8 in nsBaseAppShell::Run() /widget/nsBaseAppShell.cpp:150:27
        #38 0x7f9c350fbebb in XRE_RunAppShell() /toolkit/xre/nsEmbedFunctions.cpp:880:20
        #39 0x7f9c2eb2a54a in mozilla::ipc::MessagePumpForChildProcess::Run(base::MessagePump::Delegate*) /ipc/glue/MessagePump.cpp:235:9
        #40 0x7f9c2ea4ecb7 in MessageLoop::RunInternal() /ipc/chromium/src/base/message_loop.cc:381:10
        #41 0x7f9c2ea4ebc2 in RunHandler /ipc/chromium/src/base/message_loop.cc:374:3
        #42 0x7f9c2ea4ebc2 in MessageLoop::Run() /ipc/chromium/src/base/message_loop.cc:356:3
        #43 0x7f9c350fb3d3 in XRE_InitChildProcess(int, char**, XREChildData const*) /toolkit/xre/nsEmbedFunctions.cpp:739:34
        #44 0x55f70f609b39 in content_process_main /browser/app/../../ipc/contentproc/plugin-container.cpp:57:28
        #45 0x55f70f609b39 in main /browser/app/nsBrowserApp.cpp:359:18
        #46 0x7f9c44ba7d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
        #47 0x7f9c44ba7e3f in __libc_start_main csu/../csu/libc-start.c:392:3
        #48 0x55f70f5df8dc in _start (/home/jkratzer/builds/mc-debug/firefox-bin+0x168dc) (BuildId: af8f324dbdd246c48c7f0e9b54c5151e6c209b17)
    
    UndefinedBehaviorSanitizer can not provide additional info.
    SUMMARY: UndefinedBehaviorSanitizer: SEGV /builds/worker/workspace/obj-build/dist/include/mozilla/Assertions.h:261:3 in MOZ_Crash
    ==950546==ABORTING
Attached file Testcase
Assignee: nobody → jfkthame
Status: NEW → ASSIGNED

Bugmon Analysis
Verified bug as reproducible on mozilla-central 20220915123737-18fabd590b3c.
The bug appears to have been introduced in the following build range:

Start: 14bbdad41ca8f9cbe874b8e1adf10a701ff81517 (20220711154729)
End: 0fa881dedc30efcf53f1419737a9f3d7d2fc5521 (20220711143742)
Pushlog: https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=14bbdad41ca8f9cbe874b8e1adf10a701ff81517&tochange=0fa881dedc30efcf53f1419737a9f3d7d2fc5521

Keywords: regression
Whiteboard: [bugmon:confirm][fuzzblocker] → [bugmon:bisected,confirmed][fuzzblocker]
Regressed by: 1746110

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

For posterity, the feature in question was enabled by default for Fx105+ in bug 1779009.

The severity field is not set for this bug.
:bhood, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(bhood)

Marking as S3 as it seems like in practice, it would be hard to exploit the unsafety here; P2 because it could be blocking the fuzzers from finding further issues, so we should get the fix landed.

Severity: -- → S3
Priority: -- → P2
Flags: needinfo?(bhood)
Pushed by jkew@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/3fdbc550dd34
Use thread-safe refcounting in gfxFontFaceBufferSource. r=aosmond
Status: ASSIGNED → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 107 Branch

Bugmon Analysis
Verified bug as fixed on rev mozilla-central 20221004040915-0e384d802c84.
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.
:jfkthame, is this bug important enough to require an uplift?

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

For more information, please visit auto_nag documentation.

Flags: needinfo?(jfkthame)

Comment on attachment 9294932 [details]
Bug 1791023 - Use thread-safe refcounting in gfxFontFaceBufferSource. r=aosmond

Beta/Release Uplift Approval Request

  • User impact if declined: Thread-unsafe refcounting could lead to leaks and/or UAF issues with CSS Font-Loading API.
  • 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): Trivial patch to use thread-safe refcount.
  • String changes made/needed:
  • Is Android affected?: Yes
Flags: needinfo?(jfkthame)
Attachment #9294932 - Flags: approval-mozilla-beta?

Comment on attachment 9294932 [details]
Bug 1791023 - Use thread-safe refcounting in gfxFontFaceBufferSource. r=aosmond

Approved for 106.0b8, thanks.

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