Module: Mesa
Branch: staging/21.0
Commit: 7f3697cf4b7a8e6d2328396314b33033bf1fc85d
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7f3697cf4b7a8e6d2328396314b33033bf1fc85d

Author: Rhys Perry <[email protected]>
Date:   Fri Apr 23 13:03:01 2021 +0100

radv: fix use-after-free upon GS copy shader cache hits

If radv_pipeline_cache_insert_shaders() finds a GS copy shader in the
cache, it will free the variant in gs_variants and replace it with the one
in the cache.

Signed-off-by: Rhys Perry <[email protected]>
Reviewed-by: Samuel Pitoiset <[email protected]>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10433>
(cherry picked from commit d6894b643b8079b2c2b16de18c856008cd922cca)

---

 .pick_status.json              | 2 +-
 src/amd/vulkan/radv_pipeline.c | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index 52577e5742a..c46aed64456 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -3253,7 +3253,7 @@
         "description": "radv: fix use-after-free upon GS copy shader cache 
hits",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": null
     },
diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index 923b49f8338..74747057733 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -3356,6 +3356,8 @@ radv_create_shaders(struct radv_pipeline *pipeline, 
struct radv_device *device,
          gs_variants[MESA_SHADER_GEOMETRY] = pipeline->gs_copy_shader;
 
          radv_pipeline_cache_insert_shaders(device, cache, gs_copy_hash, 
gs_variants, gs_binaries);
+
+         pipeline->gs_copy_shader = gs_variants[MESA_SHADER_GEOMETRY];
       }
       free(gs_copy_binary);
    }

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

Reply via email to