Skip to content

Conversation

@stefan11111
Copy link
Contributor

These commit broke glx after server reset.

Turns out that glx does need this one.

Assuming no external modules need this,
it should be fine to keep this in a private header.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
This commit broke glx after server reset.

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
@algrid
Copy link

algrid commented Nov 2, 2025

Do we know what exactly was breaking/why these changes have to be reverted?

@stefan11111
Copy link
Contributor Author

Do we know what exactly was breaking/why these changes have to be reverted?

glx is using the callback linked list in a weird way that is not compatible with the functions we already expose.
I tried fixing the commit, but I couldn't get it to work properly.

@algrid
Copy link

algrid commented Nov 3, 2025

Yeah, the initialisation vndInitCallbackListPtr = &vndInitCallbackList in the old code kind of suggests that some special treatment is expected, but just looking at the code I can’t figure out what’s wrong with those recent changes, it all seems legit…

@stefan11111
Copy link
Contributor Author

Yeah, the initialisation vndInitCallbackListPtr = &vndInitCallbackList in the old code kind of suggests that some special treatment is expected, but just looking at the code I can’t figure out what’s wrong with those recent changes, it all seems legit…

I have not tested this theory, but I think that the old code was clearing the entire linked list except it's head, which was statically allocated, and the new code clears the entire list, which makes the rest of the glx code break.

@stefan11111
Copy link
Contributor Author

stefan11111 commented Nov 3, 2025

As a side note, I looked a bit info whether or not the X server leaks memory after each reset, and found that it leaks about 20 MB of memory for each reset (10GB for 500 resets).

This is what I used to test it (with this patch applied):

#!/bin/sh

COUNT=0

while true; do
    DISPLAY=:0 glxinfo -B > /dev/null 2>/dev/null
    sleep 0.1
    COUNT=$((COUNT+1))
    echo ${COUNT}
done

@metux Do you have any idea what might be leaking so much memory?

@cepelinas9000
Copy link
Contributor

cepelinas9000 commented Nov 3, 2025

I have idea (there are more very small leaks thus i wanted to collect more of them...), if using modesetting, mainly cursor leaking, try this one:

diff --git a/hw/xfree86/drivers/video/modesetting/driver.c b/hw/xfree86/drivers/
video/modesetting/driver.c
index 96c674a0c..124de23c4 100644
--- a/hw/xfree86/drivers/video/modesetting/driver.c
+++ b/hw/xfree86/drivers/video/modesetting/driver.c
@@ -2225,6 +2225,10 @@ CloseScreen(ScreenPtr pScreen)
         ms->drmmode.shadow_fb2 = NULL;
     }
 
+    if (!ms->drmmode.sw_cursor) {
+        xf86_cursors_fini(pScreen);
+    }
+
     drmmode_uevent_fini(pScrn, &ms->drmmode);
 
     drmmode_free_bos(pScrn, &ms->drmmode);

if you have gcc with asan, you can add -Db_sanitize=leak,address build option (downside - by default it takes a while and prints leaks on stderr)

but it something 256kb per reset...

@stefan11111
Copy link
Contributor Author

I have idea (there are more very small leaks thus i wanted to collect more of them...), if using modesetting, mainly cursor leaking, try this one:

diff --git a/hw/xfree86/drivers/video/modesetting/driver.c b/hw/xfree86/drivers/
video/modesetting/driver.c
index 96c674a0c..124de23c4 100644
--- a/hw/xfree86/drivers/video/modesetting/driver.c
+++ b/hw/xfree86/drivers/video/modesetting/driver.c
@@ -2225,6 +2225,10 @@ CloseScreen(ScreenPtr pScreen)
         ms->drmmode.shadow_fb2 = NULL;
     }
 
+    if (!ms->drmmode.sw_cursor) {
+        xf86_cursors_fini(pScreen);
+    }
+
     drmmode_uevent_fini(pScrn, &ms->drmmode);
 
     drmmode_free_bos(pScrn, &ms->drmmode);

if you have gcc with asan, you can add -Db_sanitize=leak,address build option (downside - by default it takes a while and prints leaks on stderr)

Can you make a pr with this patch?

@cepelinas9000
Copy link
Contributor

I have idea (there are more very small leaks thus i wanted to collect more of them...), if using modesetting, mainly cursor leaking, try this one:

diff --git a/hw/xfree86/drivers/video/modesetting/driver.c b/hw/xfree86/drivers/
video/modesetting/driver.c
index 96c674a0c..124de23c4 100644
--- a/hw/xfree86/drivers/video/modesetting/driver.c
+++ b/hw/xfree86/drivers/video/modesetting/driver.c
@@ -2225,6 +2225,10 @@ CloseScreen(ScreenPtr pScreen)
         ms->drmmode.shadow_fb2 = NULL;
     }
 
+    if (!ms->drmmode.sw_cursor) {
+        xf86_cursors_fini(pScreen);
+    }
+
     drmmode_uevent_fini(pScrn, &ms->drmmode);
 
     drmmode_free_bos(pScrn, &ms->drmmode);

if you have gcc with asan, you can add -Db_sanitize=leak,address build option (downside - by default it takes a while and prints leaks on stderr)

Can you make a pr with this patch?

I created #1324

@metux
Copy link
Contributor

metux commented Nov 4, 2025

These commit broke glx after server reset.

how exactly did it break ? what are the symptoms ?

@cepelinas9000
Copy link
Contributor

These commit broke glx after server reset.

how exactly did it break ? what are the symptoms ?

symtom: on second glxinfo when X server resets you will get Error: couldn't find RGB GLX visual or fbconfig:,

0x22a  0 tc  0  16  0 r  y .   5  6  5  0 .  .  0  0  8  0  0  0  0  8 1 .  None
0x22b  0 tc  0  16  0 r  . .   5  6  5  0 .  .  0  0  8  0  0  0  0  8 1 .  None
0x22c  0 dc  0  16  0 r  y .   5  6  5  0 .  .  0  0  8  0  0  0  0  8 1 .  None
0x22d  0 dc  0  16  0 r  . .   5  6  5  0 .  .  0  0  8  0  0  0  0  8 1 .  None
0x22e  0 tc  0  16  0 r  y .   5  6  5  0 .  .  0  0  0  0  0  0  0  8 1 .  None
0x22f  0 tc  0  16  0 r  . .   5  6  5  0 .  .  0  0  0  0  0  0  0  8 1 .  None
0x230  0 dc  0  16  0 r  y .   5  6  5  0 .  .  0  0  0  0  0  0  0  8 1 .  None
0x231  0 dc  0  16  0 r  . .   5  6  5  0 .  .  0  0  0  0  0  0  0  8 1 .  None

localhost # glxinfo 
name of display: :2
Error: couldn't find RGB GLX visual or fbconfig

With this patch it works correctly.

@cepelinas9000
Copy link
Contributor

cepelinas9000 commented Nov 4, 2025

Other symtom GLX extension will be gone:

localhost  # xdpyinfo |grep GLX
    GLX
localhost  # xdpyinfo |grep GLX
localhost  # xdpyinfo |grep GLX

@metux
Copy link
Contributor

metux commented Nov 4, 2025

These commit broke glx after server reset.

how exactly did it break ? what are the symptoms ?

symtom: on second glxinfo when X server resets you will get Error: couldn't find RGB GLX visual or fbconfig:,

0x22a  0 tc  0  16  0 r  y .   5  6  5  0 .  .  0  0  8  0  0  0  0  8 1 .  None
0x22b  0 tc  0  16  0 r  . .   5  6  5  0 .  .  0  0  8  0  0  0  0  8 1 .  None
0x22c  0 dc  0  16  0 r  y .   5  6  5  0 .  .  0  0  8  0  0  0  0  8 1 .  None
0x22d  0 dc  0  16  0 r  . .   5  6  5  0 .  .  0  0  8  0  0  0  0  8 1 .  None
0x22e  0 tc  0  16  0 r  y .   5  6  5  0 .  .  0  0  0  0  0  0  0  8 1 .  None
0x22f  0 tc  0  16  0 r  . .   5  6  5  0 .  .  0  0  0  0  0  0  0  8 1 .  None
0x230  0 dc  0  16  0 r  y .   5  6  5  0 .  .  0  0  0  0  0  0  0  8 1 .  None
0x231  0 dc  0  16  0 r  . .   5  6  5  0 .  .  0  0  0  0  0  0  0  8 1 .  None

localhost # glxinfo 
name of display: :2
Error: couldn't find RGB GLX visual or fbconfig

With this patch it works correctly.

do you have some traffic dump ? which requests exactly are failing ?

@cepelinas9000
Copy link
Contributor

cepelinas9000 commented Nov 4, 2025

As i have asan working, adding it report with running glxinfo 100 times in row:

=================================================================
==817==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 445208 byte(s) in 101 object(s) allocated from:
    #0 0x7ffff7922d7b in calloc /usr/src/debug/sys-devel/gcc-15.2.0/gcc-15.2.0/libsanitizer/asan/asan_malloc_linux.cpp:74
    #1 0x7bfff3ce7f83 in glamor_xv_init ../hw/xfree86/glamor_egl/glamor_xf86_xv.c:133
    #2 0x7ffff655e7ed in ScreenInit ../hw/xfree86/drivers/video/modesetting/driver.c:2059
    #3 0x5555556ddf79 in AddScreen ../dix/dispatch.c:4117
    #4 0x555555a2d91c in InitOutput ../hw/xfree86/common/xf86Init.c:636
    #5 0x5555556ebc24 in dix_main ../dix/main.c:198
    #6 0x7ffff74783fa  (/usr/lib64/libc.so.6+0x273fa)
    #7 0x7fffffffde5a  ([stack]+0x27e5a)

Direct leak of 102400 byte(s) in 400 object(s) allocated from:
    #0 0x7ffff7922d7b in calloc /usr/src/debug/sys-devel/gcc-15.2.0/gcc-15.2.0/libsanitizer/asan/asan_malloc_linux.cpp:74
    #1 0x7ffff6570e7d in drmmode_output_create_resources ../hw/xfree86/drivers/video/modesetting/drmmode_display.c:3376
    #2 0x555555acf10e in xf86RandR12CreateObjects12 ../hw/xfree86/modes/xf86RandR12.c:1765
    #3 0x555555acf10e in xf86RandR12Init12 ../hw/xfree86/modes/xf86RandR12.c:2403
    #4 0x555555acf10e in xf86RandR12Init ../hw/xfree86/modes/xf86RandR12.c:898
    #5 0x555555aa3b01 in xf86CrtcScreenInit ../hw/xfree86/modes/xf86Crtc.c:812
    #6 0x7ffff655e71e in ScreenInit ../hw/xfree86/drivers/video/modesetting/driver.c:2044
    #7 0x5555556ddf79 in AddScreen ../dix/dispatch.c:4117
    #8 0x555555a2d91c in InitOutput ../hw/xfree86/common/xf86Init.c:636
    #9 0x5555556ebc24 in dix_main ../dix/main.c:198
    #10 0x7ffff74783fa  (/usr/lib64/libc.so.6+0x273fa)
    #11 0x7fffffffde5a  ([stack]+0x27e5a)

Direct leak of 86400 byte(s) in 100 object(s) allocated from:
    #0 0x7ffff7922d7b in calloc /usr/src/debug/sys-devel/gcc-15.2.0/gcc-15.2.0/libsanitizer/asan/asan_malloc_linux.cpp:74
    #1 0x5555559f90f6 in cache_formats_and_modifiers ../dri3/dri3_screen.c:186
    #2 0x5555559f90f6 in dri3_get_supported_modifiers ../dri3/dri3_screen.c:233
    #3 0x5555559f4cf5 in proc_dri3_get_supported_modifiers ../dri3/dri3_request.c:363
    #4 0x5555559f7907 in proc_dri3_dispatch ../dri3/dri3_request.c:625
    #5 0x5555556dbfc5 in Dispatch ../dix/dispatch.c:565
    #6 0x5555556ec0f5 in dix_main ../dix/main.c:286
    #7 0x7ffff74783fa  (/usr/lib64/libc.so.6+0x273fa)
    #8 0x7fffffffde5a  ([stack]+0x27e5a)

