Vulkan: create_device reads the device extension list after freeing it (random crash at start)

Chiusa Adatta ai principianti
#488 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
1/5
Tempo stimato
1-3 ore
Idoneità per principianti
62/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
c
Ambito
backend

Direzione di ricerca

Inizia in runtime/nvn/vulkan/device.c, nella funzione create_device, e controlla la chiamata free(ep) rispetto ai successivi controlli has_ext(ep, ne, ...). Sposta la liberazione dopo vkCreateDevice, come descritto nell’issue, quindi verifica che l’avvio non vada più in crash; il rapporto segnala 30 avvii riusciti con questa modifica.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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 check
  • device.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.

Lingua principale
C
Stelle
811
Fork
37
Merge medio
17m
PR unite (30g)
13

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Revivedx/SavageWindRecomp

Tutte le issue di Revivedx/SavageWindRecomp

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.