Repository navigation
clear icd_tramp_list on error in EnumerateInstanceExtensionProperties - #2085
Merged
charles-lunarg merged 1 commit intoOct 27, 2026
Merged
Conversation
terminator_EnumerateInstanceExtensionProperties scans every driver into a local icd_tramp_list, which dlopens each driver library and stores its resolved path in lib_name. The success path releases that list with loader_clear_scanned_icd_list, which closes the handles and frees the paths. The error paths jump to out:, which tears the list down with loader_destroy_generic_list instead. That frees only the array of entries, so when a driver fails its instance extension query every scanned driver's lib_name and library handle leak on each vkEnumerateInstanceExtensionProperties call. Use loader_clear_scanned_icd_list at out:, as the vkCreateInstance failure path already does for the same list. It is a no-op once the success path has cleared the list. Add a test ICD knob so vkEnumerateInstanceExtensionProperties can fail, and a regression test that runs through the failure path. On the unpatched loader LeakSanitizer reports 8192 bytes in 2 allocations from normalize_path via loader_scanned_icd_add and loader_icd_scan; it is clean after the change.
|
User aizu-m not on autobuild list. Waiting for curator authorization before starting CI build. |
1 similar comment
|
User aizu-m not on autobuild list. Waiting for curator authorization before starting CI build. |
|
CI Vulkan-Loader build queued with queue ID 172577. |
charles-lunarg
approved these changes
Oct 27, 2026
charles-lunarg
left a comment
Collaborator
There was a problem hiding this comment.
That's an easy approve.
|
CI Vulkan-Loader build # 3914 running. |
|
CI Vulkan-Loader build # 3914 passed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
LeakSanitizer, Linux Debug build with
LOADER_ENABLE_ADDRESS_SANITIZER=ON, running the new test against the unpatched loader (loader kept mapped so its frames symbolise):Found while reading the cleanup labels in loader.c after the implicit layer scan fix in #2070.
terminator_EnumerateInstanceExtensionPropertiesscans every installed driver into a localicd_tramp_list; each entry holds a dlopen handle and the driver's resolved path inlib_name. The success path releases that list withloader_clear_scanned_icd_list. The error paths jump toout:, which tears it down withloader_destroy_generic_list, and that frees only the array of entries. So when any driver returns an error from itsvkEnumerateInstanceExtensionProperties(the two blocks above are onelib_nameper installed driver), the paths and the library handles are lost on every call the application makes.vkCreateInstancealready usesloader_clear_scanned_icd_liston its failure path for the same list. Use it atout:too; it is a no-op once the success path has cleared the list.The test ICD gains
enum_instance_extension_properties_return_code.EnumerateInstanceExtensionProperties.DriverExtensionQueryFailsinstalls two drivers, makes the second fail its query, then resets the knob and checks the next call succeeds. LeakSanitizer flags it on the unpatched loader and it passes after the change; macOSleaksshows the same two blocks per call before and none after. Full suite green under ASAN on macOS (646/646), clang-format clean.