Public bug reported: # Debian bug 报告草稿:webkit2gtk disable-nvidia-dmabuf.patch 在 NVIDIA 下导致 UI 进程空指针崩溃
**提交对象**:Debian(src:webkit2gtk),关联既有 bug https://bugs.debian.org/1039720 (该 bug 引入的 `disable-nvidia-dmabuf.patch`)。Ubuntu 用户可同时在 Launchpad 提。 ## 环境 - Ubuntu 26.04.1(继承 Debian 的 webkit2gtk 打包与该补丁),WebKitGTK 2.52.6-0ubuntu0.26.04.1 - HP Z2 Mini G5,NVIDIA Quadro T1000,驱动 595.84 与 610.57.04 均复现,GNOME Wayland - 复现应用:一个自写的 WebKitGTK 6.0 客户端(加载 kimi.ai) ## 现象 已登录页面在输入框打字(触发页面合成层)后,**UI 进程立即段错误、窗口消失**。 内核日志:`segfault ... in libwebkitgtk-6.0.so.4.16.10[fa4f12,...]`。 ## 符号化栈(Ubuntu debuginfod) ``` #0 WebKit::AcceleratedBackingStore::update(LayerTreeContext const&) ← this == nullptr #1 WebKit::WebPageProxy::enterAcceleratedCompositingMode #2 WebKit::DrawingAreaProxyCoordinatedGraphics::enterAcceleratedCompositingMode #3 WebKit::DrawingAreaProxy::didReceiveMessage (EnterAcceleratedCompositingMode) ``` `webkitWebViewBaseEnterAcceleratedCompositingMode()` 里只有 release 下失效的 `ASSERT(priv->acceleratedBackingStore)`,随后解空指针。 ## 根因(就在这个补丁里) `debian/patches/disable-nvidia-dmabuf.patch` 为规避 NVIDIA 的 DMABuf 问题(webkit #262607), 在 `AcceleratedBackingStore::rendererBufferTransportMode()` 里把 ``` if (isNVIDIA()) return; mode.add(RendererBufferTransportMode::SharedMemory); // ← 被 early-return 跳过 ``` `isNVIDIA()` 的 early-return 放在 `add(SharedMemory)` **之前**,于是 NVIDIA 下连**不碰 dmabuf、本来稳定的共享内存传输**也一并禁掉。后果链: transport 为空 → `checkRequirements()` 假 → `create()` 返回 nullptr → UI 进程 backing store 为空。 而网页仍会因合成层强制进入加速合成、向 UI 进程发 `EnterAcceleratedCompositingMode` → 解空指针崩。 (这也解释了 `WEBKIT_DMABUF_RENDERER_FORCE_SHM` 为何无效——被这个 early-return 短路。) 上游 main 已把 `create()` 重构为返回非空 `Ref<>`,不受影响;问题只在带此补丁的 2.52.x 打包上。 ## 修复(二选一,推荐 A) **A. 最小定向**:把 `if (isNVIDIA()) return;` 移到 `add(SharedMemory)` **之后**、硬件 DMABuf 块之前。 NVIDIA 下保留共享内存传输(不碰 dmabuf、稳定),backing store 不再为空。见附件 patch。 **B. 纵深防御**(可叠加):`webkitWebViewBaseEnter/Update/ExitAcceleratedCompositingMode` 与 snapshot/paint 对空 backing store 做防护,避免任何「backing store 空 + 强制合成」路径崩溃。 ## 附件 - 修复补丁:`~/projects/kimi-gtk4/patches/z2mini-nvidia-shm-keep-and-null-guard.patch`(含 A+B) - 已用此补丁重编 libwebkitgtk-6.0-4 + libjavascriptcoregtk-6.0-1 装机验证:NVIDIA 硬件加速下 真键盘连发多条消息零崩溃、网页进程走 nvidia-eglcore。 ** Affects: webkit2gtk (Ubuntu) Importance: Undecided Assignee: Xiaoyong Yue (xiaoyongyue) Status: New ** Patch added: "z2mini-nvidia-shm-keep-and-null-guard.patch" https://bugs.launchpad.net/bugs/2167164/+attachment/5999789/+files/z2mini-nvidia-shm-keep-and-null-guard.patch ** Changed in: webkit2gtk (Ubuntu) Assignee: (unassigned) => Xiaoyong Yue (xiaoyongyue) -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2167164 Title: disable-nvidia-dmabuf.patch also disables SharedMemory transport, causing null AcceleratedBackingStore SIGSEGV on NVIDIA To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/webkit2gtk/+bug/2167164/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