Direct leak of 8080 byte(s) in 404 object(s) allocated from:
    #0 0x7ffff7922d7b in calloc /usr/src/debug/sys-devel/gcc-15.2.0/gcc-15.2.0/libsanitizer/asan/asan_malloc_linux.cpp:74
    #1 0x7bfff3d3d43e in glamor_create_fbo_from_tex ../glamor/glamor_fbo.c:106
    #2 0x7bfff3ceb0a2 in glamor_set_pixmap_texture ../glamor/glamor.c:126
    #3 0x7bfff3ce31bd in glamor_egl_create_textured_pixmap_from_gbm_bo ../glamor/glamor_egl.c:322
    #4 0x7ffff656d99d in drmmode_set_pixmap_bo ../hw/xfree86/drivers/video/modesetting/drmmode_display.c:3954
    #5 0x7ffff657d162 in drmmode_shadow_fb_create ../hw/xfree86/drivers/video/modesetting/drmmode_display.c:2316
    #6 0x7ffff657efa1 in drmmode_create_tearfree_shadow ../hw/xfree86/drivers/video/modesetting/drmmode_display.c:1651
    #7 0x7ffff657f6dd in drmmode_set_mode_major ../hw/xfree86/drivers/video/modesetting/drmmode_display.c:1725
    #8 0x7ffff6585087 in drmmode_set_desired_modes ../hw/xfree86/drivers/video/modesetting/drmmode_display.c:4358
    #9 0x5555556ed904 in BlockHandler ../dix/dixutils.c:353
    #10 0x5555559c3e0e in WaitForSomething ../os/WaitFor.c:199
    #11 0x5555556db41e in Dispatch ../dix/dispatch.c:496
    #12 0x5555556ec0f5 in dix_main ../dix/main.c:286
    #13 0x7ffff74783fa  (/usr/lib64/libc.so.6+0x273fa)
    #14 0x7fffffffde5a  ([stack]+0x27e5a)

Direct leak of 3232 byte(s) in 101 object(s) allocated from:
    #0 0x7ffff7922d7b in calloc /usr/src/debug/sys-devel/gcc-15.2.0/gcc-15.2.0/libsanitizer/asan/asan_malloc_linux.cpp:74
    #1 0x555555a08c89 in GlxGetClientData ../glx/vndext.c:146
    #2 0x555555a09d3b in GlxGetVendorForScreen ../glx/vndservermapping.c:218
    #3 0x555555a093ea in GlxExtensionInit ../glx/vndext.c:247
    #4 0x555555626ccf in InitExtensions ../mi/miinitext.c:267
    #5 0x5555556ebc82 in dix_main ../dix/main.c:204
    #6 0x7ffff74783fa  (/usr/lib64/libc.so.6+0x273fa)
    #7 0x7fffffffde5a  ([stack]+0x27e5a)

Direct leak of 2424 byte(s) in 101 object(s) allocated from:
    #0 0x7ffff7922d7b in calloc /usr/src/debug/sys-devel/gcc-15.2.0/gcc-15.2.0/libsanitizer/asan/asan_malloc_linux.cpp:74
    #1 0x5555558b2093 in miSyncFdScreenInit ../miext/sync/misyncfd.c:86
    #2 0x5555558b2a6b in miSyncShmScreenInit ../miext/sync/misyncshm.c:171
    #3 0x7bfff3d40961 in glamor_sync_init ../glamor/glamor_sync.c:97
    #4 0x7bfff3ced7b3 in glamor_init ../glamor/glamor.c:895
    #5 0x7ffff6584bd6 in drmmode_init ../hw/xfree86/drivers/video/modesetting/drmmode_display.c:4281
    #6 0x7ffff655e305 in ScreenInit ../hw/xfree86/drivers/video/modesetting/driver.c:1971
    #7 0x5555556ddf79 in AddScreen ../dix/dispatch.c:4117
    #8 0x555555a2d91c in InitOutput ../hw/xfree86/common/xf86Init.c:636
    #9 0x5555556ebc24 in dix_main ../dix/main.c:198
    #10 0x7ffff74783fa  (/usr/lib64/libc.so.6+0x273fa)
    #11 0x7fffffffde5a  ([stack]+0x27e5a)

Direct leak of 2000 byte(s) in 100 object(s) allocated from:
    #0 0x7ffff791c9db in strdup /usr/src/debug/sys-devel/gcc-15.2.0/gcc-15.2.0/libsanitizer/asan/asan_interceptors.cpp:593
    #1 0x7ffff7633bfc in drmGetMinorNameForFD ../libdrm-2.4.125/xf86drm.c:3446
    #2 0x447265646e65722e  (<unknown module>)

Direct leak of 1515 byte(s) in 101 object(s) allocated from:
    #0 0x7ffff791c9db in strdup /usr/src/debug/sys-devel/gcc-15.2.0/gcc-15.2.0/libsanitizer/asan/asan_interceptors.cpp:593
    #1 0x7ffff76373b2 in drmGetDeviceNameFromFd ../libdrm-2.4.125/xf86drm.c:3316
    #2 0x31647261632e  (<unknown module>)

Direct leak of 808 byte(s) in 101 object(s) allocated from:
    #0 0x7ffff791c9db in strdup /usr/src/debug/sys-devel/gcc-15.2.0/gcc-15.2.0/libsanitizer/asan/asan_interceptors.cpp:593
    #1 0x555555b62c71 in dri2_probe_driver_name ../hw/xfree86/dri2/dri2.c:1477
    #2 0x555555b62c71 in DRI2ScreenInit ../hw/xfree86/dri2/dri2.c:1614
    #3 0x7ffff655bf90 in ms_dri2_screen_init ../hw/xfree86/drivers/video/modesetting/dri2.c:1101
    #4 0x7ffff655ee17 in ScreenInit ../hw/xfree86/drivers/video/modesetting/driver.c:2079
    #5 0x5555556ddf79 in AddScreen ../dix/dispatch.c:4117
    #6 0x555555a2d91c in InitOutput ../hw/xfree86/common/xf86Init.c:636
    #7 0x5555556ebc24 in dix_main ../dix/main.c:198
    #8 0x7ffff74783fa  (/usr/lib64/libc.so.6+0x273fa)
    #9 0x7fffffffde5a  ([stack]+0x27e5a)

Direct leak of 176 byte(s) in 1 object(s) allocated from:
    #0 0x7ffff7922d7b in calloc /usr/src/debug/sys-devel/gcc-15.2.0/gcc-15.2.0/libsanitizer/asan/asan_malloc_linux.cpp:74
    #1 0x7bfff39b39be in dbus_message_new_empty_header ../dbus-1.16.2/dbus/dbus-message.c:1263

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x7ffff7922d7b in calloc /usr/src/debug/sys-devel/gcc-15.2.0/gcc-15.2.0/libsanitizer/asan/asan_malloc_linux.cpp:74
    #1 0x555555a90edc in LoadModule ../hw/xfree86/loader/loadmod.c:706
    #2 0x555555a2cf22 in xf86LoadModules ../hw/xfree86/common/xf86Init.c:1283
    #3 0x555555a2e5d6 in InitOutput ../hw/xfree86/common/xf86Init.c:363
    #4 0x5555556ebc24 in dix_main ../dix/main.c:198
    #5 0x7ffff74783fa  (/usr/lib64/libc.so.6+0x273fa)
    #6 0x7fffffffde5a  ([stack]+0x27e5a)

