bound icd debug list index by capacity in rollback and destroy#1969
Merged
Conversation
The per-ICD debug messenger and report lists are grown one ICD at a time in the create loop, so a create that fails after the used-object slot is reserved but before a given ICD's list is grown left the error rollback indexing list[next_index] past the end of the smaller allocation. Add the capacity > index * sizeof bound that the instance-list and surface-list accesses already use, in both create rollbacks and both destroy terminators.
|
Author aizu-m not on autobuild list. Waiting for curator authorization before starting CI build. |
1 similar comment
|
Author aizu-m not on autobuild list. Waiting for curator authorization before starting CI build. |
charles-lunarg
approved these changes
Jul 13, 2026
|
CI Vulkan-Loader build queued with queue ID 38312. |
|
CI Vulkan-Loader build # 3631 running. |
|
CI Vulkan-Loader build # 3631 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.
ASAN, on an instance with VK_EXT_debug_utils and an allocator that refuses the per-ICD list growth:
Each ICD keeps its own debug_utils_messenger_list, grown one ICD at a time inside the create loop. Tracing the read back: the 33rd messenger create reserves used-object slot 32, so every list has to grow. If the reservation succeeds but a later per-ICD resize is refused, that ICD's list stays at 32 entries while next_index is already 32. The error rollback then indexed list[next_index] with only a NULL check, ran off the end of the smaller allocation, and could hand a garbage handle to the driver's Destroy.
The instance-list access just below already guards this with capacity > next_index * sizeof, and wsi_unwrap_icd_surface / cleanup_surface_creation guard the surface list the same way. The debug lists were the ones without it.
Added the bound at both create rollbacks and at the two destroy terminators, which index these lists the same way. The repro in loader_alloc_callback_tests.cpp forces the per-ICD resize to fail; it trips ASAN before the change and passes after.