summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
4f08af6)
Fixes UBSan error:
../src/amd/vulkan/radv_pipeline_cache.c:603:42: runtime error: member access within misaligned address 0x00000152ebcc for type 'struct cache_entry', which requires 8 byte alignment
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6206>
+#include "util/macros.h"
#include "util/mesa-sha1.h"
#include "util/debug.h"
#include "util/disk_cache.h"
#include "util/mesa-sha1.h"
#include "util/debug.h"
#include "util/disk_cache.h"
for (int i = 0; i < MESA_SHADER_STAGES; ++i)
if (entry->binary_sizes[i])
ret += entry->binary_sizes[i];
for (int i = 0; i < MESA_SHADER_STAGES; ++i)
if (entry->binary_sizes[i])
ret += entry->binary_sizes[i];
+ ret = align(ret, alignof(struct cache_entry));
for (int i = 0; i < MESA_SHADER_STAGES; ++i)
if (variants[i])
size += binaries[i]->total_size;
for (int i = 0; i < MESA_SHADER_STAGES; ++i)
if (variants[i])
size += binaries[i]->total_size;
+ size = align(size, alignof(struct cache_entry));
entry = vk_alloc(&cache->alloc, size, 8,
entry = vk_alloc(&cache->alloc, size, 8,
}
void *p = pData, *end = pData + *pDataSize;
header = p;
}
void *p = pData, *end = pData + *pDataSize;
header = p;
- header->header_size = sizeof(*header);
+ header->header_size = align(sizeof(*header), alignof(struct cache_entry));
header->header_version = VK_PIPELINE_CACHE_HEADER_VERSION_ONE;
header->vendor_id = ATI_VENDOR_ID;
header->device_id = device->physical_device->rad_info.pci_id;
header->header_version = VK_PIPELINE_CACHE_HEADER_VERSION_ONE;
header->vendor_id = ATI_VENDOR_ID;
header->device_id = device->physical_device->rad_info.pci_id;