[PR #34] CI: run the runtime tests under ASan and UBSan on Linux #87

Open
opened 2026-11-26 20:16:45 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/34
Author: @Andretuta
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: old-pr/3014


📝 Commits (7)

  • 12cd589 CI: run the runtime tests under ASan and UBSan on Linux
  • e4ff325 CI: fail the sanitizer job's configure when Vulkan headers are missing, like linux-gpu-tools
  • 42a3d3b CI: keep llvmpipe loaded in the sanitizer job so LeakSanitizer doesn't report the driver's allocations
  • 65eba25 CI: use pinned Vulkan 1.4.363 headers in sanitizer job
  • 9528b5e CI: cap ASan quarantine and clarify the sanitizer job comment
  • c6ce345 CI: correct the ASan quarantine comment
  • da184d2 CI: restore macOS step ownership after the rebase and guard it

📊 Changes

2 files changed (+85 additions, -2 deletions)

View changed files

📝 .github/workflows/runtime.yml (+61 -2)
📝 tests/test_cmake_vulkan_missing.py (+24 -0)

📄 Description

Carried over from old PR 3014 by ray3242 in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/3014, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
ray3242: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

Claimed in the coordination issue as: new TEST item, claim

What and why

No workflow builds runtime/ with sanitizers. An out-of-bounds read, a leak or undefined behaviour in the portable code (shader_library.h parsers and zlib inflate, resource_tiling.h, frame_pacer.h, descriptor and replay helpers) only shows up as a wrong result on some machine, if at all.

This adds a linux-sanitizers job to runtime.yml. It installs Vulkan headers and llvmpipe like linux-gpu-tools, builds runtime/ with -fsanitize=address,undefined -fno-sanitize-recover=all -fno-omit-frame-pointer (GCC, RelWithDebInfo, sccache, -DLEONIDA_REQUIRE_VULKAN=ON so missing headers fail the configure instead of silently dropping the Vulkan tests), and runs ctest with LeakSanitizer on. Any sanitizer report fails the test and the job. The existing jobs are unchanged.

The job sets VK_LOADER_DISABLE_DYNAMIC_LIBRARY_UNLOADING=1. Without it, the Vulkan loader unloads llvmpipe at vkDestroyInstance, and LeakSanitizer reports 112 bytes (2 allocations, made on a driver thread) that llvmpipe still holds, in vk_command_replay, with every frame in <unknown module>. With the driver kept loaded, the report goes away: those bytes are still referenced from the driver. The Khronos validation layer reports no undestroyed objects for that test, so the test frees what it creates. This loader setting exists for leak sanitizers. Leaks in the runtime's own code are still reported.

Tested

Rebased on main 4c52ce27. In an ubuntu:24.04 container (GCC 13.3, Mesa 25.2.8 llvmpipe, Vulkan loader 1.3.275, no GPU), fresh build with the job's exact configure flags and environment:

  • ctest --test-dir <build> --output-on-failure: 43/45 passed under ASan, UBSan and LSan, 0 failed. shader_library_corpus and vk_sync_validation skip as they do in the normal build (no game folder, no validation layer).
  • vk_command_replay without VK_LOADER_DISABLE_DYNAMIC_LIBRARY_UNLOADING: the 112-byte LSan report in 10 out of 10 runs. With it: clean. With the llvmpipe ICD preloaded instead: also clean. With VK_LAYER_KHRONOS_validation: no errors.
  • actionlint passes on runtime.yml.

AI-assisted (Devin).

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

Rebased onto main 561b65a8 (head da184d231). The earlier Depends on: #3869 is obsolete: commit b1fef650 pins the Vulkan-Headers checkout in this job, so the build no longer depends on that PR. The macOS job's Configure/Build/test steps stay with macos (guarded by RuntimeWorkflowJobOwnershipTest).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/34 **Author:** [@Andretuta](https://github.com/Andretuta) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `old-pr/3014` --- ### 📝 Commits (7) - [`12cd589`](https://github.com/ubiquitarianism/leonida/commit/12cd5891a67548fdce5154ed6352135384a25fc5) CI: run the runtime tests under ASan and UBSan on Linux - [`e4ff325`](https://github.com/ubiquitarianism/leonida/commit/e4ff3253d63e8ce908cf24fc9ace88fcd4a8b220) CI: fail the sanitizer job's configure when Vulkan headers are missing, like linux-gpu-tools - [`42a3d3b`](https://github.com/ubiquitarianism/leonida/commit/42a3d3b8824586961ab2063bd30dc2e0ce4513fd) CI: keep llvmpipe loaded in the sanitizer job so LeakSanitizer doesn't report the driver's allocations - [`65eba25`](https://github.com/ubiquitarianism/leonida/commit/65eba251bf7694dcda89152c9273e0d42e67d24f) CI: use pinned Vulkan 1.4.363 headers in sanitizer job - [`9528b5e`](https://github.com/ubiquitarianism/leonida/commit/9528b5e2626f895efef9b7482106223c0315c0b7) CI: cap ASan quarantine and clarify the sanitizer job comment - [`c6ce345`](https://github.com/ubiquitarianism/leonida/commit/c6ce3450b88929f5e38e36e4b8853fbdc5278977) CI: correct the ASan quarantine comment - [`da184d2`](https://github.com/ubiquitarianism/leonida/commit/da184d231451d34f0c049741f8aa80564e6998db) CI: restore macOS step ownership after the rebase and guard it ### 📊 Changes **2 files changed** (+85 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/runtime.yml` (+61 -2) 📝 `tests/test_cmake_vulkan_missing.py` (+24 -0) </details> ### 📄 Description > Carried over from **old PR 3014** by `ray3242` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/3014`, exactly that PR's last commit. All carried-over PRs are listed in #17. > Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it. > `ray3242`: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one. --- Original description (mentions and `#N` references are disabled; the numbers refer to the old repository): Claimed in the coordination issue as: new TEST item, [claim](https://github.com/ItsNotRexed/Leonida/issues/2891#issuecomment-7084006938) ### What and why No workflow builds `runtime/` with sanitizers. An out-of-bounds read, a leak or undefined behaviour in the portable code (`shader_library.h` parsers and zlib inflate, `resource_tiling.h`, `frame_pacer.h`, descriptor and replay helpers) only shows up as a wrong result on some machine, if at all. This adds a `linux-sanitizers` job to `runtime.yml`. It installs Vulkan headers and llvmpipe like `linux-gpu-tools`, builds `runtime/` with `-fsanitize=address,undefined -fno-sanitize-recover=all -fno-omit-frame-pointer` (GCC, RelWithDebInfo, sccache, `-DLEONIDA_REQUIRE_VULKAN=ON` so missing headers fail the configure instead of silently dropping the Vulkan tests), and runs `ctest` with LeakSanitizer on. Any sanitizer report fails the test and the job. The existing jobs are unchanged. The job sets `VK_LOADER_DISABLE_DYNAMIC_LIBRARY_UNLOADING=1`. Without it, the Vulkan loader unloads llvmpipe at `vkDestroyInstance`, and LeakSanitizer reports 112 bytes (2 allocations, made on a driver thread) that llvmpipe still holds, in `vk_command_replay`, with every frame in `<unknown module>`. With the driver kept loaded, the report goes away: those bytes are still referenced from the driver. The Khronos validation layer reports no undestroyed objects for that test, so the test frees what it creates. This loader setting exists for leak sanitizers. Leaks in the runtime's own code are still reported. ### Tested Rebased on main 4c52ce27. In an `ubuntu:24.04` container (GCC 13.3, Mesa 25.2.8 llvmpipe, Vulkan loader 1.3.275, no GPU), fresh build with the job's exact configure flags and environment: - `ctest --test-dir <build> --output-on-failure`: 43/45 passed under ASan, UBSan and LSan, 0 failed. `shader_library_corpus` and `vk_sync_validation` skip as they do in the normal build (no game folder, no validation layer). - `vk_command_replay` without `VK_LOADER_DISABLE_DYNAMIC_LIBRARY_UNLOADING`: the 112-byte LSan report in 10 out of 10 runs. With it: clean. With the llvmpipe ICD preloaded instead: also clean. With `VK_LAYER_KHRONOS_validation`: no errors. - `actionlint` passes on `runtime.yml`. AI-assisted (Devin). ### Checklist - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) Rebased onto main `561b65a8` (head `da184d231`). The earlier `Depends on: #3869` is obsolete: commit `b1fef650` pins the Vulkan-Headers checkout in this job, so the build no longer depends on that PR. The macOS job's Configure/Build/test steps stay with `macos` (guarded by `RuntimeWorkflowJobOwnershipTest`). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#87
No description provided.