ci(relinker): run TLS function coverage tests under ASan on Linux #7096

Closed
pushkarreddyy wants to merge 1 commit from upstream-pr/7096 into main
pushkarreddyy commented 2026-10-17 11:20:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-17T11:20:45Z.


What

Runs the relinker TLS function coverage tests (-L tls_function_coverage) under AddressSanitizer (-DANYPS5_ENABLE_ASAN=ON) on Linux in the existing
elinker workflow job using a Debug build with --no-tests=error.

In #6401, a 1-byte read past EOF in WindowsTlsBuilder.cpp was fixed and the segment-prefix-at-eof case was added. As noted in #7062 and demonstrated by @inmert in #7097, GCC at -O3 (Release) does not emit the unreferenced load and can mask the overread; building with -DCMAKE_BUILD_TYPE=Debug ensures ASan reliably catches the heap-buffer-overflow in ls_function_coverage_rejected whenever the bounds check is reverted.

Closes #7062.

Tested

  • python tools/check_conventions.py --base origin/main passed cleanly with 0 findings.
  • Relinker ASan step builds with -DCMAKE_BUILD_TYPE=Debug and runs -L tls_function_coverage --no-tests=error.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: #7062
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4899625566 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7096). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-17T11:20:45Z. --- ### What Runs the relinker TLS function coverage tests (-L tls_function_coverage) under AddressSanitizer (-DANYPS5_ENABLE_ASAN=ON) on Linux in the existing elinker workflow job using a Debug build with --no-tests=error. In #6401, a 1-byte read past EOF in WindowsTlsBuilder.cpp was fixed and the segment-prefix-at-eof case was added. As noted in #7062 and demonstrated by @inmert in #7097, GCC at -O3 (Release) does not emit the unreferenced load and can mask the overread; building with -DCMAKE_BUILD_TYPE=Debug ensures ASan reliably catches the heap-buffer-overflow in ls_function_coverage_rejected whenever the bounds check is reverted. Closes #7062. ### Tested - python tools/check_conventions.py --base origin/main passed cleanly with 0 findings. - Relinker ASan step builds with -DCMAKE_BUILD_TYPE=Debug and runs -L tls_function_coverage --no-tests=error. ### Checklist - [x] Based on current main; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation .md files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: #7062 - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-17 11:27:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-17T11:27:35Z.


Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 3962 .github/workflows/build.yml
PR 5920 .github/workflows/build.yml
PR 6044 .github/workflows/build.yml
PR 6932 .github/workflows/build.yml
PR 7332 .github/workflows/build.yml
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6233344483 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7096#issuecomment-6233344483). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-17T11:27:35Z. --- <!-- pr-overlap --> Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | [PR 3962](https://www.github.com/boykopovar/AnyPS5/pull/3962) | `.github/workflows/build.yml` | | [PR 5920](https://www.github.com/boykopovar/AnyPS5/pull/5920) | `.github/workflows/build.yml` | | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `.github/workflows/build.yml` | | [PR 6932](https://www.github.com/boykopovar/AnyPS5/pull/6932) | `.github/workflows/build.yml` | | [PR 7332](https://www.github.com/boykopovar/AnyPS5/pull/7332) | `.github/workflows/build.yml` |
pushkarreddyy commented 2026-10-17 13:27:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-17T13:27:09Z.


Hi @MarcZX100, following up on your comparison with #7097: #7096 is cleanly rebased on latest origin/main (04788b090), with all 31/31 TLS function coverage tests passing under AddressSanitizer in the hosted Linux relinker job. All CI checks are green and ready for review/merge whenever convenient!

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6234433019 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7096#issuecomment-6234433019). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-17T13:27:09Z. --- Hi @MarcZX100, following up on your comparison with #7097: #7096 is cleanly rebased on latest `origin/main` (`04788b090`), with all 31/31 TLS function coverage tests passing under AddressSanitizer in the hosted Linux relinker job. All CI checks are green and ready for review/merge whenever convenient!
MarcZX10 commented 2026-10-17 13:35:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T13:35:50Z.


The #7062 done-when asks that reverting the #6401 bounds check makes the ASan CI job fail. #7097's description reports that a separate Release+ASan control still passes all 31 TLS tests with the fix reverted, while its Debug+ASan run catches the heap-buffer-overflow in tls_function_coverage_rejected. Could you use Debug for this ASan job or coordinate with #7097 so the chosen job demonstrably catches the regression?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6234516222 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7096#issuecomment-6234516222). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-17T13:35:50Z. --- The #7062 done-when asks that reverting the #6401 bounds check makes the ASan CI job fail. #7097's description reports that a separate Release+ASan control still passes all 31 TLS tests with the fix reverted, while its Debug+ASan run catches the heap-buffer-overflow in `tls_function_coverage_rejected`. Could you use Debug for this ASan job or coordinate with #7097 so the chosen job demonstrably catches the regression?
pushkarreddyy commented 2026-10-17 13:44:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-17T13:44:36Z.


Hi @MarcZX100, thank you for catching that!

I have updated the Linux relinker ASan step to build with -DCMAKE_BUILD_TYPE=Debug and added --no-tests=error to ctest (commit d7d9d194e). As demonstrated by @inmert in #7097, Debug ensures GCC emits the unreferenced load and ASan reliably catches the heap-buffer-overflow in ls_function_coverage_rejected whenever the #6401 bounds check is reverted.

I kept the steps inside the existing Linux relinker job as you noted to avoid the extra runner slot/setup overhead, and credited @inmert in the PR description. Full CI is running cleanly now!

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6234607416 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7096#issuecomment-6234607416). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-17T13:44:36Z. --- Hi @MarcZX100, thank you for catching that! I have updated the Linux relinker ASan step to build with -DCMAKE_BUILD_TYPE=Debug and added --no-tests=error to ctest (commit d7d9d194e). As demonstrated by @inmert in #7097, Debug ensures GCC emits the unreferenced load and ASan reliably catches the heap-buffer-overflow in ls_function_coverage_rejected whenever the #6401 bounds check is reverted. I kept the steps inside the existing Linux relinker job as you noted to avoid the extra runner slot/setup overhead, and credited @inmert in the PR description. Full CI is running cleanly now!
simonbbby commented 2026-10-17 14:23:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by simonbbby on 2026-10-17T14:23:11Z.


Independent revert-negative check for the exact current #7096 head f297c8a39ea54db866dee26853bef011a9ec1145, addressing the #7062 done-when and the Debug-vs-Release review question.

Ubuntu 24.04 x86-64, GCC 13.3. I used the workflow's Debug, ANYPS5_RELINKER_ONLY=ON, ANYPS5_ENABLE_ASAN=ON, BUILD_TESTING=ON configuration and its CTest selection:

ctest --test-dir build-asan -L tls_function_coverage --output-on-failure --no-tests=error --timeout 120

ctest --show-only=json-v1 -L tls_function_coverage selects 31 tests, including tls_function_coverage_rejected.

Variant Result
Exact head, unchanged production code 31/31 pass, exit 0, 8.12 s
Only #6401's addressRegister conditional reverted 30/31 pass, exit 8, 8.16 s; tls_function_coverage_rejected fails
Fixed executable restored, targeted rejected-form test 1/1 pass, exit 0

The failing run contains AddressSanitizer: heap-buffer-overflow, READ of size 1, with its first frame in WindowsTlsBuilder::Build at the reverted bytes[position + 1] read (WindowsTlsBuilder.cpp:152). This is the intended EOF regression, rather than a missing-test or unrelated sanitizer failure.

For the negative arm I rebuilt only that source object using the original Debug+ASan compile command, replaced it in a copy of the production archive, and relinked the same CLI. All test sources and other objects stayed identical. The fixed binary was restored before the final passing test; repository source was not changed.

