Closed Bug 2009516 Opened 10 months ago Closed 8 months ago

ThreadSanitizer: data race [@ dec] vs. [@ free] in gfxFontEntry::UnitsPerEm()

Categories

(Core :: Layout: Text and Fonts, defect, P2)

defect

Tracking

()

RESOLVED DUPLICATE of bug 2015952
Tracking Status
firefox148 --- affected

People

(Reporter: tsmith, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: csectype-race, pernosco-wanted, sec-moderate)

Attachments

(1 file)

Attached file tsan-log.txt —

Found with m-c 20260109-40447644a69f (--enable-thread-sanitizer)

This was found by visiting a live website with a TSan build.

STR:

  • Launch browser and visit site

This issue was triggered by visiting http://www.mulinocaputo.it/.

ThreadSanitizer: data race [@ dec] vs. [@ free]

WARNING: ThreadSanitizer: data race (pid=135783)
  Write of size 8 at 0x720c000cfde0 by thread T25:
    #0 free /builds/worker/fetches/llvm-project/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:741:3 (firefox-bin+0xc448a) (BuildId: 9e368557fc9c1fff24962004e3feb2c884e10389)
    #1 hb_free /builds/worker/checkouts/gecko/gfx/harfbuzz/src/hb-common.cc:1239:28 (libxul.so+0x571c2ca) (BuildId: 18e6113161ebc2bd3c7d0f64db98dca6a8abac8e)
    #2 hb_blob_destroy /builds/worker/checkouts/gecko/gfx/harfbuzz/src/hb-blob.cc:266:3 (libxul.so+0x571c2ca)
    #3 ~AutoTable /builds/worker/checkouts/gecko/gfx/thebes/gfxFontEntry.h:381:20 (libxul.so+0x5991e6a) (BuildId: 18e6113161ebc2bd3c7d0f64db98dca6a8abac8e)
    #4 gfxFontEntry::UnitsPerEm() /builds/worker/checkouts/gecko/gfx/thebes/gfxFontEntry.cpp:294:1 (libxul.so+0x5991e6a)
    #5 gfxFont::gfxFont(RefPtr<mozilla::gfx::UnscaledFont> const&, gfxFontEntry*, gfxFontStyle const*, gfxFont::AntialiasOption) /builds/worker/checkouts/gecko/gfx/thebes/gfxFont.cpp:1004:21 (libxul.so+0x5991769) (BuildId: 18e6113161ebc2bd3c7d0f64db98dca6a8abac8e)
    #6 gfxFT2FontBase::gfxFT2FontBase(RefPtr<mozilla::gfx::UnscaledFontFreeType> const&, RefPtr<mozilla::gfx::SharedFTFace>&&, gfxFontEntry*, gfxFontStyle const*, int, bool) /builds/worker/checkouts/gecko/gfx/thebes/gfxFT2FontBase.cpp:36:7 (libxul.so+0x59422ad) (BuildId: 18e6113161ebc2bd3c7d0f64db98dca6a8abac8e)
    #7 gfxFontconfigFont /builds/worker/checkouts/gecko/gfx/thebes/gfxFcPlatformFontList.cpp:1326:7 (libxul.so+0x5949acc) (BuildId: 18e6113161ebc2bd3c7d0f64db98dca6a8abac8e)
    #8 gfxFontconfigFontEntry::CreateFontInstance(gfxFontStyle const*) /builds/worker/checkouts/gecko/gfx/thebes/gfxFcPlatformFontList.cpp:949:26 (libxul.so+0x5949acc)
    #9 gfxFontEntry::FindOrMakeFont(gfxFontStyle const*, gfxCharacterMap*) /builds/worker/checkouts/gecko/gfx/thebes/gfxFontEntry.cpp:246:22 (libxul.so+0x5979e5e) (BuildId: 18e6113161ebc2bd3c7d0f64db98dca6a8abac8e)
    #10 gfxFontGroup::GetFontAt(unsigned int, unsigned int, bool*) /builds/worker/checkouts/gecko/gfx/thebes/gfxTextRun.cpp:2104:16 (libxul.so+0x5a12bdf) (BuildId: 18e6113161ebc2bd3c7d0f64db98dca6a8abac8e)
    #11 gfxFontGroup::GetFirstValidFont(unsigned int, mozilla::StyleGenericFontFamily*, bool*) /builds/worker/checkouts/gecko/gfx/thebes/gfxTextRun.cpp:2341:12 (libxul.so+0x5a13e08) (BuildId: 18e6113161ebc2bd3c7d0f64db98dca6a8abac8e)
    #12 mozilla::dom::CanvasRenderingContext2D::DrawOrMeasureText(nsTSubstring<char16_t> const&, float, float, mozilla::dom::Optional<double> const&, mozilla::dom::CanvasRenderingContext2D::TextDrawOperation, mozilla::ErrorResult&) /builds/worker/checkouts/gecko/dom/canvas/CanvasRenderingContext2D.cpp:5175:46 (libxul.so+0x746bded) (BuildId: 18e6113161ebc2bd3c7d0f64db98dca6a8abac8e)
    #13 mozilla::dom::CanvasRenderingContext2D::FillText(nsTSubstring<char16_t> const&, double, double, mozilla::dom::Optional<double> const&, mozilla::ErrorResult&) /builds/worker/checkouts/gecko/dom/canvas/CanvasRenderingContext2D.cpp:4644:47 (libxul.so+0x746b02e) (BuildId: 18e6113161ebc2bd3c7d0f64db98dca6a8abac8e)
    #14 mozilla::dom::OffscreenCanvasRenderingContext2D_Binding::fillText(JSContext*, JS::Handle<JSObject*>, void*, JSJitMethodCallArgs const&) /builds/worker/workspace/obj-build/dom/bindings/./OffscreenCanvasRenderingContext2DBinding.cpp:4015:24 (libxul.so+0x683cc61) (BuildId: 18e6113161ebc2bd3c7d0f64db98dca6a8abac8e)
    #15 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:3306:13 (libxul.so+0x73659c9) (BuildId: 18e6113161ebc2bd3c7d0f64db98dca6a8abac8e)
    ...

  Previous atomic write of size 4 at 0x720c000cfde0 by thread T24:
    #0 dec /builds/worker/checkouts/gecko/gfx/harfbuzz/src/graph/../hb-atomic.hh:230:21 (libxul.so+0x571c24c) (BuildId: 18e6113161ebc2bd3c7d0f64db98dca6a8abac8e)
    #1 dec /builds/worker/checkouts/gecko/gfx/harfbuzz/src/graph/../hb-object.hh:150:39 (libxul.so+0x571c24c)
    #2 hb_object_destroy<hb_blob_t> /builds/worker/checkouts/gecko/gfx/harfbuzz/src/graph/../hb-object.hh:291:29 (libxul.so+0x571c24c)
    #3 hb_blob_destroy /builds/worker/checkouts/gecko/gfx/harfbuzz/src/hb-blob.cc:264:8 (libxul.so+0x571c24c)
    #4 ~AutoTable /builds/worker/checkouts/gecko/gfx/thebes/gfxFontEntry.h:381:20 (libxul.so+0x5991e6a) (BuildId: 18e6113161ebc2bd3c7d0f64db98dca6a8abac8e)
    #5 gfxFontEntry::UnitsPerEm() /builds/worker/checkouts/gecko/gfx/thebes/gfxFontEntry.cpp:294:1 (libxul.so+0x5991e6a)
    #6 gfxFont::gfxFont(RefPtr<mozilla::gfx::UnscaledFont> const&, gfxFontEntry*, gfxFontStyle const*, gfxFont::AntialiasOption) /builds/worker/checkouts/gecko/gfx/thebes/gfxFont.cpp:1004:21 (libxul.so+0x5991769) (BuildId: 18e6113161ebc2bd3c7d0f64db98dca6a8abac8e)
    #7 gfxFT2FontBase::gfxFT2FontBase(RefPtr<mozilla::gfx::UnscaledFontFreeType> const&, RefPtr<mozilla::gfx::SharedFTFace>&&, gfxFontEntry*, gfxFontStyle const*, int, bool) /builds/worker/checkouts/gecko/gfx/thebes/gfxFT2FontBase.cpp:36:7 (libxul.so+0x59422ad) (BuildId: 18e6113161ebc2bd3c7d0f64db98dca6a8abac8e)
    #8 gfxFontconfigFont /builds/worker/checkouts/gecko/gfx/thebes/gfxFcPlatformFontList.cpp:1326:7 (libxul.so+0x5949acc) (BuildId: 18e6113161ebc2bd3c7d0f64db98dca6a8abac8e)
    #9 gfxFontconfigFontEntry::CreateFontInstance(gfxFontStyle const*) /builds/worker/checkouts/gecko/gfx/thebes/gfxFcPlatformFontList.cpp:949:26 (libxul.so+0x5949acc)
    #10 gfxFontEntry::FindOrMakeFont(gfxFontStyle const*, gfxCharacterMap*) /builds/worker/checkouts/gecko/gfx/thebes/gfxFontEntry.cpp:246:22 (libxul.so+0x5979e5e) (BuildId: 18e6113161ebc2bd3c7d0f64db98dca6a8abac8e)
    #11 gfxFontGroup::GetFontAt(unsigned int, unsigned int, bool*) /builds/worker/checkouts/gecko/gfx/thebes/gfxTextRun.cpp:2104:16 (libxul.so+0x5a12bdf) (BuildId: 18e6113161ebc2bd3c7d0f64db98dca6a8abac8e)
    #12 gfxFontGroup::GetFirstValidFont(unsigned int, mozilla::StyleGenericFontFamily*, bool*) /builds/worker/checkouts/gecko/gfx/thebes/gfxTextRun.cpp:2341:12 (libxul.so+0x5a13e08) (BuildId: 18e6113161ebc2bd3c7d0f64db98dca6a8abac8e)
    #13 mozilla::dom::CanvasRenderingContext2D::DrawOrMeasureText(nsTSubstring<char16_t> const&, float, float, mozilla::dom::Optional<double> const&, mozilla::dom::CanvasRenderingContext2D::TextDrawOperation, mozilla::ErrorResult&) /builds/worker/checkouts/gecko/dom/canvas/CanvasRenderingContext2D.cpp:5175:46 (libxul.so+0x746bded) (BuildId: 18e6113161ebc2bd3c7d0f64db98dca6a8abac8e)
    #14 mozilla::dom::CanvasRenderingContext2D::FillText(nsTSubstring<char16_t> const&, double, double, mozilla::dom::Optional<double> const&, mozilla::ErrorResult&) /builds/worker/checkouts/gecko/dom/canvas/CanvasRenderingContext2D.cpp:4644:47 (libxul.so+0x746b02e) (BuildId: 18e6113161ebc2bd3c7d0f64db98dca6a8abac8e)
    #15 mozilla::dom::OffscreenCanvasRenderingContext2D_Binding::fillText(JSContext*, JS::Handle<JSObject*>, void*, JSJitMethodCallArgs const&) /builds/worker/workspace/obj-build/dom/bindings/./OffscreenCanvasRenderingContext2DBinding.cpp:4015:24 (libxul.so+0x683cc61) (BuildId: 18e6113161ebc2bd3c7d0f64db98dca6a8abac8e)
    ...

  Thread T25 'DOM Worker' (tid=135909, running) created by main thread at:
    #0 pthread_create /builds/worker/fetches/llvm-project/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:1041:3 (firefox-bin+0xc58ca) (BuildId: 9e368557fc9c1fff24962004e3feb2c884e10389)
    #1 _PR_CreateThread /builds/worker/checkouts/gecko/nsprpub/pr/src/pthreads/ptthread.c:429:10 (libnspr4.so+0x425fe) (BuildId: 04bde63d7cfccd983b971a6e7e301dc9a5a026e5)
    #2 PR_CreateThread /builds/worker/checkouts/gecko/nsprpub/pr/src/pthreads/ptthread.c:496:10 (libnspr4.so+0x37974) (BuildId: 04bde63d7cfccd983b971a6e7e301dc9a5a026e5)
    #3 nsThread::Init(nsTSubstring<char> const&) /builds/worker/checkouts/gecko/xpcom/threads/nsThread.cpp:622:20 (libxul.so+0x4143307) (BuildId: 18e6113161ebc2bd3c7d0f64db98dca6a8abac8e)
    #4 mozilla::dom::WorkerThread::Create(mozilla::dom::WorkerThreadFriendKey const&) /builds/worker/checkouts/gecko/dom/workers/WorkerThread.cpp:94:7 (libxul.so+0x951e61b) (BuildId: 18e6113161ebc2bd3c7d0f64db98dca6a8abac8e)
    #5 mozilla::dom::workerinternals::RuntimeService::ScheduleWorker(mozilla::dom::WorkerPrivate&) /builds/worker/checkouts/gecko/dom/workers/RuntimeService.cpp:1464:37 (libxul.so+0x94cb2e3) (BuildId: 18e6113161ebc2bd3c7d0f64db98dca6a8abac8e)
    #6 mozilla::dom::workerinternals::RuntimeService::RegisterWorker(mozilla::dom::WorkerPrivate&) /builds/worker/checkouts/gecko/dom/workers/RuntimeService.cpp:1347:19 (libxul.so+0x94ca5dc) (BuildId: 18e6113161ebc2bd3c7d0f64db98dca6a8abac8e)
    #7 mozilla::dom::WorkerPrivate::Constructor(JSContext*, nsTSubstring<char16_t> const&, bool, mozilla::dom::WorkerKind, mozilla::dom::RequestCredentials, mozilla::dom::WorkerType, nsTSubstring<char16_t> const&, nsTSubstring<char> const&, mozilla::dom::WorkerLoadInfo*, mozilla::ErrorResult&, nsTString<char16_t>, std::function<void (bool)>&&, std::function<void ()>&&, mozilla::ipc::Endpoint<mozilla::dom::PRemoteWorkerNonLifeCycleOpControllerChild>&&) /builds/worker/checkouts/gecko/dom/workers/WorkerPrivate.cpp:3162:24 (libxul.so+0x94fcdc4) (BuildId: 18e6113161ebc2bd3c7d0f64db98dca6a8abac8e)
    #8 mozilla::dom::Worker::Constructor(mozilla::dom::GlobalObject const&, mozilla::dom::TrustedScriptURLOrUSVString const&, mozilla::dom::WorkerOptions const&, mozilla::ErrorResult&) /builds/worker/checkouts/gecko/dom/workers/Worker.cpp:79:41 (libxul.so+0x94d81ee) (BuildId: 18e6113161ebc2bd3c7d0f64db98dca6a8abac8e)
    #9 mozilla::dom::Worker_Binding::_constructor(JSContext*, unsigned int, JS::Value*) /builds/worker/workspace/obj-build/dom/bindings/./WorkerBinding.cpp:1084:52 (libxul.so+0x6f110b7) (BuildId: 18e6113161ebc2bd3c7d0f64db98dca6a8abac8e)
    #10 mozilla::dom::InterfaceObjectJSNative(JSContext*, unsigned int, JS::Value*) /builds/worker/checkouts/gecko/dom/bindings/BindingUtils.cpp:751:10 (libxul.so+0x7368265) (BuildId: 18e6113161ebc2bd3c7d0f64db98dca6a8abac8e)
    ...

  Thread T24 'DOM Worker' (tid=135908, running) created by main thread at:
    #0 pthread_create /builds/worker/fetches/llvm-project/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:1041:3 (firefox-bin+0xc58ca) (BuildId: 9e368557fc9c1fff24962004e3feb2c884e10389)
    #1 _PR_CreateThread /builds/worker/checkouts/gecko/nsprpub/pr/src/pthreads/ptthread.c:429:10 (libnspr4.so+0x425fe) (BuildId: 04bde63d7cfccd983b971a6e7e301dc9a5a026e5)
    #2 PR_CreateThread /builds/worker/checkouts/gecko/nsprpub/pr/src/pthreads/ptthread.c:496:10 (libnspr4.so+0x37974) (BuildId: 04bde63d7cfccd983b971a6e7e301dc9a5a026e5)
    #3 nsThread::Init(nsTSubstring<char> const&) /builds/worker/checkouts/gecko/xpcom/threads/nsThread.cpp:622:20 (libxul.so+0x4143307) (BuildId: 18e6113161ebc2bd3c7d0f64db98dca6a8abac8e)
    #4 mozilla::dom::WorkerThread::Create(mozilla::dom::WorkerThreadFriendKey const&) /builds/worker/checkouts/gecko/dom/workers/WorkerThread.cpp:94:7 (libxul.so+0x951e61b) (BuildId: 18e6113161ebc2bd3c7d0f64db98dca6a8abac8e)
    #5 mozilla::dom::workerinternals::RuntimeService::ScheduleWorker(mozilla::dom::WorkerPrivate&) /builds/worker/checkouts/gecko/dom/workers/RuntimeService.cpp:1464:37 (libxul.so+0x94cb2e3) (BuildId: 18e6113161ebc2bd3c7d0f64db98dca6a8abac8e)
    #6 mozilla::dom::workerinternals::RuntimeService::RegisterWorker(mozilla::dom::WorkerPrivate&) /builds/worker/checkouts/gecko/dom/workers/RuntimeService.cpp:1347:19 (libxul.so+0x94ca5dc) (BuildId: 18e6113161ebc2bd3c7d0f64db98dca6a8abac8e)
    #7 mozilla::dom::WorkerPrivate::Constructor(JSContext*, nsTSubstring<char16_t> const&, bool, mozilla::dom::WorkerKind, mozilla::dom::RequestCredentials, mozilla::dom::WorkerType, nsTSubstring<char16_t> const&, nsTSubstring<char> const&, mozilla::dom::WorkerLoadInfo*, mozilla::ErrorResult&, nsTString<char16_t>, std::function<void (bool)>&&, std::function<void ()>&&, mozilla::ipc::Endpoint<mozilla::dom::PRemoteWorkerNonLifeCycleOpControllerChild>&&) /builds/worker/checkouts/gecko/dom/workers/WorkerPrivate.cpp:3162:24 (libxul.so+0x94fcdc4) (BuildId: 18e6113161ebc2bd3c7d0f64db98dca6a8abac8e)
    #8 mozilla::dom::Worker::Constructor(mozilla::dom::GlobalObject const&, mozilla::dom::TrustedScriptURLOrUSVString const&, mozilla::dom::WorkerOptions const&, mozilla::ErrorResult&) /builds/worker/checkouts/gecko/dom/workers/Worker.cpp:79:41 (libxul.so+0x94d81ee) (BuildId: 18e6113161ebc2bd3c7d0f64db98dca6a8abac8e)
    #9 mozilla::dom::Worker_Binding::_constructor(JSContext*, unsigned int, JS::Value*) /builds/worker/workspace/obj-build/dom/bindings/./WorkerBinding.cpp:1084:52 (libxul.so+0x6f110b7) (BuildId: 18e6113161ebc2bd3c7d0f64db98dca6a8abac8e)
    #10 mozilla::dom::InterfaceObjectJSNative(JSContext*, unsigned int, JS::Value*) /builds/worker/checkouts/gecko/dom/bindings/BindingUtils.cpp:751:10 (libxul.so+0x7368265) (BuildId: 18e6113161ebc2bd3c7d0f64db98dca6a8abac8e)
    ...

Looks similar to bug 2009213.

Flags: needinfo?(jfkthame)
Severity: -- → S2
Priority: -- → P2
Keywords: sec-moderate
Component: Graphics: Text → Layout: Text and Fonts
Group: gfx-core-security → layout-core-security

Tyson, would you mind capturing a pernosco trace?

Flags: needinfo?(twsmith)
Summary: ThreadSanitizer: data race [@ dec] vs. [@ free] → ThreadSanitizer: data race [@ dec] vs. [@ free] in gfxFontEntry::UnitsPerEm()

(In reply to Daniel Holbert [:dholbert] from comment #2)

Tyson, would you mind capturing a pernosco trace?

No luck, sorry. This one it difficult to reproduce.

Flags: needinfo?(twsmith)

Pretty sure this is bug 2015952.

Depends on: 2015952
Status: NEW → RESOLVED
Closed: 8 months ago
Duplicate of bug: 2015952
Resolution: --- → DUPLICATE
Group: layout-core-security

Clearing the needinfo request since this bug is a duplicate of bug 2015952, which has been closed for 7 months and 12 days.

For more information, please visit BugBot documentation.

Flags: needinfo?(jfkthame)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: