Segmentation fault on renderer creation with WSLg
With SDL2, creating a software renderer using SDL_CreateRenderer(window, -1, SDL_RENDERER_SOFTWARE) causes a segmentation fault on ArchWSL with WSLg on WSL 2, while the expected behaviour would (probably) be to fail with an error.
As found by the original issue reporter, creating /etc/tmpfiles.d/wslg.conf with the following content then restarting the WSL session solves the problem (source):
# Type Path Mode UID GID Age Argument
L+ /tmp/.X11-unix - - - - /mnt/wslg/.X11-unix
However the program still shouldn't have segfaulted, and should have just printed Couldn't create the renderer: xyz then exited.
A minimal program to produce the crash is the following:
sdl2_crash.c
/* Compile with `gcc sdl2_crash.c -g $(pkg-config sdl2 --cflags --libs)` */
#include <SDL.h>
int main() {
int ret = 1;
int sdl_initialized = 0;
SDL_Window *window = NULL;
SDL_Renderer *renderer = NULL;
SDL_Texture *texture = NULL;
SDL_Event event;
Uint32 *pixels;
int pitch;
int i;
if (SDL_InitSubSystem(SDL_INIT_VIDEO | SDL_INIT_EVENTS)) {
fprintf(stderr, "Failed to initialize SDL: %s\n", SDL_GetError());
goto fail;
}
sdl_initialized = 1;
window = SDL_CreateWindow(
"renderer crash on WSL",
SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
128,
64,
0
);
if (!window) {
fprintf(
stderr,
"Couldn't create the window: %s\n",
SDL_GetError()
);
goto fail;
}
/* Then let's create the renderer. */
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_SOFTWARE);
if (!renderer) {
fprintf(
stderr,
"Couldn't create the renderer: %s\n",
SDL_GetError()
);
goto fail;
}
texture = SDL_CreateTexture(
renderer,
SDL_PIXELFORMAT_ARGB8888,
SDL_TEXTUREACCESS_STREAMING,
128,
64
);
if (!texture) {
fprintf(
stderr,
"Couldn't create the texture: %s\n",
SDL_GetError()
);
return 1;
}
SDL_LockTexture(
texture,
NULL,
(void **)&pixels,
&pitch
);
for (i = 128 * 64 - 1; i >= 0; i--)
pixels[i] = 0xFF0000;
SDL_UnlockTexture(texture);
SDL_RenderCopy(renderer, texture, NULL, NULL);
SDL_RenderPresent(renderer);
while (SDL_WaitEvent(&event)) {
if (event.type == SDL_QUIT) {
ret = 0;
break;
}
}
ret = 0;
fail:
if (texture)
SDL_DestroyTexture(texture);
if (renderer)
SDL_DestroyRenderer(renderer);
if (window)
SDL_DestroyWindow(window);
if (sdl_initialized)
SDL_QuitSubSystem(SDL_INIT_VIDEO | SDL_INIT_EVENTS);
return ret;
}
When run with valgrind --leak-check=full --num-callers=500 ./a.out, the following output is created:
valgrind report of the crash
==2985== Memcheck, a memory error detector
==2985== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al.
==2985== Using Valgrind-3.23.0 and LibVEX; rerun with -h for copyright info
==2985== Command: ./a.out
==2985==
==2985== Conditional jump or move depends on uninitialised value(s)
==2985== at 0x125DD9DC: ??? (in /usr/lib/wsl/lib/libdxcore.so)
==2985== by 0x125DE713: ??? (in /usr/lib/wsl/lib/libdxcore.so)
==2985== by 0x125A090F: ??? (in /usr/lib/wsl/lib/libdxcore.so)
==2985== by 0x125A58B5: ??? (in /usr/lib/wsl/lib/libdxcore.so)
==2985== by 0x125A1AD0: DXCoreCreateAdapterFactory (in /usr/lib/wsl/lib/libdxcore.so)
==2985== by 0x62C799B: get_dxcore_factory (d3d12_dxcore_screen.cpp:53)
==2985== by 0x62C799B: d3d12_init_dxcore_screen(d3d12_screen*) (d3d12_dxcore_screen.cpp:184)
==2985== by 0x62C7F14: d3d12_create_dxcore_screen (d3d12_dxcore_screen.cpp:243)
==2985== by 0x56A1EEE: sw_screen_create_named (sw_helper.h:66)
==2985== by 0x56A1EEE: sw_screen_create_vk (sw_helper.h:90)
==2985== by 0x5DEE6CC: pipe_loader_sw_create_screen (pipe_loader_sw.c:427)
==2985== by 0x5DEE5FF: pipe_loader_create_screen_vk (pipe_loader.c:181)
==2985== by 0x56C926E: drisw_init_screen (drisw.c:603)
==2985== by 0x56D30BF: driCreateNewScreen3 (dri_util.c:140)
==2985== by 0x5639FAD: dri2_create_screen (egl_dri2.c:927)
==2985== by 0x563BB5B: dri2_initialize_device (platform_device.c:365)
==2985== by 0x563A9E8: dri2_initialize (egl_dri2.c:1058)
==2985== by 0x562894B: eglInitialize (eglapi.c:699)
==2985== by 0x4947868: UnknownInlinedFun (SDL_egl.c:623)
==2985== by 0x4947868: UnknownInlinedFun (SDL_offscreenopengles.c:43)
==2985== by 0x4947868: OFFSCREEN_GLES_LoadLibrary (SDL_offscreenopengles.c:31)
==2985== by 0x492FF52: SDL_GL_LoadLibrary_REAL (SDL_video.c:3469)
==2985== by 0x492EBF1: SDL_RecreateWindow (SDL_video.c:1990)
==2985== by 0x48BCAA3: GL_CreateRenderer.lto_priv.0 (SDL_render_gl.c:1728)
==2985== by 0x48B20BE: SDL_CreateRenderer_REAL (SDL_render.c:1028)
==2985== by 0x492BC4D: SDL_CreateWindowTexture.lto_priv.0 (SDL_video.c:267)
==2985== by 0x493036F: UnknownInlinedFun (SDL_video.c:2711)
==2985== by 0x493036F: UnknownInlinedFun (SDL_video.c:2772)
==2985== by 0x493036F: SDL_GetWindowSurface_REAL (SDL_video.c:2761)
==2985== by 0x48DCBBA: SW_CreateRenderer.lto_priv.0 (SDL_render_sw.c:1063)
==2985== by 0x48B24AF: SDL_CreateRenderer_REAL (SDL_render.c:1009)
==2985== by 0x10931B: main (sdl2_crash.c:40)
==2985==
==2985== Conditional jump or move depends on uninitialised value(s)
==2985== at 0x125DE272: ??? (in /usr/lib/wsl/lib/libdxcore.so)
==2985== by 0x125DE713: ??? (in /usr/lib/wsl/lib/libdxcore.so)
==2985== by 0x125A090F: ??? (in /usr/lib/wsl/lib/libdxcore.so)
==2985== by 0x125A58B5: ??? (in /usr/lib/wsl/lib/libdxcore.so)
==2985== by 0x125A1AD0: DXCoreCreateAdapterFactory (in /usr/lib/wsl/lib/libdxcore.so)
==2985== by 0x62C799B: get_dxcore_factory (d3d12_dxcore_screen.cpp:53)
==2985== by 0x62C799B: d3d12_init_dxcore_screen(d3d12_screen*) (d3d12_dxcore_screen.cpp:184)
==2985== by 0x62C7F14: d3d12_create_dxcore_screen (d3d12_dxcore_screen.cpp:243)
==2985== by 0x56A1EEE: sw_screen_create_named (sw_helper.h:66)
==2985== by 0x56A1EEE: sw_screen_create_vk (sw_helper.h:90)
==2985== by 0x5DEE6CC: pipe_loader_sw_create_screen (pipe_loader_sw.c:427)
==2985== by 0x5DEE5FF: pipe_loader_create_screen_vk (pipe_loader.c:181)
==2985== by 0x56C926E: drisw_init_screen (drisw.c:603)
==2985== by 0x56D30BF: driCreateNewScreen3 (dri_util.c:140)
==2985== by 0x5639FAD: dri2_create_screen (egl_dri2.c:927)
==2985== by 0x563BB5B: dri2_initialize_device (platform_device.c:365)
==2985== by 0x563A9E8: dri2_initialize (egl_dri2.c:1058)
==2985== by 0x562894B: eglInitialize (eglapi.c:699)
==2985== by 0x4947868: UnknownInlinedFun (SDL_egl.c:623)
==2985== by 0x4947868: UnknownInlinedFun (SDL_offscreenopengles.c:43)
==2985== by 0x4947868: OFFSCREEN_GLES_LoadLibrary (SDL_offscreenopengles.c:31)
==2985== by 0x492FF52: SDL_GL_LoadLibrary_REAL (SDL_video.c:3469)
==2985== by 0x492EBF1: SDL_RecreateWindow (SDL_video.c:1990)
==2985== by 0x48BCAA3: GL_CreateRenderer.lto_priv.0 (SDL_render_gl.c:1728)
==2985== by 0x48B20BE: SDL_CreateRenderer_REAL (SDL_render.c:1028)
==2985== by 0x492BC4D: SDL_CreateWindowTexture.lto_priv.0 (SDL_video.c:267)
==2985== by 0x493036F: UnknownInlinedFun (SDL_video.c:2711)
==2985== by 0x493036F: UnknownInlinedFun (SDL_video.c:2772)
==2985== by 0x493036F: SDL_GetWindowSurface_REAL (SDL_video.c:2761)
==2985== by 0x48DCBBA: SW_CreateRenderer.lto_priv.0 (SDL_render_sw.c:1063)
==2985== by 0x48B24AF: SDL_CreateRenderer_REAL (SDL_render.c:1009)
==2985== by 0x10931B: main (sdl2_crash.c:40)
==2985==
==2985== Syscall param ioctl(generic) points to uninitialised byte(s)
==2985== at 0x4B49CED: ioctl (ioctl.c:36)
==2985== by 0x12616712: D3DKMTQueryAdapterInfo (in /usr/lib/wsl/lib/libdxcore.so)
==2985== by 0x12A543FA: ??? (in /usr/lib/wsl/lib/libd3d12core.so)
==2985== by 0x12E01452: ??? (in /usr/lib/wsl/drivers/iigd_dch.inf_amd64_9741ef1f4093481f/libigd12umd64.so)
==2985== by 0x12E010D0: OpenAdapter12 (in /usr/lib/wsl/drivers/iigd_dch.inf_amd64_9741ef1f4093481f/libigd12umd64.so)
==2985== by 0x12A67780: ??? (in /usr/lib/wsl/lib/libd3d12core.so)
==2985== by 0x12A536A7: ??? (in /usr/lib/wsl/lib/libd3d12core.so)
==2985== by 0x12982B2B: ??? (in /usr/lib/wsl/lib/libd3d12core.so)
==2985== by 0x1298287F: ??? (in /usr/lib/wsl/lib/libd3d12core.so)
==2985== by 0x12983488: ??? (in /usr/lib/wsl/lib/libd3d12core.so)
==2985== by 0x12984E3F: ??? (in /usr/lib/wsl/lib/libd3d12core.so)
==2985== by 0x1293D962: ??? (in /usr/lib/wsl/lib/libd3d12core.so)
==2985== by 0x62C9849: create_device (d3d12_screen.cpp:1020)
==2985== by 0x62C9849: d3d12_init_screen(d3d12_screen*, IUnknown*) (d3d12_screen.cpp:1557)
==2985== by 0x62C7CCA: d3d12_init_dxcore_screen(d3d12_screen*) (d3d12_dxcore_screen.cpp:220)
==2985== by 0x62C7F14: d3d12_create_dxcore_screen (d3d12_dxcore_screen.cpp:243)
==2985== by 0x56A1EEE: sw_screen_create_named (sw_helper.h:66)
==2985== by 0x56A1EEE: sw_screen_create_vk (sw_helper.h:90)
==2985== by 0x5DEE6CC: pipe_loader_sw_create_screen (pipe_loader_sw.c:427)
==2985== by 0x5DEE5FF: pipe_loader_create_screen_vk (pipe_loader.c:181)
==2985== by 0x56C926E: drisw_init_screen (drisw.c:603)
==2985== by 0x56D30BF: driCreateNewScreen3 (dri_util.c:140)
==2985== by 0x5639FAD: dri2_create_screen (egl_dri2.c:927)
==2985== by 0x563BB5B: dri2_initialize_device (platform_device.c:365)
==2985== by 0x563A9E8: dri2_initialize (egl_dri2.c:1058)
==2985== by 0x562894B: eglInitialize (eglapi.c:699)
==2985== by 0x4947868: UnknownInlinedFun (SDL_egl.c:623)
==2985== by 0x4947868: UnknownInlinedFun (SDL_offscreenopengles.c:43)
==2985== by 0x4947868: OFFSCREEN_GLES_LoadLibrary (SDL_offscreenopengles.c:31)
==2985== by 0x492FF52: SDL_GL_LoadLibrary_REAL (SDL_video.c:3469)
==2985== by 0x492EBF1: SDL_RecreateWindow (SDL_video.c:1990)
==2985== by 0x48BCAA3: GL_CreateRenderer.lto_priv.0 (SDL_render_gl.c:1728)
==2985== by 0x48B20BE: SDL_CreateRenderer_REAL (SDL_render.c:1028)
==2985== by 0x492BC4D: SDL_CreateWindowTexture.lto_priv.0 (SDL_video.c:267)
==2985== by 0x493036F: UnknownInlinedFun (SDL_video.c:2711)
==2985== by 0x493036F: UnknownInlinedFun (SDL_video.c:2772)
==2985== by 0x493036F: SDL_GetWindowSurface_REAL (SDL_video.c:2761)
==2985== by 0x48DCBBA: SW_CreateRenderer.lto_priv.0 (SDL_render_sw.c:1063)
==2985== by 0x48B24AF: SDL_CreateRenderer_REAL (SDL_render.c:1009)
==2985== by 0x10931B: main (sdl2_crash.c:40)
==2985== Address 0x1ffeff8b44 is on thread 1's stack
==2985== in frame #1, created by D3DKMTQueryAdapterInfo (???:)
==2985==
==2985== Syscall param ioctl(generic) points to uninitialised byte(s)
==2985== at 0x4B49CED: ioctl (ioctl.c:36)
==2985== by 0x12616712: D3DKMTQueryAdapterInfo (in /usr/lib/wsl/lib/libdxcore.so)
==2985== by 0x12A543FA: ??? (in /usr/lib/wsl/lib/libd3d12core.so)
==2985== by 0x12E0148B: ??? (in /usr/lib/wsl/drivers/iigd_dch.inf_amd64_9741ef1f4093481f/libigd12umd64.so)
==2985== by 0x12E01107: OpenAdapter12 (in /usr/lib/wsl/drivers/iigd_dch.inf_amd64_9741ef1f4093481f/libigd12umd64.so)
==2985== by 0x12A67780: ??? (in /usr/lib/wsl/lib/libd3d12core.so)
==2985== by 0x12A536A7: ??? (in /usr/lib/wsl/lib/libd3d12core.so)
==2985== by 0x12982B2B: ??? (in /usr/lib/wsl/lib/libd3d12core.so)
==2985== by 0x1298287F: ??? (in /usr/lib/wsl/lib/libd3d12core.so)
==2985== by 0x12983488: ??? (in /usr/lib/wsl/lib/libd3d12core.so)
==2985== by 0x12984E3F: ??? (in /usr/lib/wsl/lib/libd3d12core.so)
==2985== by 0x1293D962: ??? (in /usr/lib/wsl/lib/libd3d12core.so)
==2985== by 0x62C9849: create_device (d3d12_screen.cpp:1020)
==2985== by 0x62C9849: d3d12_init_screen(d3d12_screen*, IUnknown*) (d3d12_screen.cpp:1557)
==2985== by 0x62C7CCA: d3d12_init_dxcore_screen(d3d12_screen*) (d3d12_dxcore_screen.cpp:220)
==2985== by 0x62C7F14: d3d12_create_dxcore_screen (d3d12_dxcore_screen.cpp:243)
==2985== by 0x56A1EEE: sw_screen_create_named (sw_helper.h:66)
==2985== by 0x56A1EEE: sw_screen_create_vk (sw_helper.h:90)
==2985== by 0x5DEE6CC: pipe_loader_sw_create_screen (pipe_loader_sw.c:427)
==2985== by 0x5DEE5FF: pipe_loader_create_screen_vk (pipe_loader.c:181)
==2985== by 0x56C926E: drisw_init_screen (drisw.c:603)
==2985== by 0x56D30BF: driCreateNewScreen3 (dri_util.c:140)
==2985== by 0x5639FAD: dri2_create_screen (egl_dri2.c:927)
==2985== by 0x563BB5B: dri2_initialize_device (platform_device.c:365)
==2985== by 0x563A9E8: dri2_initialize (egl_dri2.c:1058)
==2985== by 0x562894B: eglInitialize (eglapi.c:699)
==2985== by 0x4947868: UnknownInlinedFun (SDL_egl.c:623)
==2985== by 0x4947868: UnknownInlinedFun (SDL_offscreenopengles.c:43)
==2985== by 0x4947868: OFFSCREEN_GLES_LoadLibrary (SDL_offscreenopengles.c:31)
==2985== by 0x492FF52: SDL_GL_LoadLibrary_REAL (SDL_video.c:3469)
==2985== by 0x492EBF1: SDL_RecreateWindow (SDL_video.c:1990)
==2985== by 0x48BCAA3: GL_CreateRenderer.lto_priv.0 (SDL_render_gl.c:1728)
==2985== by 0x48B20BE: SDL_CreateRenderer_REAL (SDL_render.c:1028)
==2985== by 0x492BC4D: SDL_CreateWindowTexture.lto_priv.0 (SDL_video.c:267)
==2985== by 0x493036F: UnknownInlinedFun (SDL_video.c:2711)
==2985== by 0x493036F: UnknownInlinedFun (SDL_video.c:2772)
==2985== by 0x493036F: SDL_GetWindowSurface_REAL (SDL_video.c:2761)
==2985== by 0x48DCBBA: SW_CreateRenderer.lto_priv.0 (SDL_render_sw.c:1063)
==2985== by 0x48B24AF: SDL_CreateRenderer_REAL (SDL_render.c:1009)
==2985== by 0x10931B: main (sdl2_crash.c:40)
==2985== Address 0x1ffeff8b44 is on thread 1's stack
==2985== in frame #1, created by D3DKMTQueryAdapterInfo (???:)
==2985==
==2985== Warning: invalid file descriptor -1 in syscall close()
==2985==
==2985== HEAP SUMMARY:
==2985== in use at exit: 354,590 bytes in 2,471 blocks
==2985== total heap usage: 102,856 allocs, 100,385 frees, 77,655,799 bytes allocated
==2985==
==2985== 112 (56 direct, 56 indirect) bytes in 1 blocks are definitely lost in loss record 2,311 of 2,371
==2985== at 0x484BC13: calloc (vg_replace_malloc.c:1675)
==2985== by 0x637365E: ???
==2985== by 0x5DEE1F4: ???
==2985== by 0x5DD6711: ???
==2985== by 0x5DD68F7: ???
==2985== by 0x5D81766: ???
==2985== by 0x5D84621: ???
==2985== by 0x5D7EFF5: ???
==2985== by 0x5D20500: ???
==2985== by 0x5D67AB9: ???
==2985== by 0x5D633A8: ???
==2985== by 0x5CEDB02: ???
==2985== by 0x5CE6529: ???
==2985== by 0x5CE69A7: ???
==2985== by 0x5CE6E6C: ???
==2985== by 0x5E16497: ???
==2985== by 0x593F306: ???
==2985== by 0x48BB534: GL_RunCommandQueue (SDL_render_gl.c:1374)
==2985== by 0x48AEB70: FlushRenderCommands.lto_priv.0 (SDL_render.c:249)
==2985== by 0x48B57D7: UnknownInlinedFun (SDL_render.c:278)
==2985== by 0x48B57D7: SDL_RenderCopyF_REAL (SDL_render.c:3509)
==2985== by 0x492AFD4: UnknownInlinedFun (SDL_render.c:3404)
==2985== by 0x492AFD4: SDL_UpdateWindowTexture.lto_priv.0 (SDL_video.c:374)
==2985== by 0x492FD73: SDL_UpdateWindowSurface_REAL (SDL_video.c:2791)
==2985== by 0x48B7B6D: UnknownInlinedFun (SDL_render.c:4269)
==2985== by 0x48B7B6D: SDL_RenderPresent_REAL (SDL_render.c:4255)
==2985== by 0x109422: main (sdl2_crash.c:78)
==2985==
==2985== 512 bytes in 1 blocks are possibly lost in loss record 2,347 of 2,371
==2985== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==2985== by 0x40112F0: malloc (rtld-malloc.h:56)
==2985== by 0x40112F0: _dl_resize_dtv (dl-tls.c:527)
==2985== by 0x4011C71: _dl_update_slotinfo (dl-tls.c:849)
==2985== by 0x4011DA3: update_get_addr (dl-tls.c:967)
==2985== by 0x4014C9B: __tls_get_addr (tls_get_addr.S:55)
==2985== by 0x10100F54: __cxa_get_globals (eh_globals.cc:62)
==2985== by 0x101021C0: __cxa_throw (eh_throw.cc:83)
==2985== by 0x1327A160: ???
==2985== by 0x1327114B: ???
==2985== by 0x1326F4CB: ???
==2985== by 0x13241E2E: ???
==2985== by 0x12E012C4: ???
==2985== by 0x12E0115C: ???
==2985== by 0x12A67780: ???
==2985== by 0x12A536A7: ???
==2985== by 0x12982B2B: ???
==2985== by 0x1298287F: ???
==2985== by 0x12983488: ???
==2985== by 0x12984E3F: ???
==2985== by 0x1293D962: ???
==2985== by 0x62C9849: ???
==2985== by 0x62C7CCA: ???
==2985== by 0x62C7F14: ???
==2985== by 0x56A1EEE: ???
==2985== by 0x5DEE6CC: ???
==2985== by 0x5DEE5FF: ???
==2985== by 0x56C926E: ???
==2985== by 0x56D30BF: ???
==2985== by 0x5639FAD: ???
==2985== by 0x563BB5B: ???
==2985== by 0x563A9E8: ???
==2985== by 0x562894B: ???
==2985== by 0x4947868: UnknownInlinedFun (SDL_egl.c:623)
==2985== by 0x4947868: UnknownInlinedFun (SDL_offscreenopengles.c:43)
==2985== by 0x4947868: OFFSCREEN_GLES_LoadLibrary (SDL_offscreenopengles.c:31)
==2985== by 0x492FF52: SDL_GL_LoadLibrary_REAL (SDL_video.c:3469)
==2985== by 0x492EBF1: SDL_RecreateWindow (SDL_video.c:1990)
==2985== by 0x48BCAA3: GL_CreateRenderer.lto_priv.0 (SDL_render_gl.c:1728)
==2985== by 0x48B20BE: SDL_CreateRenderer_REAL (SDL_render.c:1028)
==2985== by 0x492BC4D: SDL_CreateWindowTexture.lto_priv.0 (SDL_video.c:267)
==2985== by 0x493036F: UnknownInlinedFun (SDL_video.c:2711)
==2985== by 0x493036F: UnknownInlinedFun (SDL_video.c:2772)
==2985== by 0x493036F: SDL_GetWindowSurface_REAL (SDL_video.c:2761)
==2985== by 0x48DCBBA: SW_CreateRenderer.lto_priv.0 (SDL_render_sw.c:1063)
==2985== by 0x48B24AF: SDL_CreateRenderer_REAL (SDL_render.c:1009)
==2985== by 0x10931B: main (sdl2_crash.c:40)
==2985==
==2985== 2,688 bytes in 1 blocks are definitely lost in loss record 2,360 of 2,371
==2985== at 0x484BC13: calloc (vg_replace_malloc.c:1675)
==2985== by 0x5633D2F: ???
==2985== by 0x56346BE: ???
==2985== by 0x5613941: ???
==2985== by 0x494784F: UnknownInlinedFun (SDL_egl.c:617)
==2985== by 0x494784F: UnknownInlinedFun (SDL_offscreenopengles.c:43)
==2985== by 0x494784F: OFFSCREEN_GLES_LoadLibrary (SDL_offscreenopengles.c:31)
==2985== by 0x492FF52: SDL_GL_LoadLibrary_REAL (SDL_video.c:3469)
==2985== by 0x492EBF1: SDL_RecreateWindow (SDL_video.c:1990)
==2985== by 0x48BCAA3: GL_CreateRenderer.lto_priv.0 (SDL_render_gl.c:1728)
==2985== by 0x48B20BE: SDL_CreateRenderer_REAL (SDL_render.c:1028)
==2985== by 0x492BC4D: SDL_CreateWindowTexture.lto_priv.0 (SDL_video.c:267)
==2985== by 0x493036F: UnknownInlinedFun (SDL_video.c:2711)
==2985== by 0x493036F: UnknownInlinedFun (SDL_video.c:2772)
==2985== by 0x493036F: SDL_GetWindowSurface_REAL (SDL_video.c:2761)
==2985== by 0x48DCBBA: SW_CreateRenderer.lto_priv.0 (SDL_render_sw.c:1063)
==2985== by 0x48B24AF: SDL_CreateRenderer_REAL (SDL_render.c:1009)
==2985== by 0x10931B: main (sdl2_crash.c:40)
==2985==
==2985== 30,264 (24 direct, 30,240 indirect) bytes in 1 blocks are definitely lost in loss record 2,368 of 2,371
==2985== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==2985== by 0x13241DD6: ???
==2985== by 0x12E012C4: ???
==2985== by 0x12E0115C: ???
==2985== by 0x12A67780: ???
==2985== by 0x12A536A7: ???
==2985== by 0x12982B2B: ???
==2985== by 0x1298287F: ???
==2985== by 0x12983488: ???
==2985== by 0x12984E3F: ???
==2985== by 0x1293D962: ???
==2985== by 0x62C9849: ???
==2985== by 0x62C7CCA: ???
==2985== by 0x62C7F14: ???
==2985== by 0x56A1EEE: ???
==2985== by 0x5DEE6CC: ???
==2985== by 0x5DEE5FF: ???
==2985== by 0x56C926E: ???
==2985== by 0x56D30BF: ???
==2985== by 0x5639FAD: ???
==2985== by 0x563BB5B: ???
==2985== by 0x563A9E8: ???
==2985== by 0x562894B: ???
==2985== by 0x4947868: UnknownInlinedFun (SDL_egl.c:623)
==2985== by 0x4947868: UnknownInlinedFun (SDL_offscreenopengles.c:43)
==2985== by 0x4947868: OFFSCREEN_GLES_LoadLibrary (SDL_offscreenopengles.c:31)
==2985== by 0x492FF52: SDL_GL_LoadLibrary_REAL (SDL_video.c:3469)
==2985== by 0x492EBF1: SDL_RecreateWindow (SDL_video.c:1990)
==2985== by 0x48BCAA3: GL_CreateRenderer.lto_priv.0 (SDL_render_gl.c:1728)
==2985== by 0x48B20BE: SDL_CreateRenderer_REAL (SDL_render.c:1028)
==2985== by 0x492BC4D: SDL_CreateWindowTexture.lto_priv.0 (SDL_video.c:267)
==2985== by 0x493036F: UnknownInlinedFun (SDL_video.c:2711)
==2985== by 0x493036F: UnknownInlinedFun (SDL_video.c:2772)
==2985== by 0x493036F: SDL_GetWindowSurface_REAL (SDL_video.c:2761)
==2985== by 0x48DCBBA: SW_CreateRenderer.lto_priv.0 (SDL_render_sw.c:1063)
==2985== by 0x48B24AF: SDL_CreateRenderer_REAL (SDL_render.c:1009)
==2985== by 0x10931B: main (sdl2_crash.c:40)
==2985==
==2985== 30,264 (24 direct, 30,240 indirect) bytes in 1 blocks are definitely lost in loss record 2,369 of 2,371
==2985== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==2985== by 0x13241DD6: ???
==2985== by 0x12E012C4: ???
==2985== by 0x12E0115C: ???
==2985== by 0x12A67780: ???
==2985== by 0x12A536A7: ???
==2985== by 0x12982B2B: ???
==2985== by 0x1298287F: ???
==2985== by 0x12983488: ???
==2985== by 0x12984E3F: ???
==2985== by 0x1293D962: ???
==2985== by 0x62C9A26: ???
==2985== by 0x62C7CCA: ???
==2985== by 0x62C7F14: ???
==2985== by 0x56A1EEE: ???
==2985== by 0x5DEE6CC: ???
==2985== by 0x5DEE5FF: ???
==2985== by 0x56C926E: ???
==2985== by 0x56D30BF: ???
==2985== by 0x5639FAD: ???
==2985== by 0x563BB5B: ???
==2985== by 0x563A9E8: ???
==2985== by 0x562894B: ???
==2985== by 0x4947868: UnknownInlinedFun (SDL_egl.c:623)
==2985== by 0x4947868: UnknownInlinedFun (SDL_offscreenopengles.c:43)
==2985== by 0x4947868: OFFSCREEN_GLES_LoadLibrary (SDL_offscreenopengles.c:31)
==2985== by 0x492FF52: SDL_GL_LoadLibrary_REAL (SDL_video.c:3469)
==2985== by 0x492EBF1: SDL_RecreateWindow (SDL_video.c:1990)
==2985== by 0x48BCAA3: GL_CreateRenderer.lto_priv.0 (SDL_render_gl.c:1728)
==2985== by 0x48B20BE: SDL_CreateRenderer_REAL (SDL_render.c:1028)
==2985== by 0x492BC4D: SDL_CreateWindowTexture.lto_priv.0 (SDL_video.c:267)
==2985== by 0x493036F: UnknownInlinedFun (SDL_video.c:2711)
==2985== by 0x493036F: UnknownInlinedFun (SDL_video.c:2772)
==2985== by 0x493036F: SDL_GetWindowSurface_REAL (SDL_video.c:2761)
==2985== by 0x48DCBBA: SW_CreateRenderer.lto_priv.0 (SDL_render_sw.c:1063)
==2985== by 0x48B24AF: SDL_CreateRenderer_REAL (SDL_render.c:1009)
==2985== by 0x10931B: main (sdl2_crash.c:40)
==2985==
==2985== LEAK SUMMARY:
==2985== definitely lost: 2,792 bytes in 4 blocks
==2985== indirectly lost: 60,536 bytes in 3 blocks
==2985== possibly lost: 512 bytes in 1 blocks
==2985== still reachable: 290,670 bytes in 2,461 blocks
==2985== suppressed: 80 bytes in 2 blocks
==2985== Reachable blocks (those to which a pointer was found) are not shown.
==2985== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==2985==
==2985== Use --track-origins=yes to see where uninitialised values come from
==2985== For lists of detected and suppressed errors, rerun with: -s
==2985== ERROR SUMMARY: 11 errors from 9 contexts (suppressed: 2 from 2)
Do you have a call stack for the crash? Valgrind is pointing out coding errors in the WSL D3D code, which we can't do anything about.
What can I do to obtain that? :)
Run your program under gdb, and type bt when it crashes?
Still trying to reproduce the issue on local setup, and got feedback on the behalf of my contributor today. They tested with valgrind again, I pointed out you suggested using gdb with bt and I did not get an answer for this specifically yet.
In the mean time, they managed to encounter other crashes in slightly different configurations:
After applying the wslg.conf fix in another WSL host (valgrind)
==412== Memcheck, a memory error detector
==412== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al.
==412== Using Valgrind-3.23.0 and LibVEX; rerun with -h for copyright info
==412== Command: ./a.out
==412==
==412== Jump to the invalid address stated on the next line
==412== at 0x0: ???
==412== by 0x492D2E1: SDL_VideoInit_REAL (SDL_video.c:555)
==412== by 0x487DC4D: SDL_InitSubSystem_REAL.part.0 (SDL.c:277)
==412== by 0x10926F: main (sdl2_crash.c:16)
==412== Address 0x0 is not stack'd, malloc'd or (recently) free'd
==412==
==412==
==412== Process terminating with default action of signal 11 (SIGSEGV)
==412== Bad permissions for mapped region at address 0x0
==412== at 0x0: ???
==412== by 0x492D2E1: SDL_VideoInit_REAL (SDL_video.c:555)
==412== by 0x487DC4D: SDL_InitSubSystem_REAL.part.0 (SDL.c:277)
==412== by 0x10926F: main (sdl2_crash.c:16)
==412==
==412== HEAP SUMMARY:
==412== in use at exit: 49,531 bytes in 149 blocks
==412== total heap usage: 1,739 allocs, 1,590 frees, 326,005 bytes allocated
==412==
==412== 26 bytes in 1 blocks are definitely lost in loss record 29 of 102
==412== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==412== by 0x514A954: ???
==412== by 0x5130BB8: ??? (in /usr/lib/libffi.so.8.1.4)
==412== by 0x49840F3: SDL_DBus_Init_Spinlocked.lto_priv.0 (SDL_dbus.c:153)
==412== by 0x487DA9E: UnknownInlinedFun (SDL_dbus.c:175)
==412== by 0x487DA9E: SDL_InitSubSystem_REAL.part.0 (SDL.c:225)
==412== by 0x10926F: main (sdl2_crash.c:16)
==412==
==412== 26 bytes in 1 blocks are definitely lost in loss record 30 of 102
==412== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==412== by 0x514A954: ???
==412== by 0x5130B6B: ??? (in /usr/lib/libffi.so.8.1.4)
==412== by 0x49840F3: SDL_DBus_Init_Spinlocked.lto_priv.0 (SDL_dbus.c:153)
==412== by 0x487DA9E: UnknownInlinedFun (SDL_dbus.c:175)
==412== by 0x487DA9E: SDL_InitSubSystem_REAL.part.0 (SDL.c:225)
==412== by 0x10926F: main (sdl2_crash.c:16)
==412==
==412== 38 bytes in 1 blocks are definitely lost in loss record 42 of 102
==412== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==412== by 0x514A954: ???
==412== by 0x513099A: ??? (in /usr/lib/libffi.so.8.1.4)
==412== by 0x49840F3: SDL_DBus_Init_Spinlocked.lto_priv.0 (SDL_dbus.c:153)
==412== by 0x487DA9E: UnknownInlinedFun (SDL_dbus.c:175)
==412== by 0x487DA9E: SDL_InitSubSystem_REAL.part.0 (SDL.c:225)
==412== by 0x10926F: main (sdl2_crash.c:16)
==412==
==412== 48 (24 direct, 24 indirect) bytes in 1 blocks are definitely lost in loss record 63 of 102
==412== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==412== by 0x515235F: ???
==412== by 0x5130766: ??? (in /usr/lib/libffi.so.8.1.4)
==412== by 0x49840F3: SDL_DBus_Init_Spinlocked.lto_priv.0 (SDL_dbus.c:153)
==412== by 0x487DA9E: UnknownInlinedFun (SDL_dbus.c:175)
==412== by 0x487DA9E: SDL_InitSubSystem_REAL.part.0 (SDL.c:225)
==412== by 0x10926F: main (sdl2_crash.c:16)
==412==
==412== 520 bytes in 13 blocks are definitely lost in loss record 85 of 102
==412== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==412== by 0x514E248: ???
==412== by 0x514284C: ???
==412== by 0x49840D3: SDL_DBus_Init_Spinlocked.lto_priv.0 (SDL_dbus.c:145)
==412== by 0x487DA9E: UnknownInlinedFun (SDL_dbus.c:175)
==412== by 0x487DA9E: SDL_InitSubSystem_REAL.part.0 (SDL.c:225)
==412== by 0x10926F: main (sdl2_crash.c:16)
==412==
==412== 2,304 bytes in 1 blocks are possibly lost in loss record 92 of 102
==412== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==412== by 0x40237E5: malloc (rtld-malloc.h:56)
==412== by 0x40237E5: _dlfo_mappings_segment_allocate (dl-find_object.c:217)
==412== by 0x40237E5: _dl_find_object_update_1 (dl-find_object.c:672)
==412== by 0x40237E5: _dl_find_object_update (dl-find_object.c:806)
==412== by 0x400C15F: dl_open_worker_begin (dl-open.c:756)
==412== by 0x4001522: _dl_catch_exception (dl-catch.c:241)
==412== by 0x400B49F: dl_open_worker (dl-open.c:803)
==412== by 0x4001522: _dl_catch_exception (dl-catch.c:241)
==412== by 0x400B903: _dl_open (dl-open.c:905)
==412== by 0x4AC6F13: dlopen_doit (dlopen.c:56)
==412== by 0x4001522: _dl_catch_exception (dl-catch.c:241)
==412== by 0x4001678: _dl_catch_error (dl-catch.c:260)
==412== by 0x4AC69F2: _dlerror_run (dlerror.c:138)
==412== by 0x4AC6FCE: dlopen_implementation (dlopen.c:71)
==412== by 0x4AC6FCE: dlopen@@GLIBC_2.34 (dlopen.c:81)
==412== by 0x4984194: UnknownInlinedFun (SDL_sysloadso.c:49)
==412== by 0x4984194: UnknownInlinedFun (SDL_dbus.c:112)
==412== by 0x4984194: SDL_DBus_Init_Spinlocked.lto_priv.0 (SDL_dbus.c:140)
==412== by 0x487DA9E: UnknownInlinedFun (SDL_dbus.c:175)
==412== by 0x487DA9E: SDL_InitSubSystem_REAL.part.0 (SDL.c:225)
==412== by 0x10926F: main (sdl2_crash.c:16)
==412==
==412== 2,304 bytes in 1 blocks are possibly lost in loss record 93 of 102
==412== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==412== by 0x40237E5: malloc (rtld-malloc.h:56)
==412== by 0x40237E5: _dlfo_mappings_segment_allocate (dl-find_object.c:217)
==412== by 0x40237E5: _dl_find_object_update_1 (dl-find_object.c:672)
==412== by 0x40237E5: _dl_find_object_update (dl-find_object.c:806)
==412== by 0x400C15F: dl_open_worker_begin (dl-open.c:756)
==412== by 0x4001522: _dl_catch_exception (dl-catch.c:241)
==412== by 0x400B49F: dl_open_worker (dl-open.c:803)
==412== by 0x4001522: _dl_catch_exception (dl-catch.c:241)
==412== by 0x400B903: _dl_open (dl-open.c:905)
==412== by 0x4AC6F13: dlopen_doit (dlopen.c:56)
==412== by 0x4001522: _dl_catch_exception (dl-catch.c:241)
==412== by 0x4001678: _dl_catch_error (dl-catch.c:260)
==412== by 0x4AC69F2: _dlerror_run (dlerror.c:138)
==412== by 0x4AC6FCE: dlopen_implementation (dlopen.c:71)
==412== by 0x4AC6FCE: dlopen@@GLIBC_2.34 (dlopen.c:81)
==412== by 0x4955D27: UnknownInlinedFun (SDL_sysloadso.c:49)
==412== by 0x4955D27: SDL_X11_LoadSymbols (SDL_x11dyn.c:161)
==412== by 0x495DAC4: X11_CreateDevice.lto_priv.0 (SDL_x11video.c:161)
==412== by 0x492D23E: SDL_VideoInit_REAL (SDL_video.c:524)
==412== by 0x487DC4D: SDL_InitSubSystem_REAL.part.0 (SDL.c:277)
==412== by 0x10926F: main (sdl2_crash.c:16)
==412==
==412== LEAK SUMMARY:
==412== definitely lost: 634 bytes in 17 blocks
==412== indirectly lost: 24 bytes in 1 blocks
==412== possibly lost: 4,608 bytes in 2 blocks
==412== still reachable: 44,265 bytes in 129 blocks
==412== suppressed: 0 bytes in 0 blocks
==412== Reachable blocks (those to which a pointer was found) are not shown.
==412== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==412==
==412== For lists of detected and suppressed errors, rerun with: -s
==412== ERROR SUMMARY: 8 errors from 8 contexts (suppressed: 0 from 0)
Segmentation fault (core dumped)
[root@0v0katai-laptop ~]# valgrind --leak-check=full --num-callers=500 ./a.out
==423== Memcheck, a memory error detector
==423== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al.
==423== Using Valgrind-3.23.0 and LibVEX; rerun with -h for copyright info
==423== Command: ./a.out
==423==
==423== Jump to the invalid address stated on the next line
==423== at 0x0: ???
==423== by 0x492D2E1: SDL_VideoInit_REAL (SDL_video.c:555)
==423== by 0x487DC4D: SDL_InitSubSystem_REAL.part.0 (SDL.c:277)
==423== by 0x10926F: main (sdl2_crash.c:16)
==423== Address 0x0 is not stack'd, malloc'd or (recently) free'd
==423==
==423==
==423== Process terminating with default action of signal 11 (SIGSEGV)
==423== Bad permissions for mapped region at address 0x0
==423== at 0x0: ???
==423== by 0x492D2E1: SDL_VideoInit_REAL (SDL_video.c:555)
==423== by 0x487DC4D: SDL_InitSubSystem_REAL.part.0 (SDL.c:277)
==423== by 0x10926F: main (sdl2_crash.c:16)
==423==
==423== HEAP SUMMARY:
==423== in use at exit: 49,531 bytes in 149 blocks
==423== total heap usage: 1,739 allocs, 1,590 frees, 326,005 bytes allocated
==423==
==423== 26 bytes in 1 blocks are definitely lost in loss record 29 of 102
==423== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==423== by 0x514A954: ???
==423== by 0x5130BB8: ??? (in /usr/lib/libffi.so.8.1.4)
==423== by 0x49840F3: SDL_DBus_Init_Spinlocked.lto_priv.0 (SDL_dbus.c:153)
==423== by 0x487DA9E: UnknownInlinedFun (SDL_dbus.c:175)
==423== by 0x487DA9E: SDL_InitSubSystem_REAL.part.0 (SDL.c:225)
==423== by 0x10926F: main (sdl2_crash.c:16)
==423==
==423== 26 bytes in 1 blocks are definitely lost in loss record 30 of 102
==423== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==423== by 0x514A954: ???
==423== by 0x5130B6B: ??? (in /usr/lib/libffi.so.8.1.4)
==423== by 0x49840F3: SDL_DBus_Init_Spinlocked.lto_priv.0 (SDL_dbus.c:153)
==423== by 0x487DA9E: UnknownInlinedFun (SDL_dbus.c:175)
==423== by 0x487DA9E: SDL_InitSubSystem_REAL.part.0 (SDL.c:225)
==423== by 0x10926F: main (sdl2_crash.c:16)
==423==
==423== 38 bytes in 1 blocks are definitely lost in loss record 42 of 102
==423== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==423== by 0x514A954: ???
==423== by 0x513099A: ??? (in /usr/lib/libffi.so.8.1.4)
==423== by 0x49840F3: SDL_DBus_Init_Spinlocked.lto_priv.0 (SDL_dbus.c:153)
==423== by 0x487DA9E: UnknownInlinedFun (SDL_dbus.c:175)
==423== by 0x487DA9E: SDL_InitSubSystem_REAL.part.0 (SDL.c:225)
==423== by 0x10926F: main (sdl2_crash.c:16)
==423==
==423== 48 (24 direct, 24 indirect) bytes in 1 blocks are definitely lost in loss record 63 of 102
==423== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==423== by 0x515235F: ???
==423== by 0x5130766: ??? (in /usr/lib/libffi.so.8.1.4)
==423== by 0x49840F3: SDL_DBus_Init_Spinlocked.lto_priv.0 (SDL_dbus.c:153)
==423== by 0x487DA9E: UnknownInlinedFun (SDL_dbus.c:175)
==423== by 0x487DA9E: SDL_InitSubSystem_REAL.part.0 (SDL.c:225)
==423== by 0x10926F: main (sdl2_crash.c:16)
==423==
==423== 520 bytes in 13 blocks are definitely lost in loss record 85 of 102
==423== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==423== by 0x514E248: ???
==423== by 0x514284C: ???
==423== by 0x49840D3: SDL_DBus_Init_Spinlocked.lto_priv.0 (SDL_dbus.c:145)
==423== by 0x487DA9E: UnknownInlinedFun (SDL_dbus.c:175)
==423== by 0x487DA9E: SDL_InitSubSystem_REAL.part.0 (SDL.c:225)
==423== by 0x10926F: main (sdl2_crash.c:16)
==423==
==423== 2,304 bytes in 1 blocks are possibly lost in loss record 92 of 102
==423== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==423== by 0x40237E5: malloc (rtld-malloc.h:56)
==423== by 0x40237E5: _dlfo_mappings_segment_allocate (dl-find_object.c:217)
==423== by 0x40237E5: _dl_find_object_update_1 (dl-find_object.c:672)
==423== by 0x40237E5: _dl_find_object_update (dl-find_object.c:806)
==423== by 0x400C15F: dl_open_worker_begin (dl-open.c:756)
==423== by 0x4001522: _dl_catch_exception (dl-catch.c:241)
==423== by 0x400B49F: dl_open_worker (dl-open.c:803)
==423== by 0x4001522: _dl_catch_exception (dl-catch.c:241)
==423== by 0x400B903: _dl_open (dl-open.c:905)
==423== by 0x4AC6F13: dlopen_doit (dlopen.c:56)
==423== by 0x4001522: _dl_catch_exception (dl-catch.c:241)
==423== by 0x4001678: _dl_catch_error (dl-catch.c:260)
==423== by 0x4AC69F2: _dlerror_run (dlerror.c:138)
==423== by 0x4AC6FCE: dlopen_implementation (dlopen.c:71)
==423== by 0x4AC6FCE: dlopen@@GLIBC_2.34 (dlopen.c:81)
==423== by 0x4984194: UnknownInlinedFun (SDL_sysloadso.c:49)
==423== by 0x4984194: UnknownInlinedFun (SDL_dbus.c:112)
==423== by 0x4984194: SDL_DBus_Init_Spinlocked.lto_priv.0 (SDL_dbus.c:140)
==423== by 0x487DA9E: UnknownInlinedFun (SDL_dbus.c:175)
==423== by 0x487DA9E: SDL_InitSubSystem_REAL.part.0 (SDL.c:225)
==423== by 0x10926F: main (sdl2_crash.c:16)
==423==
==423== 2,304 bytes in 1 blocks are possibly lost in loss record 93 of 102
==423== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==423== by 0x40237E5: malloc (rtld-malloc.h:56)
==423== by 0x40237E5: _dlfo_mappings_segment_allocate (dl-find_object.c:217)
==423== by 0x40237E5: _dl_find_object_update_1 (dl-find_object.c:672)
==423== by 0x40237E5: _dl_find_object_update (dl-find_object.c:806)
==423== by 0x400C15F: dl_open_worker_begin (dl-open.c:756)
==423== by 0x4001522: _dl_catch_exception (dl-catch.c:241)
==423== by 0x400B49F: dl_open_worker (dl-open.c:803)
==423== by 0x4001522: _dl_catch_exception (dl-catch.c:241)
==423== by 0x400B903: _dl_open (dl-open.c:905)
==423== by 0x4AC6F13: dlopen_doit (dlopen.c:56)
==423== by 0x4001522: _dl_catch_exception (dl-catch.c:241)
==423== by 0x4001678: _dl_catch_error (dl-catch.c:260)
==423== by 0x4AC69F2: _dlerror_run (dlerror.c:138)
==423== by 0x4AC6FCE: dlopen_implementation (dlopen.c:71)
==423== by 0x4AC6FCE: dlopen@@GLIBC_2.34 (dlopen.c:81)
==423== by 0x4955D27: UnknownInlinedFun (SDL_sysloadso.c:49)
==423== by 0x4955D27: SDL_X11_LoadSymbols (SDL_x11dyn.c:161)
==423== by 0x495DAC4: X11_CreateDevice.lto_priv.0 (SDL_x11video.c:161)
==423== by 0x492D23E: SDL_VideoInit_REAL (SDL_video.c:524)
==423== by 0x487DC4D: SDL_InitSubSystem_REAL.part.0 (SDL.c:277)
==423== by 0x10926F: main (sdl2_crash.c:16)
==423==
==423== LEAK SUMMARY:
==423== definitely lost: 634 bytes in 17 blocks
==423== indirectly lost: 24 bytes in 1 blocks
==423== possibly lost: 4,608 bytes in 2 blocks
==423== still reachable: 44,265 bytes in 129 blocks
==423== suppressed: 0 bytes in 0 blocks
==423== Reachable blocks (those to which a pointer was found) are not shown.
==423== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==423==
==423== For lists of detected and suppressed errors, rerun with: -s
==423== ERROR SUMMARY: 8 errors from 8 contexts (suppressed: 0 from 0)
Segmentation fault (core dumped)
[root@0v0katai-laptop ~]# valgrind --leak-check=full --num-callers=500 ./a.out
==437== Memcheck, a memory error detector
==437== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al.
==437== Using Valgrind-3.23.0 and LibVEX; rerun with -h for copyright info
==437== Command: ./a.out
==437==
==437== Jump to the invalid address stated on the next line
==437== at 0x0: ???
==437== by 0x492D2E1: SDL_VideoInit_REAL (SDL_video.c:555)
==437== by 0x487DC4D: SDL_InitSubSystem_REAL.part.0 (SDL.c:277)
==437== by 0x10926F: main (sdl2_crash.c:16)
==437== Address 0x0 is not stack'd, malloc'd or (recently) free'd
==437==
==437==
==437== Process terminating with default action of signal 11 (SIGSEGV)
==437== Bad permissions for mapped region at address 0x0
==437== at 0x0: ???
==437== by 0x492D2E1: SDL_VideoInit_REAL (SDL_video.c:555)
==437== by 0x487DC4D: SDL_InitSubSystem_REAL.part.0 (SDL.c:277)
==437== by 0x10926F: main (sdl2_crash.c:16)
==437==
==437== HEAP SUMMARY:
==437== in use at exit: 49,531 bytes in 149 blocks
==437== total heap usage: 1,739 allocs, 1,590 frees, 326,005 bytes allocated
==437==
==437== 26 bytes in 1 blocks are definitely lost in loss record 29 of 102
==437== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==437== by 0x514A954: ???
==437== by 0x5130BB8: ??? (in /usr/lib/libffi.so.8.1.4)
==437== by 0x49840F3: SDL_DBus_Init_Spinlocked.lto_priv.0 (SDL_dbus.c:153)
==437== by 0x487DA9E: UnknownInlinedFun (SDL_dbus.c:175)
==437== by 0x487DA9E: SDL_InitSubSystem_REAL.part.0 (SDL.c:225)
==437== by 0x10926F: main (sdl2_crash.c:16)
==437==
==437== 26 bytes in 1 blocks are definitely lost in loss record 30 of 102
==437== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==437== by 0x514A954: ???
==437== by 0x5130B6B: ??? (in /usr/lib/libffi.so.8.1.4)
==437== by 0x49840F3: SDL_DBus_Init_Spinlocked.lto_priv.0 (SDL_dbus.c:153)
==437== by 0x487DA9E: UnknownInlinedFun (SDL_dbus.c:175)
==437== by 0x487DA9E: SDL_InitSubSystem_REAL.part.0 (SDL.c:225)
==437== by 0x10926F: main (sdl2_crash.c:16)
==437==
==437== 38 bytes in 1 blocks are definitely lost in loss record 42 of 102
==437== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==437== by 0x514A954: ???
==437== by 0x513099A: ??? (in /usr/lib/libffi.so.8.1.4)
==437== by 0x49840F3: SDL_DBus_Init_Spinlocked.lto_priv.0 (SDL_dbus.c:153)
==437== by 0x487DA9E: UnknownInlinedFun (SDL_dbus.c:175)
==437== by 0x487DA9E: SDL_InitSubSystem_REAL.part.0 (SDL.c:225)
==437== by 0x10926F: main (sdl2_crash.c:16)
==437==
==437== 48 (24 direct, 24 indirect) bytes in 1 blocks are definitely lost in loss record 63 of 102
==437== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==437== by 0x515235F: ???
==437== by 0x5130766: ??? (in /usr/lib/libffi.so.8.1.4)
==437== by 0x49840F3: SDL_DBus_Init_Spinlocked.lto_priv.0 (SDL_dbus.c:153)
==437== by 0x487DA9E: UnknownInlinedFun (SDL_dbus.c:175)
==437== by 0x487DA9E: SDL_InitSubSystem_REAL.part.0 (SDL.c:225)
==437== by 0x10926F: main (sdl2_crash.c:16)
==437==
==437== 520 bytes in 13 blocks are definitely lost in loss record 85 of 102
==437== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==437== by 0x514E248: ???
==437== by 0x514284C: ???
==437== by 0x49840D3: SDL_DBus_Init_Spinlocked.lto_priv.0 (SDL_dbus.c:145)
==437== by 0x487DA9E: UnknownInlinedFun (SDL_dbus.c:175)
==437== by 0x487DA9E: SDL_InitSubSystem_REAL.part.0 (SDL.c:225)
==437== by 0x10926F: main (sdl2_crash.c:16)
==437==
==437== 2,304 bytes in 1 blocks are possibly lost in loss record 92 of 102
==437== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==437== by 0x40237E5: malloc (rtld-malloc.h:56)
==437== by 0x40237E5: _dlfo_mappings_segment_allocate (dl-find_object.c:217)
==437== by 0x40237E5: _dl_find_object_update_1 (dl-find_object.c:672)
==437== by 0x40237E5: _dl_find_object_update (dl-find_object.c:806)
==437== by 0x400C15F: dl_open_worker_begin (dl-open.c:756)
==437== by 0x4001522: _dl_catch_exception (dl-catch.c:241)
==437== by 0x400B49F: dl_open_worker (dl-open.c:803)
==437== by 0x4001522: _dl_catch_exception (dl-catch.c:241)
==437== by 0x400B903: _dl_open (dl-open.c:905)
==437== by 0x4AC6F13: dlopen_doit (dlopen.c:56)
==437== by 0x4001522: _dl_catch_exception (dl-catch.c:241)
==437== by 0x4001678: _dl_catch_error (dl-catch.c:260)
==437== by 0x4AC69F2: _dlerror_run (dlerror.c:138)
==437== by 0x4AC6FCE: dlopen_implementation (dlopen.c:71)
==437== by 0x4AC6FCE: dlopen@@GLIBC_2.34 (dlopen.c:81)
==437== by 0x4984194: UnknownInlinedFun (SDL_sysloadso.c:49)
==437== by 0x4984194: UnknownInlinedFun (SDL_dbus.c:112)
==437== by 0x4984194: SDL_DBus_Init_Spinlocked.lto_priv.0 (SDL_dbus.c:140)
==437== by 0x487DA9E: UnknownInlinedFun (SDL_dbus.c:175)
==437== by 0x487DA9E: SDL_InitSubSystem_REAL.part.0 (SDL.c:225)
==437== by 0x10926F: main (sdl2_crash.c:16)
==437==
==437== 2,304 bytes in 1 blocks are possibly lost in loss record 93 of 102
==437== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==437== by 0x40237E5: malloc (rtld-malloc.h:56)
==437== by 0x40237E5: _dlfo_mappings_segment_allocate (dl-find_object.c:217)
==437== by 0x40237E5: _dl_find_object_update_1 (dl-find_object.c:672)
==437== by 0x40237E5: _dl_find_object_update (dl-find_object.c:806)
==437== by 0x400C15F: dl_open_worker_begin (dl-open.c:756)
==437== by 0x4001522: _dl_catch_exception (dl-catch.c:241)
==437== by 0x400B49F: dl_open_worker (dl-open.c:803)
==437== by 0x4001522: _dl_catch_exception (dl-catch.c:241)
==437== by 0x400B903: _dl_open (dl-open.c:905)
==437== by 0x4AC6F13: dlopen_doit (dlopen.c:56)
==437== by 0x4001522: _dl_catch_exception (dl-catch.c:241)
==437== by 0x4001678: _dl_catch_error (dl-catch.c:260)
==437== by 0x4AC69F2: _dlerror_run (dlerror.c:138)
==437== by 0x4AC6FCE: dlopen_implementation (dlopen.c:71)
==437== by 0x4AC6FCE: dlopen@@GLIBC_2.34 (dlopen.c:81)
==437== by 0x4955D27: UnknownInlinedFun (SDL_sysloadso.c:49)
==437== by 0x4955D27: SDL_X11_LoadSymbols (SDL_x11dyn.c:161)
==437== by 0x495DAC4: X11_CreateDevice.lto_priv.0 (SDL_x11video.c:161)
==437== by 0x492D23E: SDL_VideoInit_REAL (SDL_video.c:524)
==437== by 0x487DC4D: SDL_InitSubSystem_REAL.part.0 (SDL.c:277)
==437== by 0x10926F: main (sdl2_crash.c:16)
==437==
==437== LEAK SUMMARY:
==437== definitely lost: 634 bytes in 17 blocks
==437== indirectly lost: 24 bytes in 1 blocks
==437== possibly lost: 4,608 bytes in 2 blocks
==437== still reachable: 44,265 bytes in 129 blocks
==437== suppressed: 0 bytes in 0 blocks
==437== Reachable blocks (those to which a pointer was found) are not shown.
==437== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==437==
==437== For lists of detected and suppressed errors, rerun with: -s
==437== ERROR SUMMARY: 8 errors from 8 contexts (suppressed: 0 from 0)
Segmentation fault (core dumped)
After installing the wslg.conf fix, with success but still some memory leaks (valgrind)
==487== Memcheck, a memory error detector
==487== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al.
==487== Using Valgrind-3.23.0 and LibVEX; rerun with -h for copyright info
==487== Command: ./a.out
==487==
==487==
==487== HEAP SUMMARY:
==487== in use at exit: 58,422 bytes in 981 blocks
==487== total heap usage: 13,336 allocs, 12,355 frees, 2,315,400 bytes allocated
==487==
==487== 8 bytes in 1 blocks are definitely lost in loss record 7 of 152
==487== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==487== by 0x530008A: ???
==487== by 0x495D78D: X11_InitKeyboard (SDL_x11keyboard.c:208)
==487== by 0x49633E1: X11_VideoInit.lto_priv.0 (SDL_x11video.c:480)
==487== by 0x492C2E1: SDL_VideoInit_REAL (SDL_video.c:555)
==487== by 0x487CC4D: SDL_InitSubSystem_REAL.part.0 (SDL.c:277)
==487== by 0x10926F: main (sdl2_crash.c:16)
==487==
==487== 12 bytes in 1 blocks are definitely lost in loss record 9 of 152
==487== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==487== by 0x5149954: ???
==487== by 0x512FACD: ???
==487== by 0x49830F3: SDL_DBus_Init_Spinlocked.lto_priv.0 (SDL_dbus.c:153)
==487== by 0x487CA9E: UnknownInlinedFun (SDL_dbus.c:175)
==487== by 0x487CA9E: SDL_InitSubSystem_REAL.part.0 (SDL.c:225)
==487== by 0x10926F: main (sdl2_crash.c:16)
==487==
==487== 12 bytes in 1 blocks are definitely lost in loss record 10 of 152
==487== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==487== by 0x5149954: ???
==487== by 0x512FB6B: ???
==487== by 0x49830F3: SDL_DBus_Init_Spinlocked.lto_priv.0 (SDL_dbus.c:153)
==487== by 0x487CA9E: UnknownInlinedFun (SDL_dbus.c:175)
==487== by 0x487CA9E: SDL_InitSubSystem_REAL.part.0 (SDL.c:225)
==487== by 0x10926F: main (sdl2_crash.c:16)
==487==
==487== 32 (16 direct, 16 indirect) bytes in 1 blocks are definitely lost in loss record 35 of 152
==487== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==487== by 0x52F2A6B: ???
==487== by 0x52F3143: ???
==487== by 0x495D77B: X11_InitKeyboard (SDL_x11keyboard.c:206)
==487== by 0x49633E1: X11_VideoInit.lto_priv.0 (SDL_x11video.c:480)
==487== by 0x492C2E1: SDL_VideoInit_REAL (SDL_video.c:555)
==487== by 0x487CC4D: SDL_InitSubSystem_REAL.part.0 (SDL.c:277)
==487== by 0x10926F: main (sdl2_crash.c:16)
==487==
==487== 38 bytes in 1 blocks are definitely lost in loss record 37 of 152
==487== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==487== by 0x5149954: ???
==487== by 0x512F99A: ???
==487== by 0x49830F3: SDL_DBus_Init_Spinlocked.lto_priv.0 (SDL_dbus.c:153)
==487== by 0x487CA9E: UnknownInlinedFun (SDL_dbus.c:175)
==487== by 0x487CA9E: SDL_InitSubSystem_REAL.part.0 (SDL.c:225)
==487== by 0x10926F: main (sdl2_crash.c:16)
==487==
==487== 48 (24 direct, 24 indirect) bytes in 1 blocks are definitely lost in loss record 58 of 152
==487== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==487== by 0x515135F: ???
==487== by 0x512F766: ???
==487== by 0x49830F3: SDL_DBus_Init_Spinlocked.lto_priv.0 (SDL_dbus.c:153)
==487== by 0x487CA9E: UnknownInlinedFun (SDL_dbus.c:175)
==487== by 0x487CA9E: SDL_InitSubSystem_REAL.part.0 (SDL.c:225)
==487== by 0x10926F: main (sdl2_crash.c:16)
==487==
==487== 48 (16 direct, 32 indirect) bytes in 1 blocks are definitely lost in loss record 59 of 152
==487== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==487== by 0x52EE7D1: ???
==487== by 0x52F2A31: ???
==487== by 0x52F3143: ???
==487== by 0x495D6DF: X11_InitKeyboard (SDL_x11keyboard.c:178)
==487== by 0x49633E1: X11_VideoInit.lto_priv.0 (SDL_x11video.c:480)
==487== by 0x492C2E1: SDL_VideoInit_REAL (SDL_video.c:555)
==487== by 0x487CC4D: SDL_InitSubSystem_REAL.part.0 (SDL.c:277)
==487== by 0x10926F: main (sdl2_crash.c:16)
==487==
==487== 80 (40 direct, 40 indirect) bytes in 1 blocks are definitely lost in loss record 110 of 152
==487== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==487== by 0x52EEC27: ???
==487== by 0x52F3673: ???
==487== by 0x52F184E: ???
==487== by 0x52EE30D: ???
==487== by 0x53114BA: ???
==487== by 0x52F2A58: ???
==487== by 0x52F3143: ???
==487== by 0x495D77B: X11_InitKeyboard (SDL_x11keyboard.c:206)
==487== by 0x49633E1: X11_VideoInit.lto_priv.0 (SDL_x11video.c:480)
==487== by 0x492C2E1: SDL_VideoInit_REAL (SDL_video.c:555)
==487== by 0x487CC4D: SDL_InitSubSystem_REAL.part.0 (SDL.c:277)
==487== by 0x10926F: main (sdl2_crash.c:16)
==487==
==487== 520 bytes in 13 blocks are definitely lost in loss record 129 of 152
==487== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==487== by 0x514D248: ???
==487== by 0x514184C: ???
==487== by 0x49830D3: SDL_DBus_Init_Spinlocked.lto_priv.0 (SDL_dbus.c:145)
==487== by 0x487CA9E: UnknownInlinedFun (SDL_dbus.c:175)
==487== by 0x487CA9E: SDL_InitSubSystem_REAL.part.0 (SDL.c:225)
==487== by 0x10926F: main (sdl2_crash.c:16)
==487==
==487== 1,187 (16 direct, 1,171 indirect) bytes in 1 blocks are definitely lost in loss record 136 of 152
==487== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==487== by 0x52E6DAA: ???
==487== by 0x52F02F0: ???
==487== by 0x52EE30D: ???
==487== by 0x53114BA: ???
==487== by 0x52F2A58: ???
==487== by 0x52F3143: ???
==487== by 0x495D77B: X11_InitKeyboard (SDL_x11keyboard.c:206)
==487== by 0x49633E1: X11_VideoInit.lto_priv.0 (SDL_x11video.c:480)
==487== by 0x492C2E1: SDL_VideoInit_REAL (SDL_video.c:555)
==487== by 0x487CC4D: SDL_InitSubSystem_REAL.part.0 (SDL.c:277)
==487== by 0x10926F: main (sdl2_crash.c:16)
==487==
==487== 2,048 bytes in 1 blocks are definitely lost in loss record 140 of 152
==487== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==487== by 0x52EED3D: ???
==487== by 0x52F3673: ???
==487== by 0x52F184E: ???
==487== by 0x52EE30D: ???
==487== by 0x53114BA: ???
==487== by 0x52F2A58: ???
==487== by 0x52F3143: ???
==487== by 0x495D6DF: X11_InitKeyboard (SDL_x11keyboard.c:178)
==487== by 0x49633E1: X11_VideoInit.lto_priv.0 (SDL_x11video.c:480)
==487== by 0x492C2E1: SDL_VideoInit_REAL (SDL_video.c:555)
==487== by 0x487CC4D: SDL_InitSubSystem_REAL.part.0 (SDL.c:277)
==487== by 0x10926F: main (sdl2_crash.c:16)
==487==
==487== 4,096 bytes in 1 blocks are definitely lost in loss record 147 of 152
==487== at 0x484BC13: calloc (vg_replace_malloc.c:1675)
==487== by 0x52C802B: ???
==487== by 0x52DC1C4: ???
==487== by 0x52B8E7A: ???
==487== by 0x52B9095: ???
==487== by 0x4962C3C: UnknownInlinedFun (SDL_x11modes.c:526)
==487== by 0x4962C3C: UnknownInlinedFun (SDL_x11modes.c:602)
==487== by 0x4962C3C: UnknownInlinedFun (SDL_x11modes.c:654)
==487== by 0x4962C3C: X11_VideoInit.lto_priv.0 (SDL_x11video.c:466)
==487== by 0x492C2E1: SDL_VideoInit_REAL (SDL_video.c:555)
==487== by 0x487CC4D: SDL_InitSubSystem_REAL.part.0 (SDL.c:277)
==487== by 0x10926F: main (sdl2_crash.c:16)
==487==
==487== 7,616 (52 direct, 7,564 indirect) bytes in 1 blocks are definitely lost in loss record 148 of 152
==487== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==487== by 0x52E7054: ???
==487== by 0x52E74D0: ???
==487== by 0x52F3534: ???
==487== by 0x52F184E: ???
==487== by 0x52EE30D: ???
==487== by 0x53114BA: ???
==487== by 0x52F2A58: ???
==487== by 0x52F3143: ???
==487== by 0x495D6DF: X11_InitKeyboard (SDL_x11keyboard.c:178)
==487== by 0x49633E1: X11_VideoInit.lto_priv.0 (SDL_x11video.c:480)
==487== by 0x492C2E1: SDL_VideoInit_REAL (SDL_video.c:555)
==487== by 0x487CC4D: SDL_InitSubSystem_REAL.part.0 (SDL.c:277)
==487== by 0x10926F: main (sdl2_crash.c:16)
==487==
==487== 16,416 (64 direct, 16,352 indirect) bytes in 1 blocks are definitely lost in loss record 151 of 152
==487== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==487== by 0x52C81AF: ???
==487== by 0x52DC1C4: ???
==487== by 0x52B8E7A: ???
==487== by 0x52B9095: ???
==487== by 0x4962C3C: UnknownInlinedFun (SDL_x11modes.c:526)
==487== by 0x4962C3C: UnknownInlinedFun (SDL_x11modes.c:602)
==487== by 0x4962C3C: UnknownInlinedFun (SDL_x11modes.c:654)
==487== by 0x4962C3C: X11_VideoInit.lto_priv.0 (SDL_x11video.c:466)
==487== by 0x492C2E1: SDL_VideoInit_REAL (SDL_video.c:555)
==487== by 0x487CC4D: SDL_InitSubSystem_REAL.part.0 (SDL.c:277)
==487== by 0x10926F: main (sdl2_crash.c:16)
==487==
==487== 18,489 (64 direct, 18,425 indirect) bytes in 1 blocks are definitely lost in loss record 152 of 152
==487== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==487== by 0x52E73FE: ???
==487== by 0x52F469C: ???
==487== by 0x530F50A: ???
==487== by 0x52F2A58: ???
==487== by 0x52F3143: ???
==487== by 0x495D6DF: X11_InitKeyboard (SDL_x11keyboard.c:178)
==487== by 0x49633E1: X11_VideoInit.lto_priv.0 (SDL_x11video.c:480)
==487== by 0x492C2E1: SDL_VideoInit_REAL (SDL_video.c:555)
==487== by 0x487CC4D: SDL_InitSubSystem_REAL.part.0 (SDL.c:277)
==487== by 0x10926F: main (sdl2_crash.c:16)
==487==
==487== LEAK SUMMARY:
==487== definitely lost: 7,026 bytes in 27 blocks
==487== indirectly lost: 43,624 bytes in 903 blocks
==487== possibly lost: 0 bytes in 0 blocks
==487== still reachable: 7,772 bytes in 51 blocks
==487== suppressed: 0 bytes in 0 blocks
==487== Reachable blocks (those to which a pointer was found) are not shown.
==487== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==487==
==487== For lists of detected and suppressed errors, rerun with: -s
==487== ERROR SUMMARY: 15 errors from 15 contexts (suppressed: 0 from 0)
After fresh install, initial crash again (valgrind)
==2993== Memcheck, a memory error detector
==2993== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al.
==2993== Using Valgrind-3.23.0 and LibVEX; rerun with -h for copyright info
==2993== Command: ./a.out
==2993==
^C^C^C^C^C
^C^C^C^C^C
==2993== Conditional jump or move depends on uninitialised value(s)
==2993== at 0x125DF9DC: ??? (in /usr/lib/wsl/lib/libdxcore.so)
==2993== by 0x125E0713: ??? (in /usr/lib/wsl/lib/libdxcore.so)
==2993== by 0x125A290F: ??? (in /usr/lib/wsl/lib/libdxcore.so)
==2993== by 0x125A78B5: ??? (in /usr/lib/wsl/lib/libdxcore.so)
==2993== by 0x125A3AD0: DXCoreCreateAdapterFactory (in /usr/lib/wsl/lib/libdxcore.so)
==2993== by 0x62C999B: get_dxcore_factory (d3d12_dxcore_screen.cpp:53)
==2993== by 0x62C999B: d3d12_init_dxcore_screen(d3d12_screen*) (d3d12_dxcore_screen.cpp:184)
==2993== by 0x62C9F14: d3d12_create_dxcore_screen (d3d12_dxcore_screen.cpp:243)
==2993== by 0x56A3EEE: sw_screen_create_named (sw_helper.h:66)
==2993== by 0x56A3EEE: sw_screen_create_vk (sw_helper.h:90)
==2993== by 0x5DF06CC: pipe_loader_sw_create_screen (pipe_loader_sw.c:427)
==2993== by 0x5DF05FF: pipe_loader_create_screen_vk (pipe_loader.c:181)
==2993== by 0x56CB26E: drisw_init_screen (drisw.c:603)
==2993== by 0x56D50BF: driCreateNewScreen3 (dri_util.c:140)
==2993== by 0x563BFAD: dri2_create_screen (egl_dri2.c:927)
==2993== by 0x563DB5B: dri2_initialize_device (platform_device.c:365)
==2993== by 0x563C9E8: dri2_initialize (egl_dri2.c:1058)
==2993== by 0x562A94B: eglInitialize (eglapi.c:699)
==2993== by 0x4949868: UnknownInlinedFun (SDL_egl.c:623)
==2993== by 0x4949868: UnknownInlinedFun (SDL_offscreenopengles.c:43)
==2993== by 0x4949868: OFFSCREEN_GLES_LoadLibrary (SDL_offscreenopengles.c:31)
==2993== by 0x4931F52: SDL_GL_LoadLibrary_REAL (SDL_video.c:3469)
==2993== by 0x4930BF1: SDL_RecreateWindow (SDL_video.c:1990)
==2993== by 0x48BEAA3: GL_CreateRenderer.lto_priv.0 (SDL_render_gl.c:1728)
==2993== by 0x48B40BE: SDL_CreateRenderer_REAL (SDL_render.c:1028)
==2993== by 0x492DC4D: SDL_CreateWindowTexture.lto_priv.0 (SDL_video.c:267)
==2993== by 0x493236F: UnknownInlinedFun (SDL_video.c:2711)
==2993== by 0x493236F: UnknownInlinedFun (SDL_video.c:2772)
==2993== by 0x493236F: SDL_GetWindowSurface_REAL (SDL_video.c:2761)
==2993== by 0x48DEBBA: SW_CreateRenderer.lto_priv.0 (SDL_render_sw.c:1063)
==2993== by 0x48B44AF: SDL_CreateRenderer_REAL (SDL_render.c:1009)
==2993== by 0x10931B: main (sdl2_crash.c:40)
==2993==
==2993== Conditional jump or move depends on uninitialised value(s)
==2993== at 0x125E0272: ??? (in /usr/lib/wsl/lib/libdxcore.so)
==2993== by 0x125E0713: ??? (in /usr/lib/wsl/lib/libdxcore.so)
==2993== by 0x125A290F: ??? (in /usr/lib/wsl/lib/libdxcore.so)
==2993== by 0x125A78B5: ??? (in /usr/lib/wsl/lib/libdxcore.so)
==2993== by 0x125A3AD0: DXCoreCreateAdapterFactory (in /usr/lib/wsl/lib/libdxcore.so)
==2993== by 0x62C999B: get_dxcore_factory (d3d12_dxcore_screen.cpp:53)
==2993== by 0x62C999B: d3d12_init_dxcore_screen(d3d12_screen*) (d3d12_dxcore_screen.cpp:184)
==2993== by 0x62C9F14: d3d12_create_dxcore_screen (d3d12_dxcore_screen.cpp:243)
==2993== by 0x56A3EEE: sw_screen_create_named (sw_helper.h:66)
==2993== by 0x56A3EEE: sw_screen_create_vk (sw_helper.h:90)
==2993== by 0x5DF06CC: pipe_loader_sw_create_screen (pipe_loader_sw.c:427)
==2993== by 0x5DF05FF: pipe_loader_create_screen_vk (pipe_loader.c:181)
==2993== by 0x56CB26E: drisw_init_screen (drisw.c:603)
==2993== by 0x56D50BF: driCreateNewScreen3 (dri_util.c:140)
==2993== by 0x563BFAD: dri2_create_screen (egl_dri2.c:927)
==2993== by 0x563DB5B: dri2_initialize_device (platform_device.c:365)
==2993== by 0x563C9E8: dri2_initialize (egl_dri2.c:1058)
==2993== by 0x562A94B: eglInitialize (eglapi.c:699)
==2993== by 0x4949868: UnknownInlinedFun (SDL_egl.c:623)
==2993== by 0x4949868: UnknownInlinedFun (SDL_offscreenopengles.c:43)
==2993== by 0x4949868: OFFSCREEN_GLES_LoadLibrary (SDL_offscreenopengles.c:31)
==2993== by 0x4931F52: SDL_GL_LoadLibrary_REAL (SDL_video.c:3469)
==2993== by 0x4930BF1: SDL_RecreateWindow (SDL_video.c:1990)
==2993== by 0x48BEAA3: GL_CreateRenderer.lto_priv.0 (SDL_render_gl.c:1728)
==2993== by 0x48B40BE: SDL_CreateRenderer_REAL (SDL_render.c:1028)
==2993== by 0x492DC4D: SDL_CreateWindowTexture.lto_priv.0 (SDL_video.c:267)
==2993== by 0x493236F: UnknownInlinedFun (SDL_video.c:2711)
==2993== by 0x493236F: UnknownInlinedFun (SDL_video.c:2772)
==2993== by 0x493236F: SDL_GetWindowSurface_REAL (SDL_video.c:2761)
==2993== by 0x48DEBBA: SW_CreateRenderer.lto_priv.0 (SDL_render_sw.c:1063)
==2993== by 0x48B44AF: SDL_CreateRenderer_REAL (SDL_render.c:1009)
==2993== by 0x10931B: main (sdl2_crash.c:40)
==2993==
==2993== Syscall param ioctl(generic) points to uninitialised byte(s)
==2993== at 0x4B4BCED: ioctl (ioctl.c:36)
==2993== by 0x12618712: D3DKMTQueryAdapterInfo (in /usr/lib/wsl/lib/libdxcore.so)
==2993== by 0x12A563FA: ??? (in /usr/lib/wsl/lib/libd3d12core.so)
==2993== by 0x12E01452: ??? (in /usr/lib/wsl/drivers/iigd_dch.inf_amd64_9741ef1f4093481f/libigd12umd64.so)
==2993== by 0x12E010D0: OpenAdapter12 (in /usr/lib/wsl/drivers/iigd_dch.inf_amd64_9741ef1f4093481f/libigd12umd64.so)
==2993== by 0x12A69780: ??? (in /usr/lib/wsl/lib/libd3d12core.so)
==2993== by 0x12A556A7: ??? (in /usr/lib/wsl/lib/libd3d12core.so)
==2993== by 0x12984B2B: ??? (in /usr/lib/wsl/lib/libd3d12core.so)
==2993== by 0x1298487F: ??? (in /usr/lib/wsl/lib/libd3d12core.so)
==2993== by 0x12985488: ??? (in /usr/lib/wsl/lib/libd3d12core.so)
==2993== by 0x12986E3F: ??? (in /usr/lib/wsl/lib/libd3d12core.so)
==2993== by 0x1293F962: ??? (in /usr/lib/wsl/lib/libd3d12core.so)
==2993== by 0x62CB849: create_device (d3d12_screen.cpp:1020)
==2993== by 0x62CB849: d3d12_init_screen(d3d12_screen*, IUnknown*) (d3d12_screen.cpp:1557)
==2993== by 0x62C9CCA: d3d12_init_dxcore_screen(d3d12_screen*) (d3d12_dxcore_screen.cpp:220)
==2993== by 0x62C9F14: d3d12_create_dxcore_screen (d3d12_dxcore_screen.cpp:243)
==2993== by 0x56A3EEE: sw_screen_create_named (sw_helper.h:66)
==2993== by 0x56A3EEE: sw_screen_create_vk (sw_helper.h:90)
==2993== by 0x5DF06CC: pipe_loader_sw_create_screen (pipe_loader_sw.c:427)
==2993== by 0x5DF05FF: pipe_loader_create_screen_vk (pipe_loader.c:181)
==2993== by 0x56CB26E: drisw_init_screen (drisw.c:603)
==2993== by 0x56D50BF: driCreateNewScreen3 (dri_util.c:140)
==2993== by 0x563BFAD: dri2_create_screen (egl_dri2.c:927)
==2993== by 0x563DB5B: dri2_initialize_device (platform_device.c:365)
==2993== by 0x563C9E8: dri2_initialize (egl_dri2.c:1058)
==2993== by 0x562A94B: eglInitialize (eglapi.c:699)
==2993== by 0x4949868: UnknownInlinedFun (SDL_egl.c:623)
==2993== by 0x4949868: UnknownInlinedFun (SDL_offscreenopengles.c:43)
==2993== by 0x4949868: OFFSCREEN_GLES_LoadLibrary (SDL_offscreenopengles.c:31)
==2993== by 0x4931F52: SDL_GL_LoadLibrary_REAL (SDL_video.c:3469)
==2993== by 0x4930BF1: SDL_RecreateWindow (SDL_video.c:1990)
==2993== by 0x48BEAA3: GL_CreateRenderer.lto_priv.0 (SDL_render_gl.c:1728)
==2993== by 0x48B40BE: SDL_CreateRenderer_REAL (SDL_render.c:1028)
==2993== by 0x492DC4D: SDL_CreateWindowTexture.lto_priv.0 (SDL_video.c:267)
==2993== by 0x493236F: UnknownInlinedFun (SDL_video.c:2711)
==2993== by 0x493236F: UnknownInlinedFun (SDL_video.c:2772)
==2993== by 0x493236F: SDL_GetWindowSurface_REAL (SDL_video.c:2761)
==2993== by 0x48DEBBA: SW_CreateRenderer.lto_priv.0 (SDL_render_sw.c:1063)
==2993== by 0x48B44AF: SDL_CreateRenderer_REAL (SDL_render.c:1009)
==2993== by 0x10931B: main (sdl2_crash.c:40)
==2993== Address 0x1ffeff8b64 is on thread 1's stack
==2993== in frame #1, created by D3DKMTQueryAdapterInfo (???:)
==2993==
==2993== Syscall param ioctl(generic) points to uninitialised byte(s)
==2993== at 0x4B4BCED: ioctl (ioctl.c:36)
==2993== by 0x12618712: D3DKMTQueryAdapterInfo (in /usr/lib/wsl/lib/libdxcore.so)
==2993== by 0x12A563FA: ??? (in /usr/lib/wsl/lib/libd3d12core.so)
==2993== by 0x12E0148B: ??? (in /usr/lib/wsl/drivers/iigd_dch.inf_amd64_9741ef1f4093481f/libigd12umd64.so)
==2993== by 0x12E01107: OpenAdapter12 (in /usr/lib/wsl/drivers/iigd_dch.inf_amd64_9741ef1f4093481f/libigd12umd64.so)
==2993== by 0x12A69780: ??? (in /usr/lib/wsl/lib/libd3d12core.so)
==2993== by 0x12A556A7: ??? (in /usr/lib/wsl/lib/libd3d12core.so)
==2993== by 0x12984B2B: ??? (in /usr/lib/wsl/lib/libd3d12core.so)
==2993== by 0x1298487F: ??? (in /usr/lib/wsl/lib/libd3d12core.so)
==2993== by 0x12985488: ??? (in /usr/lib/wsl/lib/libd3d12core.so)
==2993== by 0x12986E3F: ??? (in /usr/lib/wsl/lib/libd3d12core.so)
==2993== by 0x1293F962: ??? (in /usr/lib/wsl/lib/libd3d12core.so)
==2993== by 0x62CB849: create_device (d3d12_screen.cpp:1020)
==2993== by 0x62CB849: d3d12_init_screen(d3d12_screen*, IUnknown*) (d3d12_screen.cpp:1557)
==2993== by 0x62C9CCA: d3d12_init_dxcore_screen(d3d12_screen*) (d3d12_dxcore_screen.cpp:220)
==2993== by 0x62C9F14: d3d12_create_dxcore_screen (d3d12_dxcore_screen.cpp:243)
==2993== by 0x56A3EEE: sw_screen_create_named (sw_helper.h:66)
==2993== by 0x56A3EEE: sw_screen_create_vk (sw_helper.h:90)
==2993== by 0x5DF06CC: pipe_loader_sw_create_screen (pipe_loader_sw.c:427)
==2993== by 0x5DF05FF: pipe_loader_create_screen_vk (pipe_loader.c:181)
==2993== by 0x56CB26E: drisw_init_screen (drisw.c:603)
==2993== by 0x56D50BF: driCreateNewScreen3 (dri_util.c:140)
==2993== by 0x563BFAD: dri2_create_screen (egl_dri2.c:927)
==2993== by 0x563DB5B: dri2_initialize_device (platform_device.c:365)
==2993== by 0x563C9E8: dri2_initialize (egl_dri2.c:1058)
==2993== by 0x562A94B: eglInitialize (eglapi.c:699)
==2993== by 0x4949868: UnknownInlinedFun (SDL_egl.c:623)
==2993== by 0x4949868: UnknownInlinedFun (SDL_offscreenopengles.c:43)
==2993== by 0x4949868: OFFSCREEN_GLES_LoadLibrary (SDL_offscreenopengles.c:31)
==2993== by 0x4931F52: SDL_GL_LoadLibrary_REAL (SDL_video.c:3469)
==2993== by 0x4930BF1: SDL_RecreateWindow (SDL_video.c:1990)
==2993== by 0x48BEAA3: GL_CreateRenderer.lto_priv.0 (SDL_render_gl.c:1728)
==2993== by 0x48B40BE: SDL_CreateRenderer_REAL (SDL_render.c:1028)
==2993== by 0x492DC4D: SDL_CreateWindowTexture.lto_priv.0 (SDL_video.c:267)
==2993== by 0x493236F: UnknownInlinedFun (SDL_video.c:2711)
==2993== by 0x493236F: UnknownInlinedFun (SDL_video.c:2772)
==2993== by 0x493236F: SDL_GetWindowSurface_REAL (SDL_video.c:2761)
==2993== by 0x48DEBBA: SW_CreateRenderer.lto_priv.0 (SDL_render_sw.c:1063)
==2993== by 0x48B44AF: SDL_CreateRenderer_REAL (SDL_render.c:1009)
==2993== by 0x10931B: main (sdl2_crash.c:40)
==2993== Address 0x1ffeff8b64 is on thread 1's stack
==2993== in frame #1, created by D3DKMTQueryAdapterInfo (???:)
==2993==
==2993== Warning: invalid file descriptor -1 in syscall close()
==2993==
==2993== HEAP SUMMARY:
==2993== in use at exit: 354,590 bytes in 2,471 blocks
==2993== total heap usage: 204,286 allocs, 201,815 frees, 112,760,169 bytes allocated
==2993==
==2993== 112 (56 direct, 56 indirect) bytes in 1 blocks are definitely lost in loss record 2,311 of 2,371
==2993== at 0x484BC13: calloc (vg_replace_malloc.c:1675)
==2993== by 0x637565E: ???
==2993== by 0x5DF01F4: ???
==2993== by 0x5DD8711: ???
==2993== by 0x5DD88F7: ???
==2993== by 0x5D83766: ???
==2993== by 0x5D86621: ???
==2993== by 0x5D80FF5: ???
==2993== by 0x5D22500: ???
==2993== by 0x5D69AB9: ???
==2993== by 0x5D653A8: ???
==2993== by 0x5CEFB02: ???
==2993== by 0x5CE8529: ???
==2993== by 0x5CE89A7: ???
==2993== by 0x5CE8E6C: ???
==2993== by 0x5E18497: ???
==2993== by 0x5941306: ???
==2993== by 0x48BD534: GL_RunCommandQueue (SDL_render_gl.c:1374)
==2993== by 0x48B0B70: FlushRenderCommands.lto_priv.0 (SDL_render.c:249)
==2993== by 0x48B77D7: UnknownInlinedFun (SDL_render.c:278)
==2993== by 0x48B77D7: SDL_RenderCopyF_REAL (SDL_render.c:3509)
==2993== by 0x492CFD4: UnknownInlinedFun (SDL_render.c:3404)
==2993== by 0x492CFD4: SDL_UpdateWindowTexture.lto_priv.0 (SDL_video.c:374)
==2993== by 0x4931D73: SDL_UpdateWindowSurface_REAL (SDL_video.c:2791)
==2993== by 0x48B9B6D: UnknownInlinedFun (SDL_render.c:4269)
==2993== by 0x48B9B6D: SDL_RenderPresent_REAL (SDL_render.c:4255)
==2993== by 0x109422: main (sdl2_crash.c:78)
==2993==
==2993== 512 bytes in 1 blocks are possibly lost in loss record 2,347 of 2,371
==2993== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==2993== by 0x40112F0: malloc (rtld-malloc.h:56)
==2993== by 0x40112F0: _dl_resize_dtv (dl-tls.c:527)
==2993== by 0x4011C71: _dl_update_slotinfo (dl-tls.c:849)
==2993== by 0x4011DA3: update_get_addr (dl-tls.c:967)
==2993== by 0x4014C9B: __tls_get_addr (tls_get_addr.S:55)
==2993== by 0x10102F54: __cxa_get_globals (eh_globals.cc:62)
==2993== by 0x101041C0: __cxa_throw (eh_throw.cc:83)
==2993== by 0x1327A160: ???
==2993== by 0x1327114B: ???
==2993== by 0x1326F4CB: ???
==2993== by 0x13241E2E: ???
==2993== by 0x12E012C4: ???
==2993== by 0x12E0115C: ???
==2993== by 0x12A69780: ???
==2993== by 0x12A556A7: ???
==2993== by 0x12984B2B: ???
==2993== by 0x1298487F: ???
==2993== by 0x12985488: ???
==2993== by 0x12986E3F: ???
==2993== by 0x1293F962: ???
==2993== by 0x62CB849: ???
==2993== by 0x62C9CCA: ???
==2993== by 0x62C9F14: ???
==2993== by 0x56A3EEE: ???
==2993== by 0x5DF06CC: ???
==2993== by 0x5DF05FF: ???
==2993== by 0x56CB26E: ???
==2993== by 0x56D50BF: ???
==2993== by 0x563BFAD: ???
==2993== by 0x563DB5B: ???
==2993== by 0x563C9E8: ???
==2993== by 0x562A94B: ???
==2993== by 0x4949868: UnknownInlinedFun (SDL_egl.c:623)
==2993== by 0x4949868: UnknownInlinedFun (SDL_offscreenopengles.c:43)
==2993== by 0x4949868: OFFSCREEN_GLES_LoadLibrary (SDL_offscreenopengles.c:31)
==2993== by 0x4931F52: SDL_GL_LoadLibrary_REAL (SDL_video.c:3469)
==2993== by 0x4930BF1: SDL_RecreateWindow (SDL_video.c:1990)
==2993== by 0x48BEAA3: GL_CreateRenderer.lto_priv.0 (SDL_render_gl.c:1728)
==2993== by 0x48B40BE: SDL_CreateRenderer_REAL (SDL_render.c:1028)
==2993== by 0x492DC4D: SDL_CreateWindowTexture.lto_priv.0 (SDL_video.c:267)
==2993== by 0x493236F: UnknownInlinedFun (SDL_video.c:2711)
==2993== by 0x493236F: UnknownInlinedFun (SDL_video.c:2772)
==2993== by 0x493236F: SDL_GetWindowSurface_REAL (SDL_video.c:2761)
==2993== by 0x48DEBBA: SW_CreateRenderer.lto_priv.0 (SDL_render_sw.c:1063)
==2993== by 0x48B44AF: SDL_CreateRenderer_REAL (SDL_render.c:1009)
==2993== by 0x10931B: main (sdl2_crash.c:40)
==2993==
==2993== 2,688 bytes in 1 blocks are definitely lost in loss record 2,360 of 2,371
==2993== at 0x484BC13: calloc (vg_replace_malloc.c:1675)
==2993== by 0x5635D2F: ???
==2993== by 0x56366BE: ???
==2993== by 0x5615941: ???
==2993== by 0x494984F: UnknownInlinedFun (SDL_egl.c:617)
==2993== by 0x494984F: UnknownInlinedFun (SDL_offscreenopengles.c:43)
==2993== by 0x494984F: OFFSCREEN_GLES_LoadLibrary (SDL_offscreenopengles.c:31)
==2993== by 0x4931F52: SDL_GL_LoadLibrary_REAL (SDL_video.c:3469)
==2993== by 0x4930BF1: SDL_RecreateWindow (SDL_video.c:1990)
==2993== by 0x48BEAA3: GL_CreateRenderer.lto_priv.0 (SDL_render_gl.c:1728)
==2993== by 0x48B40BE: SDL_CreateRenderer_REAL (SDL_render.c:1028)
==2993== by 0x492DC4D: SDL_CreateWindowTexture.lto_priv.0 (SDL_video.c:267)
==2993== by 0x493236F: UnknownInlinedFun (SDL_video.c:2711)
==2993== by 0x493236F: UnknownInlinedFun (SDL_video.c:2772)
==2993== by 0x493236F: SDL_GetWindowSurface_REAL (SDL_video.c:2761)
==2993== by 0x48DEBBA: SW_CreateRenderer.lto_priv.0 (SDL_render_sw.c:1063)
==2993== by 0x48B44AF: SDL_CreateRenderer_REAL (SDL_render.c:1009)
==2993== by 0x10931B: main (sdl2_crash.c:40)
==2993==
==2993== 30,264 (24 direct, 30,240 indirect) bytes in 1 blocks are definitely lost in loss record 2,368 of 2,371
==2993== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==2993== by 0x13241DD6: ???
==2993== by 0x12E012C4: ???
==2993== by 0x12E0115C: ???
==2993== by 0x12A69780: ???
==2993== by 0x12A556A7: ???
==2993== by 0x12984B2B: ???
==2993== by 0x1298487F: ???
==2993== by 0x12985488: ???
==2993== by 0x12986E3F: ???
==2993== by 0x1293F962: ???
==2993== by 0x62CB849: ???
==2993== by 0x62C9CCA: ???
==2993== by 0x62C9F14: ???
==2993== by 0x56A3EEE: ???
==2993== by 0x5DF06CC: ???
==2993== by 0x5DF05FF: ???
==2993== by 0x56CB26E: ???
==2993== by 0x56D50BF: ???
==2993== by 0x563BFAD: ???
==2993== by 0x563DB5B: ???
==2993== by 0x563C9E8: ???
==2993== by 0x562A94B: ???
==2993== by 0x4949868: UnknownInlinedFun (SDL_egl.c:623)
==2993== by 0x4949868: UnknownInlinedFun (SDL_offscreenopengles.c:43)
==2993== by 0x4949868: OFFSCREEN_GLES_LoadLibrary (SDL_offscreenopengles.c:31)
==2993== by 0x4931F52: SDL_GL_LoadLibrary_REAL (SDL_video.c:3469)
==2993== by 0x4930BF1: SDL_RecreateWindow (SDL_video.c:1990)
==2993== by 0x48BEAA3: GL_CreateRenderer.lto_priv.0 (SDL_render_gl.c:1728)
==2993== by 0x48B40BE: SDL_CreateRenderer_REAL (SDL_render.c:1028)
==2993== by 0x492DC4D: SDL_CreateWindowTexture.lto_priv.0 (SDL_video.c:267)
==2993== by 0x493236F: UnknownInlinedFun (SDL_video.c:2711)
==2993== by 0x493236F: UnknownInlinedFun (SDL_video.c:2772)
==2993== by 0x493236F: SDL_GetWindowSurface_REAL (SDL_video.c:2761)
==2993== by 0x48DEBBA: SW_CreateRenderer.lto_priv.0 (SDL_render_sw.c:1063)
==2993== by 0x48B44AF: SDL_CreateRenderer_REAL (SDL_render.c:1009)
==2993== by 0x10931B: main (sdl2_crash.c:40)
==2993==
==2993== 30,264 (24 direct, 30,240 indirect) bytes in 1 blocks are definitely lost in loss record 2,369 of 2,371
==2993== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==2993== by 0x13241DD6: ???
==2993== by 0x12E012C4: ???
==2993== by 0x12E0115C: ???
==2993== by 0x12A69780: ???
==2993== by 0x12A556A7: ???
==2993== by 0x12984B2B: ???
==2993== by 0x1298487F: ???
==2993== by 0x12985488: ???
==2993== by 0x12986E3F: ???
==2993== by 0x1293F962: ???
==2993== by 0x62CBA26: ???
==2993== by 0x62C9CCA: ???
==2993== by 0x62C9F14: ???
==2993== by 0x56A3EEE: ???
==2993== by 0x5DF06CC: ???
==2993== by 0x5DF05FF: ???
==2993== by 0x56CB26E: ???
==2993== by 0x56D50BF: ???
==2993== by 0x563BFAD: ???
==2993== by 0x563DB5B: ???
==2993== by 0x563C9E8: ???
==2993== by 0x562A94B: ???
==2993== by 0x4949868: UnknownInlinedFun (SDL_egl.c:623)
==2993== by 0x4949868: UnknownInlinedFun (SDL_offscreenopengles.c:43)
==2993== by 0x4949868: OFFSCREEN_GLES_LoadLibrary (SDL_offscreenopengles.c:31)
==2993== by 0x4931F52: SDL_GL_LoadLibrary_REAL (SDL_video.c:3469)
==2993== by 0x4930BF1: SDL_RecreateWindow (SDL_video.c:1990)
==2993== by 0x48BEAA3: GL_CreateRenderer.lto_priv.0 (SDL_render_gl.c:1728)
==2993== by 0x48B40BE: SDL_CreateRenderer_REAL (SDL_render.c:1028)
==2993== by 0x492DC4D: SDL_CreateWindowTexture.lto_priv.0 (SDL_video.c:267)
==2993== by 0x493236F: UnknownInlinedFun (SDL_video.c:2711)
==2993== by 0x493236F: UnknownInlinedFun (SDL_video.c:2772)
==2993== by 0x493236F: SDL_GetWindowSurface_REAL (SDL_video.c:2761)
==2993== by 0x48DEBBA: SW_CreateRenderer.lto_priv.0 (SDL_render_sw.c:1063)
==2993== by 0x48B44AF: SDL_CreateRenderer_REAL (SDL_render.c:1009)
==2993== by 0x10931B: main (sdl2_crash.c:40)
==2993==
==2993== LEAK SUMMARY:
==2993== definitely lost: 2,792 bytes in 4 blocks
==2993== indirectly lost: 60,536 bytes in 3 blocks
==2993== possibly lost: 512 bytes in 1 blocks
==2993== still reachable: 290,670 bytes in 2,461 blocks
==2993== suppressed: 80 bytes in 2 blocks
==2993== Reachable blocks (those to which a pointer was found) are not shown.
==2993== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==2993==
==2993== Use --track-origins=yes to see where uninitialised values come from
==2993== For lists of detected and suppressed errors, rerun with: -s
==2993== ERROR SUMMARY: 11 errors from 9 contexts (suppressed: 2 from 2)
Hi, I'm the original reporter of this issue. I apologize for not using gbd when @thomas-touhey commented because I got different valgrind results the next day and I had to set up another ArchWSL instance to reproduce the initial result. Right now this is what gdb gives me:
gdb log
Reading symbols from a.out...
(gdb) r
Starting program: /root/a.out
This GDB supports auto-downloading debuginfo from the following URLs:
<https://debuginfod.archlinux.org>
Enable debuginfod for this session? (y or [n]) y
Debuginfod has been enabled.
To make this setting permanent, add 'set debuginfod enabled on' to .gdbinit.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7fffea5126c0 (LWP 4740)]
[New Thread 0x7fffe3fff6c0 (LWP 4741)]
[New Thread 0x7fffe9d116c0 (LWP 4742)]
[New Thread 0x7fffe95106c0 (LWP 4743)]
[New Thread 0x7fffe8d0f6c0 (LWP 4744)]
[New Thread 0x7fffe37fe6c0 (LWP 4745)]
[New Thread 0x7fffe2ffd6c0 (LWP 4746)]
[New Thread 0x7fffe27fc6c0 (LWP 4747)]
[New Thread 0x7fffe1ffb6c0 (LWP 4748)]
[New Thread 0x7fffe17fa6c0 (LWP 4749)]
[New Thread 0x7fffe0ff96c0 (LWP 4750)]
[New Thread 0x7fffb3fff6c0 (LWP 4751)]
[New Thread 0x7fffbbfff6c0 (LWP 4752)]
[New Thread 0x7fffbb7fe6c0 (LWP 4753)]
[New Thread 0x7fffbaffd6c0 (LWP 4754)]
[New Thread 0x7fffba7fc6c0 (LWP 4755)]
[New Thread 0x7fffb9ffb6c0 (LWP 4756)]
[New Thread 0x7fffb97fa6c0 (LWP 4757)]
[New Thread 0x7fffb8ff96c0 (LWP 4758)]
[New Thread 0x7fffb37fe6c0 (LWP 4759)]
[New Thread 0x7fffb2ffd6c0 (LWP 4760)]
[New Thread 0x7fffb27fc6c0 (LWP 4761)]
[New Thread 0x7fffb1ffb6c0 (LWP 4762)]
[New Thread 0x7fffb17fa6c0 (LWP 4763)]
[New Thread 0x7fffb0ff96c0 (LWP 4764)]
[New Thread 0x7fff7bfff6c0 (LWP 4765)]
[New Thread 0x7fff7b7fe6c0 (LWP 4766)]
[New Thread 0x7fff7affd6c0 (LWP 4767)]
[New Thread 0x7fff7a7fc6c0 (LWP 4768)]
[New Thread 0x7fff79ffb6c0 (LWP 4769)]
[New Thread 0x7fff797fa6c0 (LWP 4770)]
[New Thread 0x7fff78ff96c0 (LWP 4771)]
[New Thread 0x7fff5ffff6c0 (LWP 4772)]
[New Thread 0x7fff5f7fe6c0 (LWP 4773)]
[New Thread 0x7fff5effd6c0 (LWP 4774)]
[New Thread 0x7fff5e7fc6c0 (LWP 4775)]
[New Thread 0x7fff5dffb6c0 (LWP 4776)]
[New Thread 0x7fff5d7fa6c0 (LWP 4777)]
[New Thread 0x7fff5cff96c0 (LWP 4778)]
[New Thread 0x7fff3bfff6c0 (LWP 4779)]
[New Thread 0x7fff3b7fe6c0 (LWP 4780)]
bt
^C
Thread 1 "a.out" received signal SIGINT, Interrupt.
0x00007ffff7cd3733 in __GI___clock_nanosleep (clock_id=clock_id@entry=0, flags=flags@entry=0,
req=req@entry=0x7fffffffe6c0, rem=rem@entry=0x7fffffffe6d0) at ../sysdeps/unix/sysv/linux/clock_nanosleep.c:48
48 r = INTERNAL_SYSCALL_CANCEL (clock_nanosleep_time64, clock_id, flags, req,
(gdb) bt
#0 0x00007ffff7cd3733 in __GI___clock_nanosleep (clock_id=clock_id@entry=0, flags=flags@entry=0,
req=req@entry=0x7fffffffe6c0, rem=rem@entry=0x7fffffffe6d0) at ../sysdeps/unix/sysv/linux/clock_nanosleep.c:48
#1 0x00007ffff7cdf827 in __GI___nanosleep (req=req@entry=0x7fffffffe6c0, rem=rem@entry=0x7fffffffe6d0)
at ../sysdeps/unix/sysv/linux/nanosleep.c:25
#2 0x00007ffff7f25850 in SDL_Delay_REAL (ms=<optimized out>)
at /usr/src/debug/sdl2/SDL2-2.30.8/src/timer/unix/SDL_systimer.c:213
#3 0x00007ffff7e1caf3 in SDL_WaitEventTimeout_REAL (event=0x7fffffffe7f0, timeout=-1)
at /usr/src/debug/sdl2/SDL2-2.30.8/src/events/SDL_events.c:1163
#4 0x0000555555555444 in main () at sdl2_crash.c:80
The minimal script didn't seem to trigger crash but gbd stopped at [New Thread 0x7fff3b7fe6c0 (LWP 4780)], and I had to interrupt manually to get the call stack info.
That isn't a crash call stack though... ?
That isn't a crash call stack though... ?
gdb doesn't prompt any crash while the minimal script is running, so I can't get the crash call stack atm.
Update: I was able to reproduce the result that prompts segfault explicitly:
valgrind log
==338== Memcheck, a memory error detector
==338== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al.
==338== Using Valgrind-3.23.0 and LibVEX; rerun with -h for copyright info
==338== Command: ./a.out
==338==
==338== Jump to the invalid address stated on the next line
==338== at 0x0: ???
==338== by 0x492D2E1: SDL_VideoInit_REAL (SDL_video.c:555)
==338== by 0x487DC4D: SDL_InitSubSystem_REAL.part.0 (SDL.c:277)
==338== by 0x10926F: main (sdl2_crash.c:16)
==338== Address 0x0 is not stack'd, malloc'd or (recently) free'd
==338==
==338==
==338== Process terminating with default action of signal 11 (SIGSEGV)
==338== Bad permissions for mapped region at address 0x0
==338== at 0x0: ???
==338== by 0x492D2E1: SDL_VideoInit_REAL (SDL_video.c:555)
==338== by 0x487DC4D: SDL_InitSubSystem_REAL.part.0 (SDL.c:277)
==338== by 0x10926F: main (sdl2_crash.c:16)
==338==
==338== HEAP SUMMARY:
==338== in use at exit: 49,537 bytes in 149 blocks
==338== total heap usage: 1,739 allocs, 1,590 frees, 326,014 bytes allocated
==338==
==338== 29 bytes in 1 blocks are definitely lost in loss record 29 of 96
==338== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==338== by 0x514A954: ???
==338== by 0x5130BB8: ??? (in /usr/lib/libffi.so.8.1.4)
==338== by 0x49840F3: SDL_DBus_Init_Spinlocked.lto_priv.0 (SDL_dbus.c:153)
==338== by 0x487DA9E: UnknownInlinedFun (SDL_dbus.c:175)
==338== by 0x487DA9E: SDL_InitSubSystem_REAL.part.0 (SDL.c:225)
==338== by 0x10926F: main (sdl2_crash.c:16)
==338==
==338== 29 bytes in 1 blocks are definitely lost in loss record 30 of 96
==338== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==338== by 0x514A954: ???
==338== by 0x5130B6B: ??? (in /usr/lib/libffi.so.8.1.4)
==338== by 0x49840F3: SDL_DBus_Init_Spinlocked.lto_priv.0 (SDL_dbus.c:153)
==338== by 0x487DA9E: UnknownInlinedFun (SDL_dbus.c:175)
==338== by 0x487DA9E: SDL_InitSubSystem_REAL.part.0 (SDL.c:225)
==338== by 0x10926F: main (sdl2_crash.c:16)
==338==
==338== 38 bytes in 1 blocks are definitely lost in loss record 40 of 96
==338== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==338== by 0x514A954: ???
==338== by 0x513099A: ??? (in /usr/lib/libffi.so.8.1.4)
==338== by 0x49840F3: SDL_DBus_Init_Spinlocked.lto_priv.0 (SDL_dbus.c:153)
==338== by 0x487DA9E: UnknownInlinedFun (SDL_dbus.c:175)
==338== by 0x487DA9E: SDL_InitSubSystem_REAL.part.0 (SDL.c:225)
==338== by 0x10926F: main (sdl2_crash.c:16)
==338==
==338== 48 (24 direct, 24 indirect) bytes in 1 blocks are definitely lost in loss record 60 of 96
==338== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==338== by 0x515235F: ???
==338== by 0x5130766: ??? (in /usr/lib/libffi.so.8.1.4)
==338== by 0x49840F3: SDL_DBus_Init_Spinlocked.lto_priv.0 (SDL_dbus.c:153)
==338== by 0x487DA9E: UnknownInlinedFun (SDL_dbus.c:175)
==338== by 0x487DA9E: SDL_InitSubSystem_REAL.part.0 (SDL.c:225)
==338== by 0x10926F: main (sdl2_crash.c:16)
==338==
==338== 520 bytes in 13 blocks are definitely lost in loss record 82 of 96
==338== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==338== by 0x514E248: ???
==338== by 0x514284C: ???
==338== by 0x49840D3: SDL_DBus_Init_Spinlocked.lto_priv.0 (SDL_dbus.c:145)
==338== by 0x487DA9E: UnknownInlinedFun (SDL_dbus.c:175)
==338== by 0x487DA9E: SDL_InitSubSystem_REAL.part.0 (SDL.c:225)
==338== by 0x10926F: main (sdl2_crash.c:16)
==338==
==338== 4,608 bytes in 2 blocks are possibly lost in loss record 95 of 96
==338== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==338== by 0x40237E5: malloc (rtld-malloc.h:56)
==338== by 0x40237E5: _dlfo_mappings_segment_allocate (dl-find_object.c:217)
==338== by 0x40237E5: _dl_find_object_update_1 (dl-find_object.c:672)
==338== by 0x40237E5: _dl_find_object_update (dl-find_object.c:806)
==338== by 0x400C15F: dl_open_worker_begin (dl-open.c:756)
==338== by 0x4001522: _dl_catch_exception (dl-catch.c:241)
==338== by 0x400B49F: dl_open_worker (dl-open.c:803)
==338== by 0x4001522: _dl_catch_exception (dl-catch.c:241)
==338== by 0x400B903: _dl_open (dl-open.c:905)
==338== by 0x4AC6F13: dlopen_doit (dlopen.c:56)
==338== by 0x4001522: _dl_catch_exception (dl-catch.c:241)
==338== by 0x4001678: _dl_catch_error (dl-catch.c:260)
==338== by 0x4AC69F2: _dlerror_run (dlerror.c:138)
==338== by 0x4AC6FCE: dlopen_implementation (dlopen.c:71)
==338== by 0x4AC6FCE: dlopen@@GLIBC_2.34 (dlopen.c:81)
==338==
==338== LEAK SUMMARY:
==338== definitely lost: 640 bytes in 17 blocks
==338== indirectly lost: 24 bytes in 1 blocks
==338== possibly lost: 4,608 bytes in 2 blocks
==338== still reachable: 44,265 bytes in 129 blocks
==338== suppressed: 0 bytes in 0 blocks
==338== Reachable blocks (those to which a pointer was found) are not shown.
==338== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==338==
==338== For lists of detected and suppressed errors, rerun with: -s
==338== ERROR SUMMARY: 7 errors from 7 contexts (suppressed: 0 from 0)
Segmentation fault (core dumped)
Then I ran it immediately with gdb. This time gdb stopped when segfault occured:
gdb log
Reading symbols from a.out...
(gdb) r
Starting program: /home/calcloverhk/a.out
This GDB supports auto-downloading debuginfo from the following URLs:
<https://debuginfod.archlinux.org>
Enable debuginfod for this session? (y or [n]) y
Debuginfod has been enabled.
To make this setting permanent, add 'set debuginfod enabled on' to .gdbinit.
Downloading separate debug info for system-supplied DSO at 0x7ffff7fc5000
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0 0x0000000000000000 in ?? ()
#1 0x00007ffff7efb471 in Wayland_VideoInit (_this=0x5555555609e0)
at /usr/src/debug/sdl2/SDL2-2.30.8/src/video/wayland/SDL_waylandvideo.c:939
#2 0x00007ffff7eac2e2 in SDL_VideoInit_REAL (driver_name=<optimized out>)
at /usr/src/debug/sdl2/SDL2-2.30.8/src/video/SDL_video.c:555
#3 0x00007ffff7dfcc4e in SDL_InitSubSystem_REAL (flags=16416) at /usr/src/debug/sdl2/SDL2-2.30.8/src/SDL.c:277
#4 0x0000555555555270 in main () at sdl2_crash.c:16
@Kontrabant, it looks like this is crashing in WAYLAND_xkb_context_new() with a NULL pointer. Aren't we checking that symbols were successfully loaded before calling that?
Yes, the first thing Wayland_CreateDevice() does is load the Wayland symbols, including the xkb library. That symbol is non-optional, so loading the Wayland driver should fail if it can't be found.
@0v0katai, can you apply this patch and send us the output?
diff --git a/src/video/wayland/SDL_waylanddyn.c b/src/video/wayland/SDL_waylanddyn.c
index ea15da397..77fe2adb5 100644
--- a/src/video/wayland/SDL_waylanddyn.c
+++ b/src/video/wayland/SDL_waylanddyn.c
@@ -59,6 +59,9 @@ static void *WAYLAND_GetSym(const char *fnname, int *pHasModule, bool required)
if (dynlib->lib) {
fn = SDL_LoadFunction(dynlib->lib, fnname);
if (fn) {
+ if (SDL_strcmp(fnname, "xkb_context_new") == 0) {
+ SDL_Log("xkb_context_new found in %s\n", dynlib->libname);
+ }
break;
}
}
They requested my help in running the script using SDL with your patch, hence I'm placing the instructions I've found worked on my computer:
cd /tmp
# Clone and patch SDL3
git clone https://github.com/libsdl-org/SDL && cd SDL
curl -o log.patch https://haste.breizh.pm/raw/xozehubigo
patch -i log.patch -u src/video/wayland/SDL_waylanddyn.c
# Build SDL3
# Based on: https://wiki.libsdl.org/SDL3/Installation
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Debug -DSDL_SHARED=FALSE -DSDL_STATIC=TRUE ..
cmake --build . --config Debug --parallel
# Get, compile and run SDL script.
curl -o sdl3_crash.c https://haste.breizh.pm/raw/jukuyoyafo
gcc -g sdl3_crash.c -L. -lSDL3 -lm -Iinclude/ -I../include/ -I../include/SDL3
./a.out
For reference, sdl3_crash.c is basically sdl2_crash.c ported to SDL3, using the migration guide, with the following source code:
sdl3_crash.c
#include <stdio.h>
#include <SDL.h>
int main() {
int ret = 1;
int sdl_initialized = 0;
SDL_Window *window = NULL;
SDL_Renderer *renderer = NULL;
SDL_Texture *texture = NULL;
SDL_Event event;
Uint32 *pixels;
int pitch;
int i;
if (!SDL_InitSubSystem(SDL_INIT_VIDEO | SDL_INIT_EVENTS)) {
fprintf(stderr, "Failed to initialize SDL: %s\n", SDL_GetError());
goto fail;
}
sdl_initialized = 1;
window = SDL_CreateWindow(
"renderer crash on WSL",
128,
64,
0
);
if (!window) {
fprintf(
stderr,
"Couldn't create the window: %s\n",
SDL_GetError()
);
goto fail;
}
/* Then let's create the renderer. */
renderer = SDL_CreateRenderer(window, SDL_SOFTWARE_RENDERER);
if (!renderer) {
fprintf(
stderr,
"Couldn't create the renderer: %s\n",
SDL_GetError()
);
goto fail;
}
texture = SDL_CreateTexture(
renderer,
SDL_PIXELFORMAT_ARGB8888,
SDL_TEXTUREACCESS_STREAMING,
128,
64
);
if (!texture) {
fprintf(
stderr,
"Couldn't create the texture: %s\n",
SDL_GetError()
);
return 1;
}
if (!SDL_LockTexture(
texture,
NULL,
(void **)&pixels,
&pitch
)) {
fprintf(stderr, "Couldn't lock the texture: %s\n", SDL_GetError());
goto fail;
}
for (i = 128 * 64 - 1; i >= 0; i--)
pixels[i] = 0xFFFF0000;
SDL_UnlockTexture(texture);
if (!SDL_RenderTexture(renderer, texture, NULL, NULL)) {
fprintf(
stderr,
"Couldn't render the texture: %s\n",
SDL_GetError()
);
goto fail;
}
if (!SDL_RenderPresent(renderer)) {
fprintf(stderr, "Couldn't render present: %s\n", SDL_GetError());
goto fail;
}
while (SDL_WaitEvent(&event)) {
if (event.type == SDL_EVENT_QUIT)
break;
}
ret = 0;
fail:
if (texture)
SDL_DestroyTexture(texture);
if (renderer)
SDL_DestroyRenderer(renderer);
if (window)
SDL_DestroyWindow(window);
if (sdl_initialized)
SDL_QuitSubSystem(SDL_INIT_VIDEO | SDL_INIT_EVENTS);
return ret;
}
Thanks @thomas-touhey. The SDL3 minimal script no longer segfaults and outputs the following message:
Failed to initialize SDL: No available video device
valgrind log
==477475== Memcheck, a memory error detector
==477475== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al.
==477475== Using Valgrind-3.23.0 and LibVEX; rerun with -h for copyright info
==477475== Command: ./a.out
==477475==
Failed to initialize SDL: No available video device
==477475==
==477475== HEAP SUMMARY:
==477475== in use at exit: 16,883 bytes in 145 blocks
==477475== total heap usage: 741 allocs, 596 frees, 234,804 bytes allocated
==477475==
==477475== 26 bytes in 1 blocks are definitely lost in loss record 36 of 96
==477475== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==477475== by 0x4F78954: ???
==477475== by 0x4F5EBB8: ???
==477475== by 0x275E53: SDL_DBus_Init (SDL_dbus.c:151)
==477475== by 0x2B03E5: SDL_InitSubSystem_REAL (SDL.c:298)
==477475== by 0x12AEAD: SDL_InitSubSystem_DEFAULT (SDL_dynapi_procs.h:640)
==477475== by 0x137282: SDL_InitSubSystem (SDL_dynapi_procs.h:640)
==477475== by 0x124FC1: main (sdl3_crash.c:15)
==477475==
==477475== 26 bytes in 1 blocks are definitely lost in loss record 37 of 96
==477475== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==477475== by 0x4F78954: ???
==477475== by 0x4F5EB6B: ???
==477475== by 0x275E53: SDL_DBus_Init (SDL_dbus.c:151)
==477475== by 0x2B03E5: SDL_InitSubSystem_REAL (SDL.c:298)
==477475== by 0x12AEAD: SDL_InitSubSystem_DEFAULT (SDL_dynapi_procs.h:640)
==477475== by 0x137282: SDL_InitSubSystem (SDL_dynapi_procs.h:640)
==477475== by 0x124FC1: main (sdl3_crash.c:15)
==477475==
==477475== 38 bytes in 1 blocks are definitely lost in loss record 48 of 96
==477475== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==477475== by 0x4F78954: ???
==477475== by 0x4F5E99A: ???
==477475== by 0x275E53: SDL_DBus_Init (SDL_dbus.c:151)
==477475== by 0x2B03E5: SDL_InitSubSystem_REAL (SDL.c:298)
==477475== by 0x12AEAD: SDL_InitSubSystem_DEFAULT (SDL_dynapi_procs.h:640)
==477475== by 0x137282: SDL_InitSubSystem (SDL_dynapi_procs.h:640)
==477475== by 0x124FC1: main (sdl3_crash.c:15)
==477475==
==477475== 48 (24 direct, 24 indirect) bytes in 1 blocks are definitely lost in loss record 75 of 96
==477475== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==477475== by 0x4F8035F: ???
==477475== by 0x4F5E766: ???
==477475== by 0x275E53: SDL_DBus_Init (SDL_dbus.c:151)
==477475== by 0x2B03E5: SDL_InitSubSystem_REAL (SDL.c:298)
==477475== by 0x12AEAD: SDL_InitSubSystem_DEFAULT (SDL_dynapi_procs.h:640)
==477475== by 0x137282: SDL_InitSubSystem (SDL_dynapi_procs.h:640)
==477475== by 0x124FC1: main (sdl3_crash.c:15)
==477475==
==477475== 520 bytes in 13 blocks are definitely lost in loss record 89 of 96
==477475== at 0x48447A8: malloc (vg_replace_malloc.c:446)
==477475== by 0x4F7C248: ???
==477475== by 0x4F7084C: ???
==477475== by 0x275E26: SDL_DBus_Init (SDL_dbus.c:143)
==477475== by 0x2B03E5: SDL_InitSubSystem_REAL (SDL.c:298)
==477475== by 0x12AEAD: SDL_InitSubSystem_DEFAULT (SDL_dynapi_procs.h:640)
==477475== by 0x137282: SDL_InitSubSystem (SDL_dynapi_procs.h:640)
==477475== by 0x124FC1: main (sdl3_crash.c:15)
==477475==
==477475== LEAK SUMMARY:
==477475== definitely lost: 634 bytes in 17 blocks
==477475== indirectly lost: 24 bytes in 1 blocks
==477475== possibly lost: 0 bytes in 0 blocks
==477475== still reachable: 16,225 bytes in 127 blocks
==477475== suppressed: 0 bytes in 0 blocks
==477475== Reachable blocks (those to which a pointer was found) are not shown.
==477475== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==477475==
==477475== For lists of detected and suppressed errors, rerun with: -s
==477475== ERROR SUMMARY: 5 errors from 5 contexts (suppressed: 0 from 0)
This looks correct, thanks!
With the latest verison of SDL2, the SDL2 minimal program now outputs Failed to initialize SDL: No available video device as well. ~~Seems like the memory leak is fixed.~~
(Edit 2025-6-24: Sorry for misinformation. It turns out I was using sdl2-compat which is actually based on SDL3 codebase. I manually built the the latest verison (2.32.8) of SDL2, and used gcc sdl2_crash.c -g $(sdl2-config --cflags --libs). The result is still a segfault.)
==22588== Memcheck, a memory error detector
==22588== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al.
==22588== Using Valgrind-3.25.1 and LibVEX; rerun with -h for copyright info
==22588== Command: ./a.out
==22588==
^C==22588==
==22588== HEAP SUMMARY:
==22588== in use at exit: 346,084 bytes in 2,669 blocks
==22588== total heap usage: 111,043 allocs, 108,374 frees, 79,028,375 bytes allocated
==22588==
==22588== 112 (56 direct, 56 indirect) bytes in 1 blocks are definitely lost in loss record 2,535 of 2,578
==22588== at 0x4851C13: calloc (vg_replace_malloc.c:1675)
==22588== by 0x64E6DCA: ???
==22588== by 0x5EF5BD4: ???
==22588== by 0x5EE7CF6: ???
==22588== by 0x5EE7F16: ???
==22588== by 0x5E88E06: ???
==22588== by 0x5E8BCB1: ???
==22588== by 0x5E866F5: ???
==22588== by 0x5E27D08: ???
==22588== by 0x5E6EAB8: ???
==22588== by 0x5E6B1C0: ???
==22588== by 0x5DF4D7B: ???
==22588==
==22588== 2,688 bytes in 1 blocks are definitely lost in loss record 2,573 of 2,578
==22588== at 0x4851C13: calloc (vg_replace_malloc.c:1675)
==22588== by 0x56B80EF: ???
==22588== by 0x56B8A9E: ???
==22588== by 0x547F2EA: ???
==22588== by 0x4987C10: SDL_EGL_InitializeOffscreen (in /usr/local/lib/libSDL2-2.0.so.0.3200.8)
==22588== by 0x49C4A50: OFFSCREEN_GLES_LoadLibrary (in /usr/local/lib/libSDL2-2.0.so.0.3200.8)
==22588== by 0x499CE85: SDL_GL_LoadLibrary_REAL (in /usr/local/lib/libSDL2-2.0.so.0.3200.8)
==22588== by 0x49A057A: SDL_RecreateWindow (in /usr/local/lib/libSDL2-2.0.so.0.3200.8)
==22588== by 0x48E7098: GL_CreateRenderer (in /usr/local/lib/libSDL2-2.0.so.0.3200.8)
==22588== by 0x48DB402: SDL_CreateRenderer_REAL (in /usr/local/lib/libSDL2-2.0.so.0.3200.8)
==22588== by 0x499A41F: SDL_CreateWindowTexture (in /usr/local/lib/libSDL2-2.0.so.0.3200.8)
==22588== by 0x499AB85: SDL_GetWindowSurface_REAL (in /usr/local/lib/libSDL2-2.0.so.0.3200.8)
==22588==
==22588== LEAK SUMMARY:
==22588== definitely lost: 2,744 bytes in 2 blocks
==22588== indirectly lost: 56 bytes in 1 blocks
==22588== possibly lost: 0 bytes in 0 blocks
==22588== still reachable: 343,204 bytes in 2,664 blocks
==22588== suppressed: 80 bytes in 2 blocks
==22588== Reachable blocks (those to which a pointer was found) are not shown.
==22588== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==22588==
==22588== For lists of detected and suppressed errors, rerun with: -s
==22588== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)