NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
xsrc/60025: 11.0_BETA+: glxinfo (or any Mesa app in swrast mode) crashes on exit with SIGSEGV
>Number: 60025
>Category: xsrc
>Synopsis: 11.0_BETA+: glxinfo (or any Mesa app in swrast mode) crashes on exit with SIGSEGV
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: xsrc-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Feb 21 17:20:00 +0000 2026
>Originator: Henryk Paluch
>Release: NetBSD 11.0_BETA or later (also RC1 affected)
>Organization:
N/A
>Environment:
NetBSD nbsd-sgate350.example.com 11.0_BETA NetBSD 11.0_BETA (GENERIC)
>Description:
Please see complete Mailing list thread: https://marc.info/?l=netbsd-users&m=176604430720235&w=2
Problem: any program using new Mesa in "swrast" mode (no HW acceleration) from
(xsrc/external/mit/MesaLib/dist/src/mesa/main/context.c r1.9), including NetBSD 11.0_BETA (or latest RC1) will crash on exit, because Mesa now calls atexit(3) from dlopen(3) DSO that is not supported in NetBSD.
In base system this affects at least:
- glxinfo
- glxgears
>How-To-Repeat:
You need:
* NetBSD 11.0_BETA or later, including 11.0_RC1 (one that includes commit from: xsrc/external/mit/MesaLib/dist/src/mesa/main/context.c r1.9)
* X11 environment in "swrast" mode (without acceleration)
Run any application using Mesa, for example glxinfo or glxgears. It will always crash on exit with SIGSEGV.
Example:
$ uname -a
NetBSD nbsd-sgate350.example.com 11.0_BETA NetBSD 11.0_BETA (GENERIC)
#0: Sun Dec 14 14:19:17 UTC 2025 mkrepro@mkrepro.
NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64
$ glxinfo
name of display: :0
display: :0 screen: 0
direct rendering: Yes
server glx vendor string: SGI
server glx version string: 1.4
server glx extensions:
(lot of output)
0x388 32 tc 0 32 0 r y . 8 8 8 8 . s 0 32 0 0 0 0 0 0 0
None
[1] Segmentation fault (core dumped) glxinfo
$ gdb glxinfo glxinfo.core
Reading symbols from glxinfo...
Reading symbols from /usr/libdata/debug//usr/X11R7/bin/glxinfo.debug...
[New process 1979]
Core was generated by `glxinfo'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00007b60f1d01eb3 in ?? ()
+bt
#0 0x00007b60f1d01eb3 in ?? ()
#1 0x00007b60f6b1795f in __cxa_finalize (dso=dso@entry=0x0) at
/usr/src/lib/libc/stdlib/atexit.c:222
#2 0x00007b60f6b1753b in exit (status=0) at
/usr/src/lib/libc/stdlib/exit.c:60
#3 0x0000000000b696d2 in ___start (cleanup=<optimized out>,
ps_strings=0x7f7fff6dcfe0) at /usr/src/lib/csu/common/crt0-common.c:375
#4 0x00007f7ff77f08a8 in ?? () from /usr/libexec/ld.elf_so
#5 0x0000000000000001 in ?? ()
#6 0x00007f7fff6dc120 in ?? ()
#7 0x0000000000000000 in ?? ()
+q
Please note that stacktrace makes no sense at first sight. It was only found by RVP that it is, because atexit(3) handler registered in dlopen(3)ed library is called too late - long after dlclose(3) - at the moment when such library is no longer mapped to memory. That's is reason why such address has no symbols and casues SIGSEGV.
>Fix:
There was long discussion what is proper fix:
1. changing atexit(3) behavior to work properly when called with dlopen(3) so libraries (as done in Linux an other BSDs)
2. replace atexit(3) in Mesa with supported dtor construct
Later option won and there was proposed patch by RVP that fixes this problem:
- from https://marc.info/?l=netbsd-users&m=176644672910756&w=2
```
diff -urN a/xsrc/external/mit/MesaLib/dist/src/mesa/main/context.c \
b/xsrc/external/mit/MesaLib/dist/src/mesa/main/context.c
--- a/xsrc/external/mit/MesaLib/dist/src/mesa/main/context.c 2022-05-09 \
01:27:38.000000000 +0000
+++ b/xsrc/external/mit/MesaLib/dist/src/mesa/main/context.c 2025-12-22 \
22:39:24.502696165 +0000 @@ -256,14 +256,11 @@
* Calls all the various one-time-fini functions in Mesa
*/
-static GLbitfield api_init_mask = 0x0;
static void __attribute__((__destructor__))
one_time_fini(void)
{
- if (api_init_mask) {
- glsl_type_singleton_decref();
- _mesa_locale_fini();
- }
+ glsl_type_singleton_decref();
+ _mesa_locale_fini();
}
/**
@@ -292,7 +289,9 @@
_mesa_ubyte_to_float_color_tab[i] = (float) i / 255.0F;
}
+#if 0
atexit(one_time_fini);
+#endif
#if defined(DEBUG)
if (MESA_VERBOSE != 0) {
```
RVPs patch was verified on following post: https://marc.info/?l=netbsd-users&m=176650588111131&w=2
My suggestion is to use RPV's solution so we can fix this problem (that affects everybody with any Mesa application with swrast driver) before final 11.0 RELEASE.
Again, please see whole mailing list thread for details: https://marc.info/?t=176604443000001&r=1&w=2
Home |
Main Index |
Thread Index |
Old Index