Crash in [@ mozilla::gl::GLContextEGL::Cast]
Categories
(Core :: Graphics: Canvas2D, defect)
Tracking
()
People
(Reporter: clouseau-bot, Unassigned)
References
(Blocks 1 open bug, Regression)
Details
(Keywords: crash, regression)
Crash Data
Crash report: https://crash-stats.mozilla.org/report/index/131f8c41-d892-4de3-8fc7-bd0840261018
Reports with a different stack in the same spike: https://crash-stats.mozilla.org/report/index/393f1a8d-43b3-43da-92c9-4b8810261019, https://crash-stats.mozilla.org/report/index/08057b2f-6f7b-460b-bb38-bca800261019
Crash Reason:
SIGSEGV / SEGV_MAPERR at 0x0000000000000000
Top 10 frames:
0 libxul.so mozilla::gl::SharedSurface_AndroidHardwareBuffer::WaitForBufferOwnership() gfx/gl/SharedSurfaceAndroidHardwareBuffer.cpp:133
1 libxul.so mozilla::layers::CanvasTranslator::ResolveExternalSnapshot(unsigned long, mozill... gfx/layers/ipc/CanvasTranslator.cpp:1824
2 libxul.so mozilla::layers::CanvasTranslator::TranslateRecording() gfx/layers/ipc/CanvasTranslator.cpp:804
3 libxul.so mozilla::layers::CanvasTranslator::HandleCanvasTranslatorEvents() gfx/layers/ipc/CanvasTranslator.cpp:890
4 libxul.so mozilla::detail::RunnableMethodImpl<mozilla::Preferences*, nsresult (mozilla::Pr... xpcom/threads/nsThreadUtils.h:1124
5 libxul.so NS_ProcessNextEvent(nsIThread*, bool) xpcom/threads/nsThreadUtils.cpp:471
6 libxul.so mozilla::ipc::MessagePumpForNonMainThreads::Run(base::MessagePump::Delegate*) ipc/glue/MessagePump.cpp:297
7 libxul.so MessageLoop::Run() ipc/chromium/src/base/message_loop.cc:346
8 libxul.so nsThread::ThreadFunc(void*) xpcom/threads/nsThread.cpp:436
9 libnss3.so _pt_root nsprpub/pr/src/pthreads/ptthread.c:198
Filed because this signature's crash volume spiked. 70 reports from 57 distinct installations on the release build of 2026-10-07 (buildid 20261007201254); none of the preceding 1 build-day had any, and the loudest of its 2 earlier builds in the 42 days before had 19. That is 3.7x the loudest of the preceding build-days and of this signature's builds over the 42 days before (Clouseau's bar is 3x, and the Poisson excess of the day against that baseline is z = 7.97, bar 3.62). This signature is not new: its first report is in build 20260315085700 (2026-03-15), 206 days before this build.
Clouseau analysis (automated -- nothing below was checked by a human; a claim it could not ground is deliberately absent):
The GPU process's CanvasRenderer thread crashes with a null dereference in SharedSurface_AndroidHardwareBuffer::WaitForBufferOwnership(), which calls GLContextEGL::Cast(mDesc.gl) without checking whether the WeakPtr<GLContext> has been cleared. That Cast reads a field of the null context. This happens when CanvasTranslator::ResolveExternalSnapshot resolves a WebGL snapshot that is backed by an AndroidHardwareBuffer, i.e. a remote 2D canvas drawing a WebGL canvas. Bug 2066020 (c425043976f8) made that surface type the default for WebGL on Android, and the spike is an entirely new call-path cohort: every report from build 20261007201254 on is this path, and none before it is. Bug 2078358 on this signature is RESOLVED FIXED, but the unguarded code is still at the release tip. That fix should be uplifted to release; if it is not in time, flipping webgl.out-of-process.enable-ahardwarebuffer to false would be a stopgap, though it is mirror: once, so it needs a restart.
Suspected regressor (high confidence): c425043976f8 (bug 2066020) by :sotaro.
The diff flips webgl.out-of-process.enable-ahardwarebuffer from false to true (StaticPrefList.yaml). That makes TexTypeForWebgl return TextureType::AndroidHardwareBuffer on Android (CanvasRenderer.cpp:122-125). RecvSnapshotExternalCanvas then stores an AHB SharedSurface in mExternalSnapshots, and ResolveExternalSnapshot later calls BeginRead() on it, which reaches the unguarded GLContextEGL::Cast(mDesc.gl). The pinned build has the pref set to true. The proto-signature split shows this path only from the spiking build on. The earlier landing 7a4f50a624e3 was backed out; c425043976f8 is the relanding that is in the build. The defect is older: it is the missing null check in WaitForBufferOwnership, which was last reshaped by bugs 2067635 and 2069205. The pref flip is what made it reachable for release users.
Possible path to the crash:
Mechanism (observed): a null dereference inside GLContextEGL::Cast(mDesc.gl) at SharedSurfaceAndroidHardwareBuffer.cpp:133. Cast runs MOZ_RELEASE_ASSERT(gl->GetContextType() == ...) on gl, so it reads through the pointer, and all 1106 arm64 memory-access reports fault at 0x0.
Path (observed from source and stacks):
- With the pref on,
TexTypeForWebglselectsTextureType::AndroidHardwareBufferfor WebGL on Android. CanvasTranslator::RecvSnapshotExternalCanvasstores the WebGL back-bufferSharedSurface(ashared_ptr) together with a weakmWebglinmExternalSnapshots.- On the CanvasRenderer thread,
TranslateRecordinghandles the extension event and callsResolveExternalSnapshot, which callssnapshot.mSharedSurface->BeginRead()(CanvasTranslator.cpp:1824). BeginReadcallsWaitForBufferOwnership(). If the AHB has a pending fence, that function castsmDesc.gl, aWeakPtr<GLContext>, with no null check, and crashes when the pointer has been cleared.
Trigger (inferred, medium): the WebGL GLContext is destroyed, for example by context loss or teardown of the WebGL canvas, between snapshot creation and resolution, while the shared surface outlives it through the snapshot's shared_ptr. The sibling functions ~SharedSurface_AndroidHardwareBuffer and ProducerReleaseImpl in the same file explicitly guard !gl, which shows this state is expected.
Checked:
- The faulting line is
const auto& gle = GLContextEGL::Cast(mDesc.gl);, reached only when the merged fence fd is valid; there is no null check onmDesc.gl. (gfx/gl/SharedSurfaceAndroidHardwareBuffer.cpp@eb9a6e3a7368:126-134) PartialSharedSurfaceDesc::glisconst WeakPtr<GLContext>, so it can become null when the context dies. (gfx/gl/SharedSurface.h@eb9a6e3a7368:55-56)GLContextEGL::Castdereferencesglin aMOZ_RELEASE_ASSERTbefore casting. (gfx/gl/GLContextEGL.h@eb9a6e3a7368:73-76)- The destructor and
ProducerReleaseImplin the same class guardif (!gl || !gl->MakeCurrent()) return;;WaitForBufferOwnershipdoes not. (gfx/gl/SharedSurfaceAndroidHardwareBuffer.cpp@eb9a6e3a7368:82-101) ResolveExternalSnapshotcallssnapshot.mSharedSurface->BeginRead()on a surface stored byRecvSnapshotExternalCanvasalongside a weakmWebgl. (gfx/layers/ipc/CanvasTranslator.cpp@eb9a6e3a7368:1751-1824)webgl.out-of-process.enable-ahardwarebufferistrue(mirror: once, Android only) in the crash build, andTexTypeForWebglreturnsAndroidHardwareBufferwhen it is set. (modules/libpref/init/StaticPrefList.yaml@eb9a6e3a7368:20614-20619; gfx/layers/CanvasRenderer.cpp@eb9a6e3a7368:122-125)- Changeset
c425043976f8(bug 2066020) changes the pref default from false to true. (mcp__patch__diff c425043976f8, modules/libpref/init/StaticPrefList.yaml) - Before build 20261007201254, all 67 release reports are the
RendererOGL::MaybeCaptureScreenPixelspath (plus 1AndroidImageReader); from that build on, all 75 areWaitForBufferOwnership | SharedSurface::BeginRead. (facets proto_signature, split_at_build=20261007201254, Fenix release, 120 days)
Alternatives considered:
- Hardware fault (Raptor Lake / bit flip): ruled out for this spike -- every spike report is arm64 Android with a Mali GPU, with an identical deterministic stack and a null fault address; the Intel CPU share in the brief belongs to other products' reports sharing the name.
- Continuation of the older
RendererOGL::MaybeCaptureScreenPixelscrash (bug 2044036): ruled out as the spike's source -- none of the post-spike reports are on that path. 7a4f50a624e3as culprit: ruled out -- it was backed out (by980b80614bdd); the in-tree landing isc425043976f8.- Date-driven external cause (the brief's in-version DATE EVENT note): disfavored -- the brief's own per-day rates show no step, only rising volume as 158.0 users increase.
Worth checking first:
- Is the bug 2078358 fix on release? Identify its changeset and request a release uplift; the release tip still shows the unguarded code.
- Which transition clears
mDesc.glwhile the snapshot's surface is alive (WebGL context loss, canvas destruction, GPU-process context reset)? Reading the bug 2078358 fix diff, or adding agfxCriticalNotewhenmDesc.glis null inWaitForBufferOwnership, would show it. - Root-cause fix vs guard: decide whether
ExternalSnapshotshould keep the GL context alive, orWaitForBufferOwnershipshould skip the wait (or wait on the CPU with the fence fd) whenmDesc.glis null.
:sotaro, can you have a look please?
Filed automatically by Clouseau, which analyses release crashes with an LLM. Nothing above was written or checked by a human. Please close it as INVALID if it is wrong — that is useful feedback, not a nuisance.
This is not an independent Mozilla discovery: the crash is known here only because somebody submitted the crash report linked at the top. If this duplicates an existing report, please resolve THIS bug as the duplicate and leave the credit with the earlier reporter.
Comment 1•29 days ago
|
||
Set release status flags based on info from the regressing bug 2066020
Updated•29 days ago
|
Comment 2•29 days ago
|
||
It seems like this bug is fixed everywhere by bug 2078358 except on 158, and bug 2078358 was marked wontfix for 158, so there is nothing to do here but mark this as duplicate of bug 2078358?
Updated•29 days ago
|
Comment 3•28 days ago
|
||
Thats my read too
Description
•