Skip to content

zero-init entrypoints in loader_add_to_dev_ext_list - #2007

Merged
charles-lunarg merged 1 commit into
KhronosGroup:mainfrom
aizu-m:dev-ext-entrypoints-init
Aug 11, 2026
Merged

zero-init entrypoints in loader_add_to_dev_ext_list#2007
charles-lunarg merged 1 commit into
KhronosGroup:mainfrom
aizu-m:dev-ext-entrypoints-init

Conversation

@aizu-m

@aizu-m aizu-m commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

ASan, teardown of an instance created with an app pfnReallocation:

SUMMARY: AddressSanitizer: SEGV loader.c:411 in free_string_list
x[8] = 0xffffffffffffffff

Chased the wild pointer back to loader_add_to_dev_ext_list. It memcpys the props sub-struct of the new element but only assigns the nested entrypoints loader_string_list when the caller hands it a non-NULL entrys. A device_extensions entry with no entrypoints array reaches it with entrys == NULL (loader.c:3097-3101, and the component-layer merge at loader.c:2653), so entrypoints keeps whatever was in the slot.

Nothing showed up until a discovered layer had 33+ device extensions. The first 32 slots come from loader_init_generic_list/loader_calloc and are zeroed, so the field read as empty. Slot 32 onwards comes from this function's own loader_instance_heap_realloc growth, and loader_realloc only zeroes the grown region on the plain realloc path, not the app pfnReallocation path (allocation.c:94-97). At vkDestroyInstance, free_string_list then walks that indeterminate list and count.

Zero entrypoints in the else branch so the appended element is fully initialised whatever allocator is in use. Regression test added under the alloc-callback suite; it poisons the grown region so the read is deterministic, and trips the SEGV without this change.

@ci-tester-lunarg

Copy link
Copy Markdown

Author aizu-m not on autobuild list. Waiting for curator authorization before starting CI build.

1 similar comment
@ci-tester-lunarg

Copy link
Copy Markdown

Author aizu-m not on autobuild list. Waiting for curator authorization before starting CI build.

@ci-tester-lunarg

Copy link
Copy Markdown

CI Vulkan-Loader build queued with queue ID 74644.

@ci-tester-lunarg

Copy link
Copy Markdown

CI Vulkan-Loader build # 3697 running.

@ci-tester-lunarg

Copy link
Copy Markdown

CI Vulkan-Loader build # 3697 passed.

@charles-lunarg
charles-lunarg merged commit 17e9516 into KhronosGroup:main Aug 11, 2026
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants