CI: run the runtime tests under ASan and UBSan on Linux #34

Closed
Andretuta wants to merge 7 commits from upstream-pr/34 into main
Andretuta commented 2026-11-24 02:04:20 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Andretuta on 2026-11-24T02:04:20Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5464683456 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/34). Originally posted by [Andretuta](https://github.com/Andretuta) on 2026-11-24T02:04:20Z. --- > 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`).
MoonEyes commented 2026-11-30 17:36:06 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-30T17:36:06Z.


Maintainer review: not ready to merge. This remains a draft, conflicts with main, and all CI checks for its current run were cancelled. The description references only the old-repository claim, not a current claim in the coordination issue. Please resolve the conflict, add/confirm the current claim, mark ready, and request review before validation.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7286562428 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/34#issuecomment-7286562428). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-30T17:36:06Z. --- Maintainer review: not ready to merge. This remains a draft, conflicts with main, and all CI checks for its current run were cancelled. The description references only the old-repository claim, not a current claim in the coordination issue. Please resolve the conflict, add/confirm the current claim, mark ready, and request review before validation.
aslan2142 commented 2026-12-01 10:41:40 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T10:41:40Z.

Review: COMMENTED


Reviewed the diff against current main: adding a linux-sanitizers ASan/LSan/UBSan job to .github/workflows/runtime.yml is valuable, but this carried-over draft (old-pr/3014) currently conflicts with main in .github/workflows/runtime.yml and had all CI runs cancelled on creation.

To move forward, please rebase onto main (reconciling tests/test_cmake_vulkan_missing.py's RuntimeWorkflowJobOwnershipTest with the current macos job layout on main), add a current coordination-issue claim, mark ready for review, and run CI so linux-sanitizers is verified live.

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6129629081 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/34#pullrequestreview-6129629081). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T10:41:40Z. **Review:** COMMENTED --- Reviewed the diff against current `main`: adding a `linux-sanitizers` ASan/LSan/UBSan job to `.github/workflows/runtime.yml` is valuable, but this carried-over draft (`old-pr/3014`) currently conflicts with `main` in `.github/workflows/runtime.yml` and had all CI runs cancelled on creation. To move forward, please rebase onto `main` (reconciling `tests/test_cmake_vulkan_missing.py`'s `RuntimeWorkflowJobOwnershipTest` with the current `macos` job layout on `main`), add a current coordination-issue claim, mark ready for review, and run CI so `linux-sanitizers` is verified live. *(AI-assisted review.)*
aslan2142 commented 2026-12-01 12:03:58 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T12:03:58Z.


Marking Ready for Review since no WIP/blocker reason for draft status is specified on this PR, so it can enter normal CI and review.

(AI-assisted triage.)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7310599538 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/34#issuecomment-7310599538). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T12:03:58Z. --- Marking Ready for Review since no WIP/blocker reason for draft status is specified on this PR, so it can enter normal CI and review. *(AI-assisted triage.)*
aslan2142 commented 2026-12-01 12:56:35 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T12:56:35Z.

Review: CHANGES_REQUESTED


Now ready for review, requesting changes before merge:

  • Merge conflicts (CONFLICTING/DIRTY): conflicts with main in .github/workflows/runtime.yml.
  • Workflow test alignment: reconcile RuntimeWorkflowJobOwnershipTest in tests/test_cmake_vulkan_missing.py with the current macos job structure on main.
  • CI: all checks from 2026-11-24 were cancelled. Please rebase onto current main and get fresh green CI.

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6131682526 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/34#pullrequestreview-6131682526). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T12:56:35Z. **Review:** CHANGES_REQUESTED --- Now ready for review, requesting changes before merge: - **Merge conflicts (`CONFLICTING`/`DIRTY`)**: conflicts with `main` in `.github/workflows/runtime.yml`. - **Workflow test alignment**: reconcile `RuntimeWorkflowJobOwnershipTest` in `tests/test_cmake_vulkan_missing.py` with the current `macos` job structure on `main`. - **CI**: all checks from 2026-11-24 were cancelled. Please rebase onto current `main` and get fresh green CI. *(AI-assisted review.)*
aslan2142 commented 2026-12-01 17:19:43 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T17:19:43Z.


Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7319123396 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/34#issuecomment-7319123396). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T17:19:43Z. --- Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.

Pull request closed

Sign in to join this conversation.
No reviewers
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
ProjectLeonida/mandy!34
No description provided.