Mesa (staging/21.3): radv: Fix memory corruption loading RT pipeline cache entries.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Nov 16 22:17:13 UTC 2021


Module: Mesa
Branch: staging/21.3
Commit: 248983cbf8c10bd8c3b830ec595a81af962784b4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=248983cbf8c10bd8c3b830ec595a81af962784b4

Author: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Date:   Sun Nov 14 23:57:45 2021 +0100

radv: Fix memory corruption loading RT pipeline cache entries.

Oops. Forgot to account for the size here.

Fixes: ca2d96db51e ("radv: Add caching for RT pipelines.")
Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13789>
(cherry picked from commit 9494c566c27064687944fb73a16f5437e204c5ab)

---

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

diff --git a/.pick_status.json b/.pick_status.json
index c53d43e98c4..cc12f1a7535 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -715,7 +715,7 @@
         "description": "radv: Fix memory corruption loading RT pipeline cache entries.",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "ca2d96db51e5a47044ee02f8613bc463605c2bf8"
     },
diff --git a/src/amd/vulkan/radv_pipeline_cache.c b/src/amd/vulkan/radv_pipeline_cache.c
index 709ecbe2294..2f7094cd082 100644
--- a/src/amd/vulkan/radv_pipeline_cache.c
+++ b/src/amd/vulkan/radv_pipeline_cache.c
@@ -109,6 +109,7 @@ entry_size(struct cache_entry *entry)
    for (int i = 0; i < MESA_SHADER_STAGES; ++i)
       if (entry->binary_sizes[i])
          ret += entry->binary_sizes[i];
+   ret += sizeof(struct radv_pipeline_shader_stack_size) * entry->num_stack_sizes;
    ret = align(ret, alignof(struct cache_entry));
    return ret;
 }



More information about the mesa-commit mailing list