mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 04:38:03 +02:00
zink: avoid UAF on wayland async present with to-be-retired swapchain
wayland surfaces are likely to become unlinked in WSI implementations upon
retiring a swapchain, requiring the pending present to complete
in order to avoid invalid access
cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25288>
(cherry picked from commit aaabb5b0f2)
This commit is contained in:
parent
4a5788e6a3
commit
81e6a108da
2 changed files with 4 additions and 1 deletions
|
|
@ -1291,7 +1291,7 @@
|
|||
"description": "zink: avoid UAF on wayland async present with to-be-retired swapchain",
|
||||
"nominated": true,
|
||||
"nomination_type": 0,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null
|
||||
},
|
||||
|
|
|
|||
|
|
@ -253,6 +253,9 @@ kopper_CreateSwapchain(struct zink_screen *screen, struct kopper_displaytarget *
|
|||
bool has_alpha = cdt->info.has_alpha && (cdt->caps.supportedCompositeAlpha & VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR);
|
||||
if (cdt->swapchain) {
|
||||
cswap->scci = cdt->swapchain->scci;
|
||||
/* avoid UAF if async present needs to-be-retired swapchain */
|
||||
if (cdt->type == KOPPER_WAYLAND && cdt->swapchain->swapchain)
|
||||
util_queue_fence_wait(&cdt->swapchain->present_fence);
|
||||
cswap->scci.oldSwapchain = cdt->swapchain->swapchain;
|
||||
} else {
|
||||
cswap->scci.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue