From 293433602eb6d051f235aea597391971ea120acf Mon Sep 17 00:00:00 2001 From: Louis Montagne Date: Tue, 5 May 2026 16:20:45 +0200 Subject: [PATCH] zink: relax build-id length assertion for Mach-O `disk_cache_init` asserts `build_id_len == BUILD_ID_EXPECTED_HASH_LENGTH` (20, the size of a GNU build-id SHA1 on ELF). Mach-O has no GNU build-id; the closest equivalent is `LC_UUID`, which is 16 bytes. `build_id_length()` therefore returns a non-20 value on macOS and the assert fires as soon as `ENABLE_SHADER_CACHE` is on. Relax the assertion to `<=` so any non-empty build id of acceptable length is accepted while still catching impossibly long ones. The hash only needs *some* unique-per-build identifier; the actual byte count hashed is whatever `build_id_length()` returned. Cc: mesa-stable Suggested-by: Mike Blumenkrantz Signed-off-by: Louis Montagne Part-of: (cherry picked from commit 14992361a4ef6355443b774e8dd2888e6c365af4) --- .pick_status.json | 2 +- src/gallium/drivers/zink/zink_screen.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 0d8176c0dc9..e3884fad7b7 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -704,7 +704,7 @@ "description": "zink: relax build-id length assertion for Mach-O", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c index e56ecb7a7c0..9084c911b38 100644 --- a/src/gallium/drivers/zink/zink_screen.c +++ b/src/gallium/drivers/zink/zink_screen.c @@ -318,7 +318,7 @@ disk_cache_init(struct zink_screen *screen) const struct build_id_note *note = build_id_find_nhdr_for_addr(disk_cache_init); unsigned build_id_len = build_id_length(note); - assert(note && build_id_len == BUILD_ID_EXPECTED_HASH_LENGTH); + assert(note && build_id_len <= BUILD_ID_EXPECTED_HASH_LENGTH); _mesa_blake3_update(&ctx, build_id_data(note), build_id_len); #endif