Vulkan: create_device reads the device extension list after freeing it (random crash at start)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 62/100
Research direction
Start in runtime/nvn/vulkan/device.c at the create_device function and review the free(ep) call against the later has_ext(ep, ne, ...) checks. Move the free to after vkCreateDevice, as the issue describes, then verify startup no longer crashes; the report notes 30 successful starts with this change.
Written by the indexing model from the issue text.
Description
On test 257b1f3, create_device in runtime/nvn/vulkan/device.c frees the device's extension list and then reads it again:
device.c:630:free(ep);, just after the present wait checkdevice.c:838:has_ext(ep, ne, VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME), from 33b0869. This runs on every GPU that has the extension.device.c:869, 882, 896: the FSR 4 checks for cooperative matrix, FP8 and compute derivatives. These run on AMD with the FSR DLLs.
Usually the freed block still holds the list, so the check passes. Sometimes the heap has given the pages back, and the start crashes in strcmp (ucrtbase) inside has_ext. The last line in the log is then [vk] attachment feedback loops on, and no crash report follows, because the crash handler is installed only with the first guest thread.
Seen on Windows 11 with an RTX 5060 Ti (driver 617.42): 4 crashes in 53 starts. Caught with the crash handler installed early:
[plat] access violation: read at 0x16f2d826060, allocation 0x16f2d380000+0x11000, state 0x2000, protection 0
*** exception c0000005 accessing 0x16f2d826060
host pc 7ff88296d8b0 (ucrtbase.dll+ed8b0)
The return address points into ui_window_init, where create_device is inlined. It's the strcmp in the has_ext loop (stride 0x104 = sizeof(VkExtensionProperties)).
Fix: move free(ep); to just after VK_CHECK(vkCreateDevice(...)) (line 935). Nothing after that reads ep, and no entry of ext[] points into it. With that change, 30 of 30 starts were fine. It's commit 09d07f1 in #345 if you want to take it from there, but it's a two-line change.
- Dominant language
- C
- Stars
- 811
- Forks
- 37
- Avg merge
- 17m
- Merged PRs (30d)
- 13
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Revivedx/SavageWindRecomp
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 42/100
Revivedx/SavageWindRecomp#494 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Revivedx/SavageWindRecomp#490 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 42/100
Revivedx/SavageWindRecomp#486 · 1 comment ·
Maintainers usually reply within 1 day
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 55/100
Revivedx/SavageWindRecomp#485 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Revivedx/SavageWindRecomp#484 ·
Maintainers usually reply within 1 day
All issues in Revivedx/SavageWindRecomp
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
containers/bubblewrap#826 ·
Maintainers usually reply within 1 day
-
needs-device
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
feature/themes QA/No release-notes/exclude tests tests/missing-coverage tests/test-quality
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
brave/brave-browser#60971 ·
Maintainers usually reply within 1 day
-
[compiler-rt] Rtsan-aarch64-NoInstTest: error: no such file or directory: 'NOTFOUND' (libatomic)Openbuild-problem compiler-rt:rtsan platform:linux
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
llvm/llvm-project#239039 ·
Maintainers usually reply within 1 day