This verifies the local Linux workflow configuration and its sensitivity to the regression. I did not dispatch or modify a GitHub-hosted workflow run, and I did not repeat #7097's Release control.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6235034272 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7096#issuecomment-6235034272). Originally posted by [simonbbby](https://github.com/simonbbby) on 2026-10-17T14:23:11Z. --- Independent revert-negative check for the exact current #7096 head `f297c8a39ea54db866dee26853bef011a9ec1145`, addressing the #7062 done-when and the Debug-vs-Release review question. Ubuntu 24.04 x86-64, GCC 13.3. I used the workflow's `Debug`, `ANYPS5_RELINKER_ONLY=ON`, `ANYPS5_ENABLE_ASAN=ON`, `BUILD_TESTING=ON` configuration and its CTest selection: ```text ctest --test-dir build-asan -L tls_function_coverage --output-on-failure --no-tests=error --timeout 120 ``` `ctest --show-only=json-v1 -L tls_function_coverage` selects **31 tests**, including `tls_function_coverage_rejected`. | Variant | Result | |---|---| | Exact head, unchanged production code | **31/31 pass**, exit 0, 8.12 s | | Only #6401's `addressRegister` conditional reverted | **30/31 pass**, exit 8, 8.16 s; `tls_function_coverage_rejected` fails | | Fixed executable restored, targeted rejected-form test | **1/1 pass**, exit 0 | The failing run contains `AddressSanitizer: heap-buffer-overflow`, **`READ of size 1`**, with its first frame in `WindowsTlsBuilder::Build` at the reverted `bytes[position + 1]` read (`WindowsTlsBuilder.cpp:152`). This is the intended EOF regression, rather than a missing-test or unrelated sanitizer failure. For the negative arm I rebuilt only that source object using the original Debug+ASan compile command, replaced it in a copy of the production archive, and relinked the same CLI. All test sources and other objects stayed identical. The fixed binary was restored before the final passing test; repository source was not changed. This verifies the local Linux workflow configuration and its sensitivity to the regression. I did not dispatch or modify a GitHub-hosted workflow run, and I did not repeat #7097's Release control.
pushkarreddyy commented 2026-10-17 14:42:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-17T14:42:41Z.


Thank you so much @simonbbby for running the independent revert-negative validation on Ubuntu 24.04 with GCC 13.3! Really appreciate you verifying that the Debug+ASan configuration cleanly passes all 31/31 tests on the current head and reliably catches the heap-buffer-overflow in \ ls_function_coverage_rejected\ when the check is reverted.

Ready for review/merge whenever convenient!

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6235231776 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7096#issuecomment-6235231776). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-17T14:42:41Z. --- Thank you so much @simonbbby for running the independent revert-negative validation on Ubuntu 24.04 with GCC 13.3! Really appreciate you verifying that the Debug+ASan configuration cleanly passes all 31/31 tests on the current head and reliably catches the heap-buffer-overflow in \ ls_function_coverage_rejected\ when the check is reverted. Ready for review/merge whenever convenient!
blawesom commented 2026-10-17 18:51:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-17T18:51:34Z.


Rebase handoff — rebased onto current main (authorship unchanged). One conflict in .github/workflows/build.yml: main's newer --parallel 4 ctest line kept, followed by your ASan TLS-coverage job.

Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON, AMD RX 9070 XT / RADV): builds; conventions pass; full suite green apart from the known main regression (agc_driver_tessellation segfault — Mesa, #5444), not this PR.

To pick it up:

git fetch https://github.com/blawesom/AnyPS5 rebase/7096
git checkout <your branch>
git merge --ff-only FETCH_HEAD

Head is 577521a36.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6238945677 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7096#issuecomment-6238945677). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-17T18:51:34Z. --- **Rebase handoff** — rebased onto current `main` (authorship unchanged). One conflict in `.github/workflows/build.yml`: `main`'s newer `--parallel 4` ctest line kept, followed by your ASan TLS-coverage job. Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, `BUILD_TESTING=ON`, AMD RX 9070 XT / RADV): builds; conventions pass; **full suite green apart from the known `main` regression** (`agc_driver_tessellation` segfault — Mesa, #5444), not this PR. **To pick it up:** ``` git fetch https://github.com/blawesom/AnyPS5 rebase/7096 git checkout <your branch> git merge --ff-only FETCH_HEAD ``` Head is `577521a36`.
pushkarreddyy commented 2026-10-18 02:34:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-18T02:34:38Z.


Closing as superseded by #7097, which introduced the dedicated relinker-asan workflow job to address #7062.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6244776722 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7096#issuecomment-6244776722). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-18T02:34:38Z. --- Closing as superseded by #7097, which introduced the dedicated `relinker-asan` workflow job to address #7062.

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
boykopovar/AnyPS5!7096
No description provided.