fix(libc): check qsort_s arguments as titles' libc.prx does #12598

Merged
JJenkx merged 11 commits from upstream-pr/12598 into main 2026-11-11 22:07:10 +00:00
JJenkx commented 2026-10-28 22:20:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-28T22:20:48Z.


Current-main integration — 2026-11-05. Exact head dcb4925e80a2450ba153730c71e132c4a643ffac retains previous public 3529e1b3ba9f0d6e725a582de84c01506a8e97ed and tested main 6d173c1a19788ff69d43b3d0ca62833e312ef939 as ancestors. The measured qsort_s function remains byte-identical to the previous public head. Main’s qsort_r and unrelated routines are retained. The accepted zero-size host no-op and the documented bundled-module extreme-boundary SIGFPE caveat remain; no new reference result is claimed.

Linux x86-64, GCC16.2.1, Ninja Release: actual production modules and focused fixture owners rebuilt; 4/4 runtime tests pass, zero skips: guest_qsort, guest_bounds_checking, guest_safe_errors, guest_crt. Matching pinned main passes all25 selected baseline groups. Production NID patching, conventions/whitespace, and MinGW syntax for FileAndHeap.cpp pass.

Public-header audit: failed on both pinned main and this head with the same five missing WKSecurityOrigin* declarations (Create, CopyToString, CopyHost, CopyProtocol, GetPort), with no additional declaration errors. The failure is retained in the logs; no all-green header/full-suite claim is made. The concrete shared-main repair is #16010, exact head 545e24b2ee2e549001421f7fc9f87ff801f3423c. Its independent qualification reports a green audit of 406 libraries/30,572 exports and two standalone units compiled by each of GCC and MinGW. A maintainer still needs to merge that repair and rerun the affected checks; this unmodified qualification tree is not relabelled header-green.

The older-main Windows DepthSurface::createSampleShadow allocation compile error is already corrected by merged #15855. This head contains that fix, and its DepthSurface.cpp/ImageMemory.hpp blobs match the fixing source. The fix’s hosted Windows build passed; that is attributed upstream evidence, not a Windows build/runtime result for this head. No duplicate AGC change was added. A final merge preview against newer main 7ad9749ed0311cc91d69bc7c690d09c92b9d42d0 is clean; qualification remains pinned to 6d173c1a19788ff69d43b3d0ca62833e312ef939.

Source/parent/provider/gitlink proofs, commands, raw logs, JUnit, hashes and known baseline failure. Historical platform, module-reference and performance reports below retain their original pins; no new Windows/macOS, SDK/physical-console, title/GPU or performance run.

Earlier pinned reports and the contribution template follow.

What

qsort_s now checks its arguments the way the libc.prx that titles ship does. Measured natively on PPSA07923 and PPSA05916, which agree:

  • Size limit: a count or element size above SIZE_MAX >> 3 (2^61 and up) is a violation.
    • On main the limit was SIZE_MAX >> 1, so a count from 2^61 to 2^63 was accepted and sorted past the array: the comparison run crashed there.
  • Message: every violation is reported as "qsort_s: bad argument", with EINVAL and a null pointer. On main each case had its own message, such as "qsort_s : n > RSIZE_MAX" or "qsort_s : a == NULL".

The rest already matched the titles and is unchanged:

  • n == 0 with a null base or comparator is accepted;
  • an element size of 0 sorts nothing;
  • the array is untouched on a violation.

bsearch_s already matched on every case below, so it doesn't change. The debt entry, which said the console's behaviour was unverified, now states the measured rule.

Merge note for my #9688 (the qsort and qsort_s sort order): the two PRs edit the same qsort_s debt entry, which conflicts textually. The resolution is #9688's entry with two changes:

  • its sentence "It returns EINVAL after calling the constraint handler when n or es exceeds RSIZE_MAX, or when n is not 0 and a or cmp is null" becomes this PR's measured sentence;
  • "The console's constraint handling is unverified" is dropped.

The code and the tests merge cleanly.

Tested

Current-main refresh — 2026-11-04. Head 3529e1b3ba9f0d6e725a582de84c01506a8e97ed merges main 9ab6a281ea61c9e62a7eb07eb4cef8f19ede1c5c while retaining the prior public head as an ancestor. Main’s newer code, regression fixtures and debt entries are preserved alongside this topic.

Linux x86-64, GCC16.2.1, Ninja Release: actual libc, libkernel and libSceAmpr CMake owners rebuilt coherently. guest_qsort, guest_bounds_checking, guest_safe_errors, guest_crt each pass three consecutive runs (12 passes, zero skips). The same groups pass three times on pinned main. Public-header audit and conventions pass. Original licence-notice trailing whitespace is retained where present. The scoped recipe reuses frozen ZArchive/zstd providers; this is not a whole-project build. No new Windows, bundled-SDK, physical-console, title/GPU or FPS measurement is claimed; earlier reports retain their original pins.

Exact source/parent proofs, per-branch patches/input manifests, build and CTest logs/JUnit, library/executable hashes and scoped CMake recipe, SHA-256 97a2377bc996be1690e8853e1ea090a98b5ed808bcc37a15a5cdada5c2e00845 (download verified). AI-assisted: yes (Codex).

Current-main integration — 2026-11-04. Head 1be723b023bdbb8caa47c13118bf19c7ce8d6f39 includes main b11c7bf84f5d2f636ff60166cc3371bd071e24d5 and preserves previous public commits and attribution/licence notices. Retains the measured qsort_s bounds and safe zero-size host no-op policy, including the explicit PPSA07923 extreme-boundary SIGFPE caveat. Main’s separate reentrant helper block and qsort_r body are byte-identical; no native return is invented for the faulting row.

Linux x86-64, GCC 16.2.1, Ninja Release, BUILD_TESTING=ON: rebuilt actual libc/Ampr and selected executables. guest_qsort, guest_bounds_checking, guest_safe_errors, guest_crt each pass 3/3 (12 runtime passes, zero skips); public_headers, conventions and whitespace checks pass. Pinned main passes all 17 selected baseline groups 3/3 (51 passes) plus headers. Before/after dependency checks agree: 34 recursive trees and 31,551 tracked blobs, zero errors; the update=none QuickJS test262 corpus is explicitly excluded from these library inputs.

Source/parent/gitlink proofs, library/test hashes, raw logs/JUnit and head-leased push receipts: qualification archive, SHA-256 7c347f620951ad6f39068740750949212c6412815da094a46a96eca1d15c8bbf (download verified). Older platform, stress, negative-control and reference reports retain their original pins; no new Windows/macOS, full-suite, SDK-module, console, title/GPU or performance claim. AI-assisted: yes (Codex).

Earlier dated qualifications below retain their original source/platform pins.

Windows 11, WinLibs GCC 15.2.0 UCRT r7, Release, main 319621ba2e.

  • Native comparison: a scratch loader calls the titles' qsort_s and bsearch_s by NID next to this build's, with the same recording handler on both sides. It runs 25 cases:

    • a valid call;
    • n == 0 with a null base or comparator;
    • an element size of 0;
    • a null base, a null comparator, and (for bsearch_s) a null key;
    • counts and sizes at 2^61, 2^62 and 2^63.

    Each case compares the return value, the array order or found element, and the handler's calls, error, pointer and message.

    main this PR
    qsort_s (12 cases) 2 of the first 6 differ (the messages), then the run crashes at n = 2^61 0
    bsearch_s (13 cases) 0 0

    Both titles give the same results.

  • Regression: guest_qsort's constraint check expects the titles' message, and adds count and size cases at 2^61 (one with n == 0). With the previous FileAndHeap.cpp it fails.

  • Test set: guest_qsort, guest_bounds_checking, guest_safe_errors and guest_crt pass 3/3. Conventions pass.

Current Linux qualification and native boundary limitation — 2026-10-29

Refreshed against main 5454cd2e455994d992aca39335ce60507eeda1eb. The refreshed #9688 head 1c8ac1874c0ed5ccafef5112d59da6739d4a2fb6 is an actual ancestor.

Linux qualification at d8bcdb2ce313bd8ceeb9ebdc67c02200bc3dedea (Arch Linux 7.2.9, Ryzen 9 7950X, GCC 16.2.1, Ninja Release, BUILD_TESTING=ON): guest_qsort, guest_bounds_checking, guest_safe_errors, guest_crt each pass three consecutive runs (12/12, no skips). The public_headers audit passes at this exact head. All tracked public-header files match the pinned main; the affected test targets rebuild against those headers. Conventions and whitespace checks pass. The same focused groups passed three times on the pinned main.

The restack preserves the existing safe zero-size no-op rule around the new parent sort interface. The original bundle qualifies historical head d8bcdb2ce313; the following supplemental test/debt correction supersedes its extreme-count return-zero assertion.

Narrowed the count-limit regression in c6cfa7cfd9dbff57752dab24b5574af9d8037822. The count=SIZE_MAX>>3, size=0 invocation remains, followed by the existing cumulative handler-count check, but it no longer asserts a native return of zero. That is a host constraint-guard check only. The separately measured count=1, size=SIZE_MAX>>3 case still requires return0, and the handler-pointer checks remain. Production is unchanged.

The new oracle evidence covers one existing PPSA07923 bundled module on Linux (unwrapped SHA-256 51ae8427c4a302abb1b6378fe65af69d4206d077006660eef4ee0e304e1e9e85). The size-limit/count-one case returns0 with no handler/comparator call and an unchanged canary. A rejected count=2^61,size=0 control returns22 and calls the handler with the expected message, error22 and null pointer. The proposed count-limit/zero-size case instead faults with SIGFPE in original SDK integer division at module offset0x6a3cd. No returned value or handler/comparator/canary outcome was recorded for that faulting case, so none is inferred. The debt entry now records this mismatch with the unchanged safe host no-op policy.

Linux Release, Ryzen9 7950X, GCC16.2.1: guest_qsort, guest_bounds_checking, guest_safe_errors and guest_crt each pass3runs (12 checks), plus the public_headers audit (1), zero skips. Conventions and whitespace pass. This follow-up adds no new native execution; the separate oracle observations are not physical-console, Windows, PPSA05916 or other-SDK results. A question for review: is retaining this documented safe host no-op and scoping the extreme-count test to the constraint guard appropriate, given the observed SDK fault?

AI-assisted: yes (Codex).

Evidence: current-head test/debt supplement, SHA-256 ad0c252cb06d3851b838e347f70967a7a7181c6603336af3adb242eb8c3f72be; sanitized native-oracle logs and identity proof, SHA-256 8c5193f4cd7a2214932889221e3be6800f9ddf9d687153b3252d701b912bb1dd; original rebase qualification, SHA-256 53b095da2f67f55b8aa56ba273681e0330fb39739be844458038dde410fb8cc4. No fresh Windows runtime is claimed here.

Earlier qualification — 2026-10-30

Integrated current main 08a10d225306ad102b57408e2ef7566bcfb829b2 into this existing topic at 9125fed5190f6e1e14ec0ec96da721a6e4d256b6. Includes actual refreshed #9688 parent ae15d0493797e9d40b2ab2eedbf202abf14c90e3. Current-main functions, fixtures, unrelated debt rows and exact dependency gitlinks are preserved; original topic functions and authored commits are retained. The documented PPSA07923 extreme zero-size SIGFPE observation and unchanged safe host no-op remain; the huge-count zero-size test invokes the call and checks the host handler guard without claiming an unsupported native return.

Rebuilt actual Linux libc and focused test binaries. guest_qsort, guest_bounds_checking, guest_safe_errors, guest_crt each passed three consecutive runs (12 runtime passes), plus public_headers; conventions and whitespace checks pass. Pinned main passed all seven selected runtime suites plus the header audit three times (24 runs). This is focused Linux CPU qualification; prior Windows/reference evidence retains its original pins. No new Windows, console, SDK-module, title, GPU or performance claim. AI-assisted: yes.