Direct leak of 56 byte(s) in 1 object(s) allocated from:
    #0 0x7ffff7922d7b in calloc /usr/src/debug/sys-devel/gcc-15.2.0/gcc-15.2.0/libsanitizer/asan/asan_malloc_linux.cpp:74
    #1 0x7ffff7f8d872 in pci_system_linux_sysfs_create ../libpciaccess-0.18.1/src/linux_sysfs.c:100
    #2 0x555555a799cf in xf86platformProbe ../hw/xfree86/common/xf86platformBus.c:268
    #3 0x555555a0ee0c in xf86BusProbe ../hw/xfree86/common/xf86Bus.c:248
    #4 0x555555a2e54b in InitOutput ../hw/xfree86/common/xf86Init.c:345
    #5 0x5555556ebc24 in dix_main ../dix/main.c:198
    #6 0x7ffff74783fa  (/usr/lib64/libc.so.6+0x273fa)
    #7 0x7fffffffde5a  ([stack]+0x27e5a)

Direct leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x7ffff792344b in malloc /usr/src/debug/sys-devel/gcc-15.2.0/gcc-15.2.0/libsanitizer/asan/asan_malloc_linux.cpp:67
    #1 0x7ffff75581d9 in tsearch (/usr/lib64/libc.so.6+0x1071d9)

Indirect leak of 561600 byte(s) in 5400 object(s) allocated from:
    #0 0x7ffff7922d7b in calloc /usr/src/debug/sys-devel/gcc-15.2.0/gcc-15.2.0/libsanitizer/asan/asan_malloc_linux.cpp:74
    #1 0x7bfff3ce1c16 in glamor_get_modifiers ../glamor/glamor_egl.c:847
    #2 0x5555559f9258 in cache_formats_and_modifiers ../dri3/dri3_screen.c:195
    #3 0x5555559f9258 in dri3_get_supported_modifiers ../dri3/dri3_screen.c:233
    #4 0x5555559f4cf5 in proc_dri3_get_supported_modifiers ../dri3/dri3_request.c:363
    #5 0x5555559f7907 in proc_dri3_dispatch ../dri3/dri3_request.c:625
    #6 0x5555556dbfc5 in Dispatch ../dix/dispatch.c:565
    #7 0x5555556ec0f5 in dix_main ../dix/main.c:286
    #8 0x7ffff74783fa  (/usr/lib64/libc.so.6+0x273fa)
    #9 0x7fffffffde5a  ([stack]+0x27e5a)

Indirect leak of 140800 byte(s) in 1600 object(s) allocated from:
    #0 0x7ffff7922d7b in calloc /usr/src/debug/sys-devel/gcc-15.2.0/gcc-15.2.0/libsanitizer/asan/asan_malloc_linux.cpp:74
    #1 0x7ffff763abf9 in drmModeGetProperty ../libdrm-2.4.125/xf86drmMode.c:695
    #2 0x7ffff65710d4 in drmmode_output_create_resources ../hw/xfree86/drivers/video/modesetting/drmmode_display.c:3382
    #3 0x555555acf10e in xf86RandR12CreateObjects12 ../hw/xfree86/modes/xf86RandR12.c:1765
    #4 0x555555acf10e in xf86RandR12Init12 ../hw/xfree86/modes/xf86RandR12.c:2403
    #5 0x555555acf10e in xf86RandR12Init ../hw/xfree86/modes/xf86RandR12.c:898
    #6 0x555555aa3b01 in xf86CrtcScreenInit ../hw/xfree86/modes/xf86Crtc.c:812
    #7 0x7ffff655e71e in ScreenInit ../hw/xfree86/drivers/video/modesetting/driver.c:2044
    #8 0x5555556ddf79 in AddScreen ../dix/dispatch.c:4117
    #9 0x555555a2d91c in InitOutput ../hw/xfree86/common/xf86Init.c:636
    #10 0x5555556ebc24 in dix_main ../dix/main.c:198
    #11 0x7ffff74783fa  (/usr/lib64/libc.so.6+0x273fa)
    #12 0x7fffffffde5a  ([stack]+0x27e5a)

