Closed Bug 2098924 Opened 3 days ago Closed 3 hours ago

Firefox 161 triggers an unreclaimable amdgpu kernel memory leak (~200–430 MB/min) when a game is running — Linux, Wayland, RX 7900 XT

Categories

(Core :: Graphics, defect)

Firefox 161
defect

Tracking

()

RESOLVED FIXED
163 Branch
Tracking Status
firefox-esr153 --- unaffected
firefox161 --- fixed
firefox162 --- fixed
firefox163 --- fixed

People

(Reporter: mxbasque, Assigned: stransky)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression)

Steps to reproduce

Summary

Since updating to Firefox 161.0 (Flathub, 2026-11-24), having Firefox open while a Direct3D game runs under Proton makes the Linux kernel's amdgpu driver leak unreclaimable memory at 200–430 MB per minute. The memory is never freed, even after Firefox exits. After a few hours the system runs out of memory for GPU buffers and the KDE Plasma desktop crashes to a black screen.

The leak itself is a kernel driver bug, already tracked upstream as amdgpu #5975: a reference leak on the VM page-table update (SDMA) path, triggered by GPU buffer map/unmap (I added my data there). Still, Firefox 161 is the only application that triggers it on my system, Gecko 160 does not, and the timing matches the update exactly. Firefox 161 seems to cause far more GPU buffer map/unmap churn than 160. Finding and reducing that churn would sidestep the kernel bug for everyone on affected kernels (6.17.6+ through at least 7.3.5).

Environment

  • Firefox 161.0, Flathub (org.mozilla.firefox), runtime org.freedesktop.Platform 25.08, Mesa 26.2.7
  • Linux: Bazzite (Fedora Atomic), kernels 7.1.5 and 7.3.5 (both affected)
  • KDE Plasma 6.8.3, Wayland session
  • GPU: AMD Radeon RX 7900 XT (Navi 31); a Raphael iGPU is also present with no displays attached
  • 2× 3440×1440 monitors (175 Hz and 165 Hz)
  • Game used to reproduce: World of Warcraft via Proton (GE-Proton 11 / Proton-EM 10), with both D3D11 and D3D12

Steps to reproduce

  1. Start a Proton game (D3D11 or D3D12) on an RDNA3 GPU.
  2. Monitor grep SUnreclaim /proc/meminfo. It stays flat.
  3. Open Firefox 161. Playing a video speeds it up, but it isn't required.
  4. SUnreclaim climbs at ~200–430 MB/min.
  5. Close Firefox. The growth stops, but nothing is released until reboot.

Actual results

Actual

Configuration (game running) Kernel SUnreclaim
Firefox closed flat
Brave (Chromium) playing video flat
Discord flat
Firefox 161, video playing +200–250 MB/min
Firefox 161, video paused ~+35 MB/min
Firefox 161, no video, media.hardware-video-decoding.enabled=false and force-enabled=false +~230 MB/min
Firefox 161, gfx.webrender.software=true +~430 MB/min
Zen browser 1.24.3b (Gecko 160.0.1), same Flatpak runtime (freedesktop 25.08, Mesa 26.2.7), video playing flat

Disabling hardware video decoding and switching to software WebRender did not stop it, so it doesn't seem to be VA-API decoding or GPU WebRender alone. It might be in buffer sharing or presentation (dmabuf / Wayland), the GPU process, or something else that still touches the GPU.

Regression range: Zen 1.24.3b, which is built on Gecko 160.0.1 and runs on the same Flathub runtime and Mesa as Firefox, does not trigger the leak under identical conditions. Firefox 161.0 (BuildID 20261118180411) does. This points to a change between 160.0.1 and 161.0 rather than to the runtime or the graphics driver userspace. I can run mozregression if that helps.

Not yet tested: Firefox 161 alone without a game.

Timeline

The first crash happened on 2026-11-25, one day after Firefox 161 was installed. Before that, I used the same setup daily for weeks with no problems.

Related

Expected results

No kernel memory growth (as with Chromium-based Brave or Discord under the same conditions).

Update: the game is not required.

I tested Firefox 161 with no game running at all (same system, kernel 7.3.5, KDE Plasma 6.8.3 Wayland), with a video playing in Firefox:

Time Kernel SUnreclaim
Firefox opened 273 MB
+1 min 784 MB
+2 min 1,156 MB
+3 min 1,523 MB

That's ~410 MB/min with only the desktop and Firefox, as fast as the worst rate I measured with a game running. mpv was also open during this test, but mpv on its own (without Firefox) stays flat (262 → 271 MB over 2 min).

So Firefox 161 alone is enough to trigger the leak on an affected kernel. Under normal browsing, an affected system would gradually lose memory until it needs a reboot. With Firefox closed, SUnreclaim stays flat.

Temporary workaround

Confirmed the mechanism: KWin's udmabuf import of Firefox 161's wl_shm buffers.

Firefox 161 contains bug 2087615 ("[Wayland] Align allocated wl_shm pool to page size", commit fb94d335c655), the same change already identified by mozregression as the regressor of bug 2098396. With page-aligned wl_shm pools, KWin's udmabuf import path (which used to fail immediately on unaligned memfds) now kicks in. KWin then creates and maps amdgpu buffer objects for Firefox's wl_shm buffers, which is the kwin_wayland → amdgpu_gem_va_ioctl → amdgpu_vm_bo_update path where amdgpu #5975 leaks fences.

Test on the same system (kernel 7.3.5, KWin 6.8.3, RX 7900 XT, Firefox 161.0 Flathub, gfx.webrender.software=true, video playing), after a fresh boot with KWIN_DISABLE_UDMABUF_IMPORT=1 set for KWin:

SUnreclaim over ~3 min
Before (udmabuf import enabled, same Firefox config) 273 → 1523 MB (~410–430 MB/min)
With KWIN_DISABLE_UDMABUF_IMPORT=1 239 → 276 MB (normal startup noise, then flat)

So the trigger is Firefox 161's page-aligned wl_shm pools enabling KWin's udmabuf import, and the leak itself is the amdgpu VA-update fence leak (#5975). Gecko 160 doesn't page-align the pool, so KWin's import fails early and the leaking path is never hit.

Workaround for affected users until either side is fixed: set KWIN_DISABLE_UDMABUF_IMPORT=1 for KWin, e.g. in ~/.config/environment.d/kwin-no-udmabuf.conf, then log out and back in.

Links: Firefox bug 2098924 · bug 2087615 · bug 2098396 · amdgpu #5975 (https://gitlab.freedesktop.org/drm/amd/-/work_items/5975)

See Also: → 2099286

:stransky, since you are the author of the regressor, bug 2087615, could you take a look?

For more information, please visit BugBot documentation.

Flags: needinfo?(stransky)
Blocks: udmabuf

(In reply to BugBot [:suhaib / :marco] from comment #3)

:stransky, since you are the author of the regressor, bug 2087615, could you take a look?

Let's backout bug 2087615.

Flags: needinfo?(stransky)

The bug has a release status flag that shows some version of Firefox is affected, thus it will be considered confirmed.

Status: UNCONFIRMED → NEW
Ever confirmed: true

Fixed by backout.

Assignee: nobody → stransky
Status: NEW → RESOLVED
Closed: 3 hours ago
Resolution: --- → FIXED
Target Milestone: --- → 163 Branch
You need to log in before you can comment on or make changes to this bug.