bcm2835-codec: NULL deref Oops after STREAMOFF / buffer-return race (Pi 4, Chromium H.264 decode, 6.18.50 and 6.18.60)
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 8/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- c, linux, raspberry-pi
- Bereich
- operating-systems
Rechercherichtung
The race sits in the bcm2835-codec driver: start with buffer_work_cb and the stop_streaming path in drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c, and the videobuf2 cancel path in videobuf2-core.c near lines 1187 and 2222. Done would mean the NULL dereferences from the stop path no longer occur under a reproducer that stops the decoder while firmware returns buffers, but no reproducer exists yet. This is kernel-internal concurrency work and is not suited to a first contribution.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Describe the bug
(with help of Claude ;-) ) i hope this helps others and you for fixing... Rob
On a Pi 4 running a Chromium kiosk, stopping the V4L2 hardware decoder occasionally triggers a WARNING in videobuf2. In 5 cases it coincided with a second WARNING in vb2_buffer_done on another CPU, and in 4 of those a NULL-pointer Oops followed within 12-300 ms in the bcm2835-codec / videobuf2-dma-contig path. After the Oops of 2026-11-23 the Chromium GPU process hung in D state inside a CMA allocation about 55 minutes later, which froze the display and touch (the machine stayed reachable over ssh). It happens on 6.18.50 and on 6.18.60.
I looked at the similar issues GitHub suggested (#7712, #7163, #7721). #7712 and #7163 are related in part, see "Additional context".
Steps to reproduce the behaviour
Not reproducible on demand; it happens sporadically on a kiosk that runs 24/7.
- Pi 4, Raspberry Pi OS (trixie, arm64), X11 session with openbox, Chromium in --app (kiosk) mode.
- The kiosk page rotates between a few dashboards every 20-30 s; one full rotation takes 80 s (the camera page is requested every 80 s according to my web server log).
- One dashboard plays three low-latency HLS streams from MediaMTX (all H.264, 640x360, 15-20 fps, about 0.2 Mbit/s each, video only: avc1.4d0016 for one, avc1.640016 for two). While that page is shown the Chromium GPU process has a /dev/video* node open; on the other dashboards it does not (checked via /proc//fd on 2026-11-11). So the decoder is started and stopped about every 80 s, roughly 1,000 times a day. The firmware log in the attached raspinfo shows one or two "video_decode:NN:RIL: resolution changing" messages per rotation.
- Leave it running. The events also happen at night when nobody is looking (e.g. 2026-11-09 05:51).
Device (s)
Raspberry Pi 4 Mod. B
System
- Raspberry Pi reference 2026-06-18 (pi-gen ca8aeed0ae300c2a89f55ce9617d5f96a27e99e5, stage4), Debian 13 trixie, arm64; Xorg with KMS (vc4-kms-v3d-pi4), openbox
- Kernel 6.18.50+rpt-rpi-v8 (1:6.18.50-1+rpt1) until 2026-11-08, 6.18.60+rpt-rpi-v8 (1:6.18.60-1+rpt1) from 2026-11-08 to 2026-11-12, and 6.18.50 again since 2026-11-12 13:06 (rolled back by copying vmlinuz/initrd into /boot/firmware; kernel packages on hold). Tainted G C (staging drivers), W after the first WARNING of a boot.
- Firmware Sep 14 2026 14:49:30 (a86983925695a7e63166327d7c002d64040ed31d), bootloader EEPROM 2026-10-30, up to date
- Chromium 155.0.8059.79 until 2026-11-08, 156.0.8078.79 since. Mesa 26.2.2 until 2026-11-08, then 26.2.6; 26.2.7 and rpi-chromium-mods 20261111 since 2026-11-22.
- Relevant Chromium flags: --use-angle=gles --enable-gpu-rasterization --ozone-platform=x11; hardware video decode left at the default (enabled)
- vcgencmd get_throttled = 0x0. See the attached raspinfo.
Logs
Combined event = WARNING at videobuf2-core.c:1187 (vb2_buffer_done, from buffer_work_cb) and WARNING at :2222 (__vb2_queue_cancel via v4l2_m2m_streamoff from Chromium's ThreadPoolSingl) in the same second, on different CPUs:
- 2026-11-11 12:15:57 (6.18.60): via ip_buffer_cb, no Oops
- 2026-11-11 19:04:40 (6.18.60): via ip_buffer_cb, Oops 16 ms later
- 2026-11-12 11:40:58 (6.18.60): via ip_buffer_cb, Oops 19 ms later
- 2026-11-13 15:42:48 (6.18.50): via op_buffer_cb, Oops about 300 ms later (15:42:49); "driver bug: stop_streaming operation is leaving buffer 6/7/8 in active state" in the same second
- 2026-11-23 09:29:32 (6.18.50): via ip_buffer_cb, Oops 12 ms later; "driver bug: ... buffer 0/1/2/13/14/15 in active state" in the same second
The four Oopses (full traces in the attachment):
- 2026-11-11 19:04:40, 6.18.60, kworker (delayed_fput): NULL deref at 0x248, dma_release_from_dev_coherent <- dma_free_attrs <- vb2_dc_put <- vb2_dc_dmabuf_ops_release <- dma_buf_release <- __dentry_kill <- dput <- __fput <- delayed_fput
- 2026-11-12 11:40:58, 6.18.60, Chromium ThreadPoolSingl: NULL deref at 0x40, mutex_lock <- mmal_vchi_buffer_cleanup <- bcm2835_codec_buffer_cleanup <- __vb2_queue_free <- vb2_core_reqbufs <- vb2_reqbufs <- v4l2_m2m_ioctl_reqbufs <- v4l_reqbufs
- 2026-11-13 15:42:49, 6.18.50, Chromium (close() syscall): same signature as 1 (0x248, vb2_dc_put <- vb2_dc_dmabuf_ops_release <- dma_buf_release), via fput_close_sync / __arm64_sys_close instead of delayed_fput
- 2026-11-23 09:29:32, 6.18.50, kworker (delayed_fput): same signature as 1 (0x248)
My reading is that the firmware returns buffers (buffer_work_cb) while the decoder is being stopped, and the driver then touches state that is already gone. That is an interpretation of the traces, not something I verified in the source.
Consequence of the 2026-11-23 Oops: the last request from the kiosk page was at 10:24:40, about 55 minutes after the Oops. The Chromium GPU process was stuck in D state, could not be killed, load average 1.0 on an otherwise idle CPU:
__flush_work+0x258/0x350
flush_work+0x1c/0x30
__lru_add_drain_all+0x164/0x208
lru_cache_disable+0x68/0x80
alloc_contig_range_noprof+0x210/0x940
__cma_alloc+0x1b4/0x6e0
cma_alloc+0x28/0x40
cma_alloc_aligned+0x4c/0x60
dma_alloc_contiguous+0x38/0x60
dma_direct_alloc+0x118/0x3d0
dma_alloc_attrs+0x94/0x238
drm_gem_dma_create+0xb4/0x160 [drm_dma_helper]
drm_gem_dma_dumb_create_internal+0x60/0x80 [drm_dma_helper]
vc5_dumb_create+0x54/0x68 [vc4]
drm_mode_create_dumb_ioctl+0x98/0xc0 [drm]
After the Oops of 2026-11-11 the display and touch also froze (I did not capture a stack that time). After the Oopses of 11-12 and 11-13 I did not check whether the display froze.
Attached: kernelerror-syslogs.txt (all four Oopses with context), kernelissue-raspinfo-clean.txt (serial number, MAC address and EDID removed).
kernelissue-raspinfo-clean.txt
Additional context
- Frequency: not deterministic. WARNING :2222 without the second warning: 2026-10-14, 10-15, 10-27 (six times between 11:31 and 21:47), 11-09 (05:51, 22:58), 11-11 14:58, 11-16, 11-20 (08:03, 14:37). No videobuf2 WARNING at all between 10-27 and 11-09. My logs start on 2026-10-11.
- The :1187 combination and the Oopses do not appear in my logs before 2026-11-11 (10-11 to 11-10). On 2026-11-08 I updated several things at once (kernel 6.18.50 -> 6.18.60, Chromium 155 -> 156, Mesa 26.2.2 -> 26.2.6). Rolling back the kernel to 6.18.50 did not stop the Oopses (11-13, 11-23), so it is not specific to 6.18.60; I cannot tell whether Chromium 156 or Mesa matter.
- Same messages as in #7712: "bcm2835_codec_flush_buffers: Timeout waiting for buffers to be returned - 0 outstanding", 8 times between 2026-10-26 and 2026-11-15 (10-26, 10-30, 11-01, 11-06, 11-12, 11-13 twice, 11-15), on both kernels. I have not tested the patch in #7713. It could be the same race with a more severe outcome here, but I cannot show that.
- #7163 (CM4, MMAL timeouts and videobuf2 warnings when stopping live H.264): I see the same "driver bug ... leaving buffer in active state" lines (on 11-13 and 11-23) and a later comment there reports an Oops. I do not see "timed out waiting for sync completion" messages in my kernel log, so no firmware wedge as described there.
- Also seen: "bcm2835_mmal_vchiq: buffer_work_cb: ... No mmal buffer to pass details" (2026-11-11 15:15 and 15:45) and "vc_sm_cma_vchi_rx_ack: received response 0, throw away..." on most days, also directly before the 11-11 events.
- Not tested: --disable-accelerated-video-decode, other kernel versions, a reproducer without Chromium, the patch in #7713.
- Related: Ubuntu LP #1915411 (similar __vb2_queue_cancel WARNING when stopping bcm2835-codec streams).
- Vorherrschende Sprache
- C
- Sterne
- 13.4k
- Forks
- 5.5k
- Ø Merge
- 2 T. 11 Std.
- Gemergte PRs (30 T.)
- 32
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus raspberrypi/linux
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
raspberrypi/linux#7415 · 2 Kommentare · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
-
rp1-cfe doesn't forward V4L2_EVENT_SOURCE_CHANGE event from csi-2 sensor driver to userspace appOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
raspberrypi/linux#7399 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 82/100
raspberrypi/linux#7357 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
raspberrypi/linux#7054 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 12/100
raspberrypi/linux#7790 · 18 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in raspberrypi/linux
Ähnliche Issues
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Maintainer antworten meist innerhalb von 1 Tag
-
area/build-framework kind/enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
yugabyte/yugabyte-db#39342 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
-
Document the isv:HDFGroup Linux package repositories and signing keyEvtl. vergeben @brtnfld hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
Maintainer antworten meist innerhalb von 1 Tag
-
kind:silent-wrong needs-triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
InauguralSystems/EigenScript#2567 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag