Timo Aaltonen pushed to branch debian-unstable at X Strike Force / lib / mesa


Commits:
686a3856 by Daniel van Vugt at 2025-04-08T17:21:38+08:00
Add drisw-Avoid-crashing-when-swrast_loader-NULL.patch

To prevent segfaults on some drivers during startup (LP: #2101817)

- - - - -


2 changed files:

- + debian/patches/drisw-Avoid-crashing-when-swrast_loader-NULL.patch
- debian/patches/series


Changes:

=====================================
debian/patches/drisw-Avoid-crashing-when-swrast_loader-NULL.patch
=====================================
@@ -0,0 +1,52 @@
+From: Daniel van Vugt <[email protected]>
+Date: Fri, 4 Apr 2025 17:41:37 +0800
+Subject: drisw: Avoid crashing when swrast_loader == NULL
+
+This is a blanket fix for all the segfaults in `drisw_init_screen()`
+when `swrast_loader` is NULL, since 1de7c86bc1. A similar more targeted
+fix for vmwgfx can be found in f3b8d7da46 ("egl: never select swrast
+for vmwgfx"). We can safely return NULL because the caller
+`driCreateNewScreen3` handles NULL, as does its own callers.
+
+As this is currently the top crasher of gnome-shell since Ubuntu
+upgraded to Mesa 25 and it seems to be coming from multiple different
+drivers still, we want a universal fix to at least stop the crash
+reports. People can figure out which drivers still need tweaking in
+`dri2_load_driver` or elsewhere later.
+
+Fixes: 1de7c86bc1 ("dri: pass through a type enum for creating screen instead 
of driver_extensions")
+Related: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12678 (radeon)
+Related: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12859 (radeon)
+Related: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12300 (nvidia-drm)
+Related: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12462 (nvidia-drm)
+Bug-Ubuntu: https://bugs.launchpad.net/bugs/2101817
+---
+ src/gallium/frontends/dri/drisw.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/src/gallium/frontends/dri/drisw.c 
b/src/gallium/frontends/dri/drisw.c
+index 4590b57..9bb3088 100644
+--- a/src/gallium/frontends/dri/drisw.c
++++ b/src/gallium/frontends/dri/drisw.c
+@@ -32,6 +32,7 @@
+ #include "util/u_memory.h"
+ #include "util/u_inlines.h"
+ #include "util/box.h"
++#include "util/log.h"
+ #include "pipe/p_context.h"
+ #include "pipe-loader/pipe_loader.h"
+ #include "frontend/drisw_api.h"
+@@ -620,6 +621,13 @@ drisw_init_screen(struct dri_screen *screen, bool 
driver_name_is_inferred)
+ 
+    screen->swrast_no_present = debug_get_option_swrast_no_present();
+ 
++   if (loader == NULL) {
++      /* If you are reading this then dri2_load_driver may need tweaking */
++      mesa_logw("swrast was requested but driver is missing %s",
++                __DRI_SWRAST_LOADER);
++      return NULL;
++   }
++
+    if (loader->base.version >= 4) {
+       if (loader->putImageShm)
+          lf = &drisw_shm_lf;


=====================================
debian/patches/series
=====================================
@@ -6,3 +6,4 @@ gfxstream-add-common-interfaces.diff
 gfxstream-check-device-before-using.diff
 gfxstream-refactor-device-init.diff
 gfxstream-follow-the-semantics-desired-by-distro-VK.diff
+drisw-Avoid-crashing-when-swrast_loader-NULL.patch



View it on GitLab: 
https://salsa.debian.org/xorg-team/lib/mesa/-/commit/686a3856dd5c553a04c1be0bacda31014ef64fe3

-- 
View it on GitLab: 
https://salsa.debian.org/xorg-team/lib/mesa/-/commit/686a3856dd5c553a04c1be0bacda31014ef64fe3
You're receiving this email because of your account on salsa.debian.org.


Reply via email to