From 20705e89e9d9b24d10f266c6fb60496fc428969c Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Thu, 28 Aug 2025 11:22:53 +0100 Subject: [PATCH] drm-shim: fix with asan It seems GCC+AddressSanitizer calls open and readlink after destroy_shim(), so those need to still work. Signed-off-by: Rhys Perry Reviewed-by: Samuel Pitoiset Part-of: --- src/drm-shim/drm_shim.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/drm-shim/drm_shim.c b/src/drm-shim/drm_shim.c index 6d090d12292..4547aa1ca27 100644 --- a/src/drm-shim/drm_shim.c +++ b/src/drm-shim/drm_shim.c @@ -189,6 +189,8 @@ drm_shim_override_file(const char *contents, const char *path_format, ...) override->contents = strdup(contents); } +static uint32_t inited = 0; + static void destroy_shim(void) { @@ -196,6 +198,10 @@ destroy_shim(void) free(render_node_path); free(render_node_dirent_name); free(subsystem_path); + + render_node_minor = -1; + file_overrides_count = 0; + p_atomic_set(&inited, 0); } /* Initialization, which will be called from the first general library call @@ -204,8 +210,6 @@ destroy_shim(void) static void init_shim(void) { - static uint32_t inited = 0; - drm_shim_debug = debug_get_bool_option("DRM_SHIM_DEBUG", false); /* We can't lock this, because we recurse during initialization. */