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

Open
github-bot wants to merge 7 commits from github-bot/gh-34 into main AGit
Owner

@⁠Andretuta on GitHub · 2026-11-24 02:04 UTC · original
ubiquitarianism:old-pr/3014 → main · +85 −2 · 2 files · 7 commits · draft

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

**@⁠Andretuta** on GitHub · 2026-11-24 02:04 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/34) `ubiquitarianism:old-pr/3014` → `main` · +85 −2 · 2 files · 7 commits · draft > 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`).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:41:47 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/34/head:github-bot/gh-34'
git switch 'github-bot/gh-34'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-34'
git switch 'github-bot/gh-34'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-34'
git switch 'github-bot/gh-34'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-34'
git switch 'main'
git merge --squash 'github-bot/gh-34'
git switch 'main'
git merge --ff-only 'github-bot/gh-34'
git switch 'main'
git merge 'github-bot/gh-34'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.