Evidence: https://github.com/JJenkx/AnyPS5/releases/download/linux-validation-20261023/owned-math6-main08a10-linux-20261030.tar.gz (SHA-256 b984a6334dce65b5c9148e3791ba21605074a5e762ea0f07f96de2f38062ef6e).

Qualification update — 2026-10-30, repeat 2

Integrated pinned main e471817c68d4e1b1e44b0ce369ed88bafe4ae8ed at 6fd92b781782253c45445523a3d00f44a38de7e0, retaining original topic commits as ancestors. Actual parent ancestry: #9688 1f001f3f23c74bf5dee00803644f2f17c82ac994. Main qsort_r retains its full FreeBSD helper/comparator behavior under private Reentrant-prefixed names; both sort implementations and every main qsort_r fixture are retained. Exact rename-normalized helper proof is attached. The PPSA07923 extreme-count zero-size SIGFPE debt caveat and unchanged safe host no-op are preserved; no unsupported native return is asserted.

Actual Linux libc/focused binaries rebuilt from this final head; guest_qsort, guest_bounds_checking, guest_safe_errors, guest_crt each pass three consecutive runs (12 runtime passes), plus public_headers. Conventions against current origin/main and whitespace pass. Pinned main passed all seven runtime groups plus the header audit three times (24 runs). Full source/function/test/debt/header and 31 recursive dependency / 17,742 tracked-blob proofs are attached. Later main 1c6b316cf762 has 17 off-topic commits, no relevant libc/numeric/qsort/gitlink changes, and all 9 merge previews are clean; those preview trees were not executed.

Focused Linux CPU scope only: prior Windows/SDK/reference reports keep original pins. The Linux portion makes no fresh Windows, console, SDK-module, title/GPU or speed measurement is claimed by this report. AI-assisted: yes. Evidence: https://github.com/JJenkx/AnyPS5/releases/download/linux-validation-20261023/owned-math9-maine471-linux-20261030-repeat2.tar.gz (SHA256 5da4ce1732b45bb3fc566c31078c8c9ae8bf0c403654dfc60d15ee28490e20bf).

Actual Windows qualification at exact published 6fd92b781782253c45445523a3d00f44a38de7e0: Windows 11 Enterprise 10.0.22621, Ryzen 9 5950X, WinLibs GCC 15.2 UCRT r7, Ninja Release, BUILD_TESTING=ON. Rebuilt patched libc and guest_qsort_tests, then ran guest_qsort three times: 3/3 passes, zero skips. This checks the composed main qsort_r and branch sorting fixtures at the recorded head; no timing, SDK/game/GPU/console/macOS claim. Raw build/CTest/JUnit logs, DLL digest and terminal Windows FIFO receipt are included in https://github.com/JJenkx/AnyPS5/releases/download/linux-validation-20261023/owned-current-windows-20261030-repeat2.tar.gz, SHA256 e423c97373758bf59239e02c138b74f35f1a45488793bc92878a4c836f94a584. AI-assisted: yes (Codex).

AI-assisted: yes (Codex).

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 (#9688 merged 2026-11-02; the actual refreshed parent ae15d0493797e9d40b2ab2eedbf202abf14c90e3 remains an ancestor, and the measured boundary limits and documented safe host no-op remain)
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes (Claude Code)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5058610560 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12598). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-10-28T22:20:48Z. --- <!-- cpu-main6d173-refresh-20261105-12598 --> **Current-main integration — 2026-11-05.** Exact head `dcb4925e80a2450ba153730c71e132c4a643ffac` retains previous public `3529e1b3ba9f0d6e725a582de84c01506a8e97ed` and tested main `6d173c1a19788ff69d43b3d0ca62833e312ef939` as ancestors. The measured qsort_s function remains byte-identical to the previous public head. Main’s qsort_r and unrelated routines are retained. The accepted zero-size host no-op and the documented bundled-module extreme-boundary SIGFPE caveat remain; no new reference result is claimed. Linux x86-64, GCC16.2.1, Ninja Release: actual production modules and focused fixture owners rebuilt; **4/4 runtime tests pass, zero skips**: `guest_qsort`, `guest_bounds_checking`, `guest_safe_errors`, `guest_crt`. Matching pinned main passes all25 selected baseline groups. Production NID patching, conventions/whitespace, and MinGW syntax for `FileAndHeap.cpp` pass. **Public-header audit: failed on both pinned main and this head with the same five missing `WKSecurityOrigin*` declarations** (`Create`, `CopyToString`, `CopyHost`, `CopyProtocol`, `GetPort`), with no additional declaration errors. The failure is retained in the logs; no all-green header/full-suite claim is made. The concrete shared-main repair is [#16010](https://github.com/boykopovar/AnyPS5/pull/16010), exact head `545e24b2ee2e549001421f7fc9f87ff801f3423c`. Its independent qualification reports a green audit of 406 libraries/30,572 exports and two standalone units compiled by each of GCC and MinGW. A maintainer still needs to merge that repair and rerun the affected checks; this unmodified qualification tree is not relabelled header-green. The older-main Windows `DepthSurface::createSampleShadow` allocation compile error is already corrected by merged [#15855](https://github.com/boykopovar/AnyPS5/pull/15855). This head contains that fix, and its DepthSurface.cpp/ImageMemory.hpp blobs match the fixing source. The fix’s [hosted Windows build passed](https://github.com/boykopovar/AnyPS5/actions/runs/41901908835/job/126840906295); that is attributed upstream evidence, not a Windows build/runtime result for this head. No duplicate AGC change was added. A final merge preview against newer main `7ad9749ed0311cc91d69bc7c690d09c92b9d42d0` is clean; qualification remains pinned to `6d173c1a19788ff69d43b3d0ca62833e312ef939`. [Source/parent/provider/gitlink proofs, commands, raw logs, JUnit, hashes and known baseline failure](https://github.com/JJenkx/AnyPS5/releases/download/linux-validation-20261023/cpu5-main6d173-linux-20261105-terminal.tar.gz). Historical platform, module-reference and performance reports below retain their original pins; no new Windows/macOS, SDK/physical-console, title/GPU or performance run. Earlier pinned reports and the contribution template follow. ### What `qsort_s` now checks its arguments the way the `libc.prx` that titles ship does. Measured natively on PPSA07923 and PPSA05916, which agree: - **Size limit:** a count or element size above `SIZE_MAX >> 3` (2^61 and up) is a violation. - On `main` the limit was `SIZE_MAX >> 1`, so a count from 2^61 to 2^63 was accepted and sorted past the array: the comparison run crashed there. - **Message:** every violation is reported as `"qsort_s: bad argument"`, with `EINVAL` and a null pointer. On `main` each case had its own message, such as `"qsort_s : n > RSIZE_MAX"` or `"qsort_s : a == NULL"`. The rest already matched the titles and is unchanged: - `n == 0` with a null base or comparator is accepted; - an element size of 0 sorts nothing; - the array is untouched on a violation. `bsearch_s` already matched on every case below, so it doesn't change. The debt entry, which said the console's behaviour was unverified, now states the measured rule. **Merge note for my #9688** (the `qsort` and `qsort_s` sort order): the two PRs edit the same `qsort_s` debt entry, which conflicts textually. The resolution is #9688's entry with two changes: - its sentence "It returns `EINVAL` after calling the constraint handler when `n` or `es` exceeds `RSIZE_MAX`, or when `n` is not 0 and `a` or `cmp` is null" becomes this PR's measured sentence; - "The console's constraint handling is unverified" is dropped. The code and the tests merge cleanly. ### Tested <!-- libc-main9ab-refresh-20261104-12598 --> **Current-main refresh — 2026-11-04.** Head `3529e1b3ba9f0d6e725a582de84c01506a8e97ed` merges main `9ab6a281ea61c9e62a7eb07eb4cef8f19ede1c5c` while retaining the prior public head as an ancestor. Main’s newer code, regression fixtures and debt entries are preserved alongside this topic. Linux x86-64, GCC16.2.1, Ninja Release: actual libc, libkernel and libSceAmpr CMake owners rebuilt coherently. `guest_qsort`, `guest_bounds_checking`, `guest_safe_errors`, `guest_crt` each pass three consecutive runs (**12 passes, zero skips**). The same groups pass three times on pinned main. Public-header audit and conventions pass. Original licence-notice trailing whitespace is retained where present. The scoped recipe reuses frozen ZArchive/zstd providers; this is not a whole-project build. No new Windows, bundled-SDK, physical-console, title/GPU or FPS measurement is claimed; earlier reports retain their original pins. [Exact source/parent proofs, per-branch patches/input manifests, build and CTest logs/JUnit, library/executable hashes and scoped CMake recipe](https://github.com/JJenkx/AnyPS5/releases/download/linux-validation-20261023/owned-libc11-main9ab-linux-20261104.tar.gz), SHA-256 `97a2377bc996be1690e8853e1ea090a98b5ed808bcc37a15a5cdada5c2e00845` (download verified). AI-assisted: yes (Codex). **Current-main integration — 2026-11-04.** Head `1be723b023bdbb8caa47c13118bf19c7ce8d6f39` includes main `b11c7bf84f5d2f636ff60166cc3371bd071e24d5` and preserves previous public commits and attribution/licence notices. Retains the measured qsort_s bounds and safe zero-size host no-op policy, including the explicit PPSA07923 extreme-boundary SIGFPE caveat. Main’s separate reentrant helper block and qsort_r body are byte-identical; no native return is invented for the faulting row. Linux x86-64, GCC 16.2.1, Ninja Release, BUILD_TESTING=ON: rebuilt actual libc/Ampr and selected executables. `guest_qsort`, `guest_bounds_checking`, `guest_safe_errors`, `guest_crt` each pass 3/3 (**12 runtime passes, zero skips**); `public_headers`, conventions and whitespace checks pass. Pinned main passes all 17 selected baseline groups 3/3 (51 passes) plus headers. Before/after dependency checks agree: 34 recursive trees and 31,551 tracked blobs, zero errors; the update=none QuickJS test262 corpus is explicitly excluded from these library inputs. Source/parent/gitlink proofs, library/test hashes, raw logs/JUnit and head-leased push receipts: [qualification archive](https://github.com/JJenkx/AnyPS5/releases/download/linux-validation-20261023/math-libc10-mainb11c-linux-20261104.tar.gz), SHA-256 `7c347f620951ad6f39068740750949212c6412815da094a46a96eca1d15c8bbf` (download verified). Older platform, stress, negative-control and reference reports retain their original pins; no new Windows/macOS, full-suite, SDK-module, console, title/GPU or performance claim. AI-assisted: yes (Codex). Earlier dated qualifications below retain their original source/platform pins. Windows 11, WinLibs GCC 15.2.0 UCRT r7, Release, `main` `319621ba2e`. - **Native comparison:** a scratch loader calls the titles' `qsort_s` and `bsearch_s` by NID next to this build's, with the same recording handler on both sides. It runs 25 cases: - a valid call; - `n == 0` with a null base or comparator; - an element size of 0; - a null base, a null comparator, and (for `bsearch_s`) a null key; - counts and sizes at `2^61`, `2^62` and `2^63`. Each case compares the return value, the array order or found element, and the handler's calls, error, pointer and message. | | `main` | this PR | |---|---|---| | `qsort_s` (12 cases) | 2 of the first 6 differ (the messages), then the run crashes at `n = 2^61` | **0** | | `bsearch_s` (13 cases) | 0 | 0 | Both titles give the same results. - **Regression:** `guest_qsort`'s constraint check expects the titles' message, and adds count and size cases at `2^61` (one with `n == 0`). With the previous `FileAndHeap.cpp` it fails. - **Test set:** `guest_qsort`, `guest_bounds_checking`, `guest_safe_errors` and `guest_crt` pass 3/3. Conventions pass. <!-- codex-maintenance-20261029-repeat-12598 --> **Current Linux qualification and native boundary limitation — 2026-10-29** Refreshed against main `5454cd2e455994d992aca39335ce60507eeda1eb`. The refreshed #9688 head `1c8ac1874c0ed5ccafef5112d59da6739d4a2fb6` is an actual ancestor. Linux qualification at `d8bcdb2ce313bd8ceeb9ebdc67c02200bc3dedea` (Arch Linux 7.2.9, Ryzen 9 7950X, GCC 16.2.1, Ninja Release, BUILD_TESTING=ON): `guest_qsort`, `guest_bounds_checking`, `guest_safe_errors`, `guest_crt` each pass three consecutive runs (12/12, no skips). The `public_headers` audit passes at this exact head. All tracked public-header files match the pinned main; the affected test targets rebuild against those headers. Conventions and whitespace checks pass. The same focused groups passed three times on the pinned main. The restack preserves the existing safe zero-size no-op rule around the new parent sort interface. The original bundle qualifies historical head `d8bcdb2ce313`; the following supplemental test/debt correction supersedes its extreme-count return-zero assertion. Narrowed the count-limit regression in `c6cfa7cfd9dbff57752dab24b5574af9d8037822`. The `count=SIZE_MAX>>3, size=0` invocation remains, followed by the existing cumulative handler-count check, but it no longer asserts a native return of zero. That is a host constraint-guard check only. The separately measured `count=1, size=SIZE_MAX>>3` case still requires return0, and the handler-pointer checks remain. **Production is unchanged.** The new oracle evidence covers one existing PPSA07923 bundled module on Linux (unwrapped SHA-256 `51ae8427c4a302abb1b6378fe65af69d4206d077006660eef4ee0e304e1e9e85`). The size-limit/count-one case returns0 with no handler/comparator call and an unchanged canary. A rejected `count=2^61,size=0` control returns22 and calls the handler with the expected message, error22 and null pointer. The proposed count-limit/zero-size case instead faults with SIGFPE in original SDK integer division at module offset0x6a3cd. No returned value or handler/comparator/canary outcome was recorded for that faulting case, so none is inferred. The debt entry now records this mismatch with the unchanged safe host no-op policy. Linux Release, Ryzen9 7950X, GCC16.2.1: `guest_qsort`, `guest_bounds_checking`, `guest_safe_errors` and `guest_crt` each pass3runs (12 checks), plus the `public_headers` audit (1), zero skips. Conventions and whitespace pass. This follow-up adds no new native execution; the separate oracle observations are not physical-console, Windows, PPSA05916 or other-SDK results. A question for review: is retaining this documented safe host no-op and scoping the extreme-count test to the constraint guard appropriate, given the observed SDK fault? AI-assisted: yes (Codex). Evidence: [current-head test/debt supplement](https://github.com/JJenkx/AnyPS5/releases/download/linux-validation-20261023/qsort-boundary-test-scope-linux-20261029.tar.gz), SHA-256 `ad0c252cb06d3851b838e347f70967a7a7181c6603336af3adb242eb8c3f72be`; [sanitized native-oracle logs and identity proof](https://github.com/JJenkx/AnyPS5/releases/download/linux-validation-20261023/qsort-native-boundary-PPSA07923-linux-20261029.tar.gz), SHA-256 `8c5193f4cd7a2214932889221e3be6800f9ddf9d687153b3252d701b912bb1dd`; [original rebase qualification](https://github.com/JJenkx/AnyPS5/releases/download/linux-validation-20261023/owned-math10-main5454-linux-20261029-repeat.tar.gz), SHA-256 `53b095da2f67f55b8aa56ba273681e0330fb39739be844458038dde410fb8cc4`. No fresh Windows runtime is claimed here. <!-- codex-maintenance-20261030-repeat-12598 --> **Earlier qualification — 2026-10-30** Integrated current main `08a10d225306ad102b57408e2ef7566bcfb829b2` into this existing topic at `9125fed5190f6e1e14ec0ec96da721a6e4d256b6`. Includes actual refreshed #9688 parent `ae15d0493797e9d40b2ab2eedbf202abf14c90e3`. Current-main functions, fixtures, unrelated debt rows and exact dependency gitlinks are preserved; original topic functions and authored commits are retained. The documented PPSA07923 extreme zero-size SIGFPE observation and unchanged safe host no-op remain; the huge-count zero-size test invokes the call and checks the host handler guard without claiming an unsupported native return. Rebuilt actual Linux libc and focused test binaries. `guest_qsort`, `guest_bounds_checking`, `guest_safe_errors`, `guest_crt` each passed three consecutive runs (12 runtime passes), plus `public_headers`; conventions and whitespace checks pass. Pinned main passed all seven selected runtime suites plus the header audit three times (24 runs). This is focused Linux CPU qualification; prior Windows/reference evidence retains its original pins. No new Windows, console, SDK-module, title, GPU or performance claim. AI-assisted: yes. Evidence: https://github.com/JJenkx/AnyPS5/releases/download/linux-validation-20261023/owned-math6-main08a10-linux-20261030.tar.gz (SHA-256 b984a6334dce65b5c9148e3791ba21605074a5e762ea0f07f96de2f38062ef6e). <!-- codex-maintenance-20261030-repeat2-12598 --> **Qualification update — 2026-10-30, repeat 2** Integrated pinned main `e471817c68d4e1b1e44b0ce369ed88bafe4ae8ed` at `6fd92b781782253c45445523a3d00f44a38de7e0`, retaining original topic commits as ancestors. Actual parent ancestry: #9688 `1f001f3f23c74bf5dee00803644f2f17c82ac994`. Main qsort_r retains its full FreeBSD helper/comparator behavior under private Reentrant-prefixed names; both sort implementations and every main qsort_r fixture are retained. Exact rename-normalized helper proof is attached. The PPSA07923 extreme-count zero-size SIGFPE debt caveat and unchanged safe host no-op are preserved; no unsupported native return is asserted. Actual Linux libc/focused binaries rebuilt from this final head; `guest_qsort`, `guest_bounds_checking`, `guest_safe_errors`, `guest_crt` each pass three consecutive runs (12 runtime passes), plus public_headers. Conventions against current origin/main and whitespace pass. Pinned main passed all seven runtime groups plus the header audit three times (24 runs). Full source/function/test/debt/header and 31 recursive dependency / 17,742 tracked-blob proofs are attached. Later main `1c6b316cf762` has 17 off-topic commits, no relevant libc/numeric/qsort/gitlink changes, and all 9 merge previews are clean; those preview trees were not executed. Focused Linux CPU scope only: prior Windows/SDK/reference reports keep original pins. The Linux portion makes no fresh Windows, console, SDK-module, title/GPU or speed measurement is claimed by this report. AI-assisted: yes. Evidence: https://github.com/JJenkx/AnyPS5/releases/download/linux-validation-20261023/owned-math9-maine471-linux-20261030-repeat2.tar.gz (SHA256 5da4ce1732b45bb3fc566c31078c8c9ae8bf0c403654dfc60d15ee28490e20bf). Actual Windows qualification at exact published `6fd92b781782253c45445523a3d00f44a38de7e0`: Windows 11 Enterprise 10.0.22621, Ryzen 9 5950X, WinLibs GCC 15.2 UCRT r7, Ninja Release, BUILD_TESTING=ON. Rebuilt patched libc and guest_qsort_tests, then ran guest_qsort three times: 3/3 passes, zero skips. This checks the composed main qsort_r and branch sorting fixtures at the recorded head; no timing, SDK/game/GPU/console/macOS claim. Raw build/CTest/JUnit logs, DLL digest and terminal Windows FIFO receipt are included in https://github.com/JJenkx/AnyPS5/releases/download/linux-validation-20261023/owned-current-windows-20261030-repeat2.tar.gz, SHA256 e423c97373758bf59239e02c138b74f35f1a45488793bc92878a4c836f94a584. AI-assisted: yes (Codex). AI-assisted: yes (Codex). ### 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 (#9688 merged 2026-11-02; the actual refreshed parent `ae15d0493797e9d40b2ab2eedbf202abf14c90e3` remains an ancestor, and the measured boundary limits and documented safe host no-op remain) - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes (Claude Code)
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!12598
No description provided.