Indirect leak of 80000 byte(s) in 800 object(s) allocated from:
    #0 0x7ffff7922d7b in calloc /usr/src/debug/sys-devel/gcc-15.2.0/gcc-15.2.0/libsanitizer/asan/asan_malloc_linux.cpp:74
    #1 0x7ffff763addc in drmAllocCpy ../libdrm-2.4.125/xf86drmMode.c:83
    #2 0x7ffff763addc in drmModeGetProperty ../libdrm-2.4.125/xf86drmMode.c:706
    #3 0x7ffff65710d4 in drmmode_output_create_resources ../hw/xfree86/drivers/video/modesetting/drmmode_display.c:3382
    #4 0x555555acf10e in xf86RandR12CreateObjects12 ../hw/xfree86/modes/xf86RandR12.c:1765
    #5 0x555555acf10e in xf86RandR12Init12 ../hw/xfree86/modes/xf86RandR12.c:2403
    #6 0x555555acf10e in xf86RandR12Init ../hw/xfree86/modes/xf86RandR12.c:898
    #7 0x555555aa3b01 in xf86CrtcScreenInit ../hw/xfree86/modes/xf86Crtc.c:812
    #8 0x7ffff655e71e in ScreenInit ../hw/xfree86/drivers/video/modesetting/driver.c:2044
    #9 0x5555556ddf79 in AddScreen ../dix/dispatch.c:4117
    #10 0x555555a2d91c in InitOutput ../hw/xfree86/common/xf86Init.c:636
    #11 0x5555556ebc24 in dix_main ../dix/main.c:198
    #12 0x7ffff74783fa  (/usr/lib64/libc.so.6+0x273fa)
    #13 0x7fffffffde5a  ([stack]+0x27e5a)

Indirect leak of 28800 byte(s) in 1600 object(s) allocated from:
    #0 0x7ffff7922d7b in calloc /usr/src/debug/sys-devel/gcc-15.2.0/gcc-15.2.0/libsanitizer/asan/asan_malloc_linux.cpp:74
    #1 0x7ffff763ae45 in drmAllocCpy ../libdrm-2.4.125/xf86drmMode.c:83
    #2 0x7ffff763ae45 in drmModeGetProperty ../libdrm-2.4.125/xf86drmMode.c:703
    #3 0x7ffff65710d4 in drmmode_output_create_resources ../hw/xfree86/drivers/video/modesetting/drmmode_display.c:3382
    #4 0x555555acf10e in xf86RandR12CreateObjects12 ../hw/xfree86/modes/xf86RandR12.c:1765
    #5 0x555555acf10e in xf86RandR12Init12 ../hw/xfree86/modes/xf86RandR12.c:2403
    #6 0x555555acf10e in xf86RandR12Init ../hw/xfree86/modes/xf86RandR12.c:898
    #7 0x555555aa3b01 in xf86CrtcScreenInit ../hw/xfree86/modes/xf86Crtc.c:812
    #8 0x7ffff655e71e in ScreenInit ../hw/xfree86/drivers/video/modesetting/driver.c:2044
    #9 0x5555556ddf79 in AddScreen ../dix/dispatch.c:4117
    #10 0x555555a2d91c in InitOutput ../hw/xfree86/common/xf86Init.c:636
    #11 0x5555556ebc24 in dix_main ../dix/main.c:198
    #12 0x7ffff74783fa  (/usr/lib64/libc.so.6+0x273fa)
    #13 0x7fffffffde5a  ([stack]+0x27e5a)

Indirect leak of 11200 byte(s) in 800 object(s) allocated from:
    #0 0x7ffff7922d7b in calloc /usr/src/debug/sys-devel/gcc-15.2.0/gcc-15.2.0/libsanitizer/asan/asan_malloc_linux.cpp:74
    #1 0x7ffff6571693 in drmmode_output_create_resources ../hw/xfree86/drivers/video/modesetting/drmmode_display.c:3476
    #2 0x555555acf10e in xf86RandR12CreateObjects12 ../hw/xfree86/modes/xf86RandR12.c:1765
    #3 0x555555acf10e in xf86RandR12Init12 ../hw/xfree86/modes/xf86RandR12.c:2403
    #4 0x555555acf10e in xf86RandR12Init ../hw/xfree86/modes/xf86RandR12.c:898
    #5 0x555555aa3b01 in xf86CrtcScreenInit ../hw/xfree86/modes/xf86Crtc.c:812
    #6 0x7ffff655e71e in ScreenInit ../hw/xfree86/drivers/video/modesetting/driver.c:2044
    #7 0x5555556ddf79 in AddScreen ../dix/dispatch.c:4117
    #8 0x555555a2d91c in InitOutput ../hw/xfree86/common/xf86Init.c:636
    #9 0x5555556ebc24 in dix_main ../dix/main.c:198
    #10 0x7ffff74783fa  (/usr/lib64/libc.so.6+0x273fa)
    #11 0x7fffffffde5a  ([stack]+0x27e5a)

Indirect leak of 3200 byte(s) in 800 object(s) allocated from:
    #0 0x7ffff7922d7b in calloc /usr/src/debug/sys-devel/gcc-15.2.0/gcc-15.2.0/libsanitizer/asan/asan_malloc_linux.cpp:74
    #1 0x7ffff657139a in drmmode_output_create_resources ../hw/xfree86/drivers/video/modesetting/drmmode_display.c:3451
    #2 0x555555acf10e in xf86RandR12CreateObjects12 ../hw/xfree86/modes/xf86RandR12.c:1765
    #3 0x555555acf10e in xf86RandR12Init12 ../hw/xfree86/modes/xf86RandR12.c:2403
    #4 0x555555acf10e in xf86RandR12Init ../hw/xfree86/modes/xf86RandR12.c:898
    #5 0x555555aa3b01 in xf86CrtcScreenInit ../hw/xfree86/modes/xf86Crtc.c:812
    #6 0x7ffff655e71e in ScreenInit ../hw/xfree86/drivers/video/modesetting/driver.c:2044
    #7 0x5555556ddf79 in AddScreen ../dix/dispatch.c:4117
    #8 0x555555a2d91c in InitOutput ../hw/xfree86/common/xf86Init.c:636
    #9 0x5555556ebc24 in dix_main ../dix/main.c:198
    #10 0x7ffff74783fa  (/usr/lib64/libc.so.6+0x273fa)
    #11 0x7fffffffde5a  ([stack]+0x27e5a)

Indirect leak of 744 byte(s) in 2 object(s) allocated from:
    #0 0x7ffff792220b in realloc /usr/src/debug/sys-devel/gcc-15.2.0/gcc-15.2.0/libsanitizer/asan/asan_malloc_linux.cpp:81
    #1 0x7bfff39c555e in reallocate_for_length ../dbus-1.16.2/dbus/dbus-string.c:397
    #2 0x7bfff39c555e in set_length ../dbus-1.16.2/dbus/dbus-string.c:438

SUMMARY: AddressSanitizer: 1478731 byte(s) leaked in 12515 allocation(s).

note: this report after pressing ctrl-c on xserver, not every leak here have impact

@algrid
Copy link

algrid commented Nov 4, 2025

I’m not 100% sure, but my guess is that we shouldn’t delete the callback list completely there. We need to keep the 1st callback in the list. That’s because glxServer has .extensionInitCallback = &vndInitCallbackListPtr and the first (probably) callback that’s added is xorgGlxServerInit (see xorgGlxCreateVendor). We need to keep that callback (with the old code it’s always kept because it’s declared as a separate variable and we keep a pointer to it as the head of the list).

At least that’s my working theory…

@stefan11111
Copy link
Contributor Author

These commit broke glx after server reset.

how exactly did it break ? what are the symptoms ?

On my setup, running glxinfo after server reset makes it report that there is no working glx on any of the screens.

@algrid
Copy link

algrid commented Nov 5, 2025

As an alternative to this PR we could try re-adding the xorgGlxServerInit callback right after the DeleteCallbackList call.

@stefan11111
Copy link
Contributor Author

As an alternative to this PR we could try re-adding the xorgGlxServerInit callback right after the DeleteCallbackList call.

Can you make a pr?

@algrid
Copy link

algrid commented Nov 6, 2025

As an alternative to this PR we could try re-adding the xorgGlxServerInit callback right after the DeleteCallbackList call.

Can you make a pr?

I can try, but I’m not sure when I will have time for that. So I am ok if anyone else does something like that, or even merging the current fix (reverting previous changes) and maybe returning to it later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants