Module: Mesa
Branch: staging/21.1
Commit: 76fa8c9b417190af52e72dc8ea10e399fbcd8a30
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=76fa8c9b417190af52e72dc8ea10e399fbcd8a30

Author: Joshua Ashton <[email protected]>
Date:   Sat May 15 10:53:17 2021 +0100

venus: Fix zero-initialized fd causing apps to hang/crash

Some apps such as Gamescope crash under the mere presence of the virtio Vulkan 
driver without using a device.

This is because virtgpu::fd is zero-initialized upon allocation, which causes 
fd 0 to be closed in virtgpu_destroy.

Cc: mesa-stable
Fixes: 247232d5 ("venus: add experimental renderers")
Signed-off-by: Joshua Ashton <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Reviewed-By: Mike Blumenkrantz <[email protected]>
Reviewed-by: Daniel Stone <[email protected]>
Reviewed-by: Chia-I Wu <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10814>
(cherry picked from commit 6fcf3314d00529e2e09fdff1d31332f0d8c0c5cf)

---

 .pick_status.json                       | 2 +-
 src/virtio/vulkan/vn_renderer_virtgpu.c | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index 6801687788f..82d6f390456 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -22,7 +22,7 @@
         "description": "venus: Fix zero-initialized fd causing apps to 
hang/crash",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "247232d5969235b7f24b5ab9fbfc9dc5570c578e"
     },
diff --git a/src/virtio/vulkan/vn_renderer_virtgpu.c 
b/src/virtio/vulkan/vn_renderer_virtgpu.c
index c9d4184ef55..7cadb4ac49c 100644
--- a/src/virtio/vulkan/vn_renderer_virtgpu.c
+++ b/src/virtio/vulkan/vn_renderer_virtgpu.c
@@ -1457,6 +1457,7 @@ vn_renderer_create_virtgpu(struct vn_instance *instance,
       return VK_ERROR_OUT_OF_HOST_MEMORY;
 
    gpu->instance = instance;
+   gpu->fd = -1;
 
    VkResult result = virtgpu_init(gpu);
    if (result != VK_SUCCESS) {

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to