Linux ASan: shader-memory fixture aborts in SPIRV-Tools stable_sort before capture tests #7765

Closed
opened 2026-10-19 06:46:42 +00:00 by Amoenus · 0 comments
Amoenus commented 2026-10-19 06:46:42 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Amoenus on 2026-10-19T06:46:42Z.


Observed failure

On unmodified main 46f27623c28b237f6b7dab93862a318e4977cc19, the supported Linux AddressSanitizer configuration builds agc_shader_memory_tests, but the fixture exits in verifyFrontendPair before its memory-capture lifetime cases:

ERROR: AddressSanitizer: alloc-dealloc-mismatch (operator new vs free)
  __return_temporary_buffer ... /usr/include/c++/13/bits/stl_tempbuf.h:77
  std::stable_sort ... SPIRV-Tools/source/val/validate_decorations.cpp:523
  ShaderRecompiler::ValidateAndOptimizeSpirv
  verifyFrontendPair ... tests/ShaderMemory.cpp:322
SUMMARY: AddressSanitizer: alloc-dealloc-mismatch ... in free

The allocation trace names operator new(unsigned long, std::nothrow_t const&) through std::get_temporary_buffer. The cause is not isolated; this report does not assign the defect to SPIRV-Tools, libstdc++ or the project's allocation interposition.

Reproduction

Ubuntu 24.04 WSL2, g++ (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0, bundled dependency mode with SPIRV-Tools gitlink 7f2d9ee926f98fc77a3ed1e1e0f113b8c9c49458.

cmake -S . -B build-asan -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TESTING=ON -DANYPS5_ENABLE_ASAN=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build-asan --target agc_shader_memory_tests --parallel 4
ctest --test-dir build-asan -V -j1 --timeout 30 -R '^agc_shader_memory$'

Our configure additionally reuses the existing current-revision FFmpeg package with FFMPEG_PREBUILT_DIR. The loader resolves the test's libc.prx from this ASan build's own core/libs/libs/unpatched directory; LD_LIBRARY_PATH is empty, so this is not a stale runtime override.

Controls and scope

  • Exact main above: configure/build pass; CTest exits 8 with the mismatch, before the first region-vector assignment at line 829. The baseline has leak detection disabled; allocation-mismatch checking remains enabled.
  • Lifetime-only fix e3b8707988421618f3b33092af69cd00ca5e637d, same base/build: ASan again stops at verifyFrontendPair with the same mismatch, this time with default ASAN_OPTIONS. Ordinary Linux and Windows shader-memory runs each pass 5/5. No allocation-mismatch suppression is applied.
  • This blocks the attempted full-fixture sanitizer comparison for #7754; it is not evidence that the lifetime correction failed or that sanitizer validation passed. No game, GPU or production-crash claim is made.

Expected next step: isolate the allocation/deallocation pairing or sanitizer/interposition incompatibility so this fixture can reach the remaining tests under ASan. No runtime workaround or code change is proposed here.

AI-assisted investigation/report: yes, Codex.

Resolution status

Fixed upstream by #7781 (merged 2026-10-19). The fixture now routes nothrow allocation through its own operator new, pairing stable_sort temporary allocations with its free-based delete. The PR reports an isolated ASan reproduction passing with allocation-mismatch checking enabled; its author could not execute the full fixture on that host because of the CPU-feature precondition. Our earlier main46f/e3b failures remain historical evidence, and a fresh full-fixture instrumented run on the combined newer source is still pending here.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5919196803 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/7765). Originally posted by [Amoenus](https://github.com/Amoenus) on 2026-10-19T06:46:42Z. --- ### Observed failure On unmodified main `46f27623c28b237f6b7dab93862a318e4977cc19`, the supported Linux AddressSanitizer configuration builds `agc_shader_memory_tests`, but the fixture exits in `verifyFrontendPair` before its memory-capture lifetime cases: ```text ERROR: AddressSanitizer: alloc-dealloc-mismatch (operator new vs free) __return_temporary_buffer ... /usr/include/c++/13/bits/stl_tempbuf.h:77 std::stable_sort ... SPIRV-Tools/source/val/validate_decorations.cpp:523 ShaderRecompiler::ValidateAndOptimizeSpirv verifyFrontendPair ... tests/ShaderMemory.cpp:322 SUMMARY: AddressSanitizer: alloc-dealloc-mismatch ... in free ``` The allocation trace names `operator new(unsigned long, std::nothrow_t const&)` through `std::get_temporary_buffer`. The cause is not isolated; this report does not assign the defect to SPIRV-Tools, libstdc++ or the project's allocation interposition. ### Reproduction Ubuntu 24.04 WSL2, `g++ (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0`, bundled dependency mode with SPIRV-Tools gitlink `7f2d9ee926f98fc77a3ed1e1e0f113b8c9c49458`. ```sh cmake -S . -B build-asan -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TESTING=ON -DANYPS5_ENABLE_ASAN=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON cmake --build build-asan --target agc_shader_memory_tests --parallel 4 ctest --test-dir build-asan -V -j1 --timeout 30 -R '^agc_shader_memory$' ``` Our configure additionally reuses the existing current-revision FFmpeg package with `FFMPEG_PREBUILT_DIR`. The loader resolves the test's `libc.prx` from this ASan build's own `core/libs/libs/unpatched` directory; `LD_LIBRARY_PATH` is empty, so this is not a stale runtime override. ### Controls and scope - Exact main above: configure/build pass; CTest exits 8 with the mismatch, before the first region-vector assignment at line 829. The baseline has leak detection disabled; allocation-mismatch checking remains enabled. - Lifetime-only fix `e3b8707988421618f3b33092af69cd00ca5e637d`, same base/build: ASan again stops at `verifyFrontendPair` with the same mismatch, this time with default `ASAN_OPTIONS`. Ordinary Linux and Windows shader-memory runs each pass 5/5. No allocation-mismatch suppression is applied. - This blocks the attempted full-fixture sanitizer comparison for #7754; it is not evidence that the lifetime correction failed or that sanitizer validation passed. No game, GPU or production-crash claim is made. Expected next step: isolate the allocation/deallocation pairing or sanitizer/interposition incompatibility so this fixture can reach the remaining tests under ASan. No runtime workaround or code change is proposed here. AI-assisted investigation/report: yes, Codex. <!-- codex-7765-resolution-v1 --> ### Resolution status Fixed upstream by #7781 (merged 2026-10-19). The fixture now routes nothrow allocation through its own `operator new`, pairing `stable_sort` temporary allocations with its free-based delete. The PR reports an isolated ASan reproduction passing with allocation-mismatch checking enabled; its author could not execute the full fixture on that host because of the CPU-feature precondition. Our earlier main46f/e3b failures remain historical evidence, and a fresh full-fixture instrumented run on the combined newer source is still pending here.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5#7765
No description provided.