Skip to content

test(libc): bound UTF-16 memory searches including zero units - #13383

Open
StoneDC wants to merge 5 commits into
boykopovar:mainfrom
StoneDC:b43/wmemchr-boundary
Open

StoneDC wants to merge 5 commits into
boykopovar:mainfrom
StoneDC:b43/wmemchr-boundary

Conversation

@StoneDC

@StoneDC StoneDC commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

What

Refreshes the branch with recorded main to trigger current-head checks after an earlier CI exception. This PR's fixture is byte-identical to its previous published head; the exact existing #13220 fix remains integrated.

The earlier macOS register-context job failed while fetching Git objects: curl 56, early EOF, invalid index-pack output. It did not reach configuration or runtime tests. Direct job re-run was denied by GitHub (403, repository admin required); refreshing this own branch triggers a new eligible run.

Tested

Current head 83f9700fe566891cc6402b57a85741ea3335b8d8 integrates recorded main bff0289787c98570491c8f175179c8a5651c8017.

Windows/MinGW and Linux: focused native target/dependency rebuild at combined 79d6c3df963f49d189b104bd0eca8b6d40023c57, all 9 registered CTests pass per OS, zero skips. Includes guest_wmemchr_boundary, both NP tests and three related string groups. The shared BOM/shebang and environment-reference CTests were also checked separately. No test assertion or timeout was changed. This is focused native validation, not a complete default product, local macOS, PS5/title or GPU run.

Conventions with the complete template, whitespace, exact ancestry and applicable registration checks pass. Hosted checks for the new head are pending until they finish.

Earlier implementation rationale and validation (historical revisions)

What

Adds independent guarded runtime coverage for bounded UTF-16 memory searches. Lengths 0..192, embedded full-unit zeros, low-byte-zero nonzero units, repeats and absent targets; immutable snapshots plus std::find supply the first-match oracle.

Integrate the existing #13220 fix at e9f09f54fabb6408d3e2711b8df10c10112ab00e and current recorded main. The failed macOS write-watch jobs stopped in CMake configuration because execute-fault and read-fault were each registered twice. This head includes the original prerequisite commit, removing the duplicate block while retaining all 18 distinct tests. No parallel fix is introduced, no test assertion is weakened, and no timeout is changed.

This PR's fixture is byte-identical to the previous published head 1d5d4a7663a22b96e135bc7033a988993523c0d4. The extra topic-relative CI change is the existing prerequisite's five-line registration deletion. Proposed landing order is #13220 first, then this independent topic. The submitted head already includes the fix, so its new CI can test it while the prerequisite PR remains open.

Original topic rationale and earlier overlap evidence (historical snapshots)

Adds independent guarded runtime coverage for bounded UTF-16 memory searches. Lengths 0..192, embedded full-unit zeros, low-byte-zero nonzero units, repeats and absent targets; immutable snapshots plus std::find supply the first-match oracle.

Implementation basis: Calls the actual production function(s) through the canonical public Api.hpp; expected results derive from constructed inputs, snapshots, membership tables or standard C++ algorithms. Public contract: https://github.com/freebsd/freebsd-src/blob/833d39bd2e38421a14ea489a956261a0fa993fbc/lib/libc/string/wmemchr.3.

Known limits: Tests valid live spans and buffers only; no invalid-pointer or undefined-overlap behavior is added. No PS5/title execution or firmware object layout is inferred. Uses the existing char16_t declaration, not host wchar_t; code units are opaque and this is not Unicode validation or a width measurement.

Source/schema: core/libs/prx/libc/src/Strings.cpp core/libs/prx/libc/include/Api.hpp

Exact topic head 1d5d4a7663a22b96e135bc7033a988993523c0d4 is one independent commit on main da026c70655a132031d45e2008c24f993870d801. The current-main repository overlap checker against da026c70655a132031d45e2008c24f993870d801 reported no confirmed overlap. It could not finish comparisons for these older PRs already conflicting with main: #5021, #6085, #7081, #7447, #7715, #8150, #8965, #11628, #11661, #11689, #11698, #12688, #12700, #12965. Their shared-file diffs were reviewed separately. 12 scoped file changes projected onto main and then combined with this topic without a new conflict; 2 peer file changes already conflict with main and are not claimed automatically mergeable. They do not provide this command or test matrix. Registration uses a separate target/name and there is no landing-order dependency. Changes to shared registration before landing need a refreshed merge/test check. The original functional-overlap assessment recorded no dependency at that earlier snapshot. The twenty current topic heads are also merged into tested integration 3990a2bd7e0abeaaeeef963a30a3d6508d9b5be3.

Tested

Exact submitted head b27ad4917985e1006a168f5c931a6b04e00cdf79. Recorded main 6a3afa4deb18ea58a90efb8040fff8c60e4f2aab; prerequisite #13220 e9f09f54fabb6408d3e2711b8df10c10112ab00e. Both and the previous published topic head are ancestors. The fixture and topic assertions remain unchanged.

Fresh native validation uses combined commit fa9a26172d243ed3bb4258ad0e2ea2dfc27de518, containing all 31 exact submitted heads, on Windows 11 / MinGW GCC 15.2 / CMake 4.3.1 and non-root Ubuntu 26.04 / WSL / GCC 15.2 / CMake 4.2.3. This is explicit combined-commit validation, not 31 separate native product builds. Every individual fixture blob matches that combined tree; pairwise main/prerequisite merges are clean.

  • Full Ninja Release configuration with BUILD_TESTING=ON; build the 31 topic test targets plus guest_string_tests, guest_wide_string_tests and guest_string_compare_tests with their real library dependencies. The existing cached dependency sources/gitlink pins and FFMPEG_PREBUILT_DIR mechanism are reused.
  • Run the 31 registered topic CTests and guest_strings, guest_wide_strings, guest_string_compare: 34/34 pass on each OS, zero skips. This PR's registered guest_wmemchr_boundary is included exactly once. No timeout was raised.
  • Direct standalone write-watch CMake regression on each OS: recorded main's CMakeLists.txt fails configuration with both duplicate-name diagnostics. Replacing only that file with the integrated test(libc): register the macOS write watch fault tests once #13220 version configures successfully and enumerates 18 unique tests, with execute-fault/read-fault exactly once each. This verifies the failing configuration stage and test preservation; it does not claim a local macOS write-watch runtime.
  • Per-head current-main conventions with this complete body and diff whitespace checks pass. Combined public-header, script-registration and CTest skip-policy audits pass. Fixture hashes and prerequisite ancestry are checked before publication.

The combined native target build is not the complete default product build. No local macOS/WASM, PS5/title/GPU or firmware validation is claimed. Old red CI belongs to older heads without the prerequisite; new-head hosted CI starts after publication and remains pending until it actually completes. The prerequisite's external branch is unchanged.

Exact composition of the fresh native validation

#13310 ab8eeea15ea0dcb8aabe95e656a041963f8e4e8a, #13313 1ec676984f08d1ee65496d0d1c487a9fecb8ec49, #13314 1c8549945e9657645da7ce5a98693d50e85b5685, #13317 442aef391ffaec2c9cfe1d098c84dde5f19cd292, #13319 dab492c88b6bd8093c351b1726db02ad91af39ab, #13320 f27454e88a02dd9c9f0510d3afb0aa72378f7e87, #13378 8bb9ed3e152ea1611fe8216f25dd03c7830f2818, #13379 9b39858ef369da4f3eb01e4137e3f932a478ebd2, #13380 6083413b06d03a34e498629da942b8ec40ab7a9f, #13381 cf303f4142403e370f807813b99fc5aa087ad72b, #13391 15fbf68aa97b2617cd03ae94f033020028edeac6, #13394 cb3188c2b1f36700f882311191f86b897c4f01cb, #13395 8165ef480879e5eed57eb8f631abc924aed02ec7, #13303 91bd23b7dd8eb4089321bee7a4475f5fea8fcab4, #13304 fe35f6771a55f9c235fa0641ed5558632c59f314, #13305 7d3995fdbf339d101386dafa4ee0277764a5aba8, #13306 d3f06a729a3145cf1aa8b1dccafd555b0a2bee5a, #13307 9ddb498ae5ea911c04eacad584a59d0e6d66cc9e, #13308 3f77e0c49bf996aeb3e938be6e92f6e0cc139877, #13311 431e940236ba0cb001a0a5cef248f9f033db4c17, #13312 99dc47fb5679db7df08117ea7d0977fa1d875a8e, #13316 8ece7cd1d5d00b16480924bfdf18852a9c4a937c, #13318 2aef950d26736932bd3521fad1a6f9d1afecba3a, #13382 63aa31a6aecf58067ffc8a85ec6fbf870c84215d, #13383 b27ad4917985e1006a168f5c931a6b04e00cdf79, #13385 bc0f43d9fa2ce2180840d86dc3c287989429a994, #13386 de523e20f27b77ca4a85ad7ace1dd89fbc56f25a, #13387 802e6e11cc801feb7baef3946745ba3700f82512, #13389 fc97324e77f079e1225e3c5df1de9071a56b6397, #13392 3ea9223d4970cb702327cec3db96dbd9a07414f5, #13393 631d48778c8f64b57749b5f97c0fa27bfc096c42

Earlier author-reported validation (historical heads; not new results)

Topic head: 1d5d4a7663a22b96e135bc7033a988993523c0d4. Combined integration: 3990a2bd7e0abeaaeeef963a30a3d6508d9b5be3, based on main da026c70655a132031d45e2008c24f993870d801. Ubuntu/WSL GCC 15.2, CMake 4.2.3, Python 3.14.4; Windows MinGW GCC 15.2, CMake 4.3.1, Python 3.14.3.

The registered test calls the actual libc through canonical headers, using OS-protected pages and real input/output buffers. A separate exact-head control compiled the whole relevant production source unit with this fixture: unchanged production code passed, and the fixture rejected an intentional production-function defect. This is a source-unit control, separately from the product build below.

Registered CTest guest_wmemchr_boundary passed on Linux and Windows as part of the filtered twenty-topic run: ctest --test-dir <build> -R <20-topic-pattern> -j 8 -V --output-on-failure, 20/20 passed on each platform, zero skips. cmake --build <linux-full-build> --parallel 8: complete default Linux product build passed. Windows used the full configuration and built the sixteen affected libc test targets plus relinker with --parallel 8; a complete default Windows build is not claimed. Conventions, whitespace, script registration and the public-header declaration/umbrella audit passed. No PS5, title or GPU validation run is claimed. macOS, WASM execution and hosted full-build CI are not reported as passed.

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: test(libc): register the macOS write watch fault tests once #13220
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

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 5021 core/libs/prx/libc/CMakeLists.txt
PR 6085 core/libs/prx/libc/CMakeLists.txt
PR 7081 core/libs/prx/libc/CMakeLists.txt
PR 7447 core/libs/prx/libc/CMakeLists.txt
PR 7715 core/libs/prx/libc/CMakeLists.txt
PR 8150 core/libs/prx/libc/CMakeLists.txt
PR 8965 core/libs/prx/libc/CMakeLists.txt
PR 10324 core/libs/prx/libc/CMakeLists.txt
PR 12688 core/libs/prx/libc/CMakeLists.txt
PR 12700 core/libs/prx/libc/CMakeLists.txt
PR 12965 core/libs/prx/libc/CMakeLists.txt

@adriadam10 adriadam10 self-assigned this Oct 30, 2026
@StoneDC

StoneDC commented Oct 30, 2026

Copy link
Copy Markdown
Contributor Author

Integrated the existing shared CI fix at new head b27ad4917985e1006a168f5c931a6b04e00cdf79 on recorded main 6a3afa4deb18ea58a90efb8040fff8c60e4f2aab.

#13220's original commit e9f09f54fabb6408d3e2711b8df10c10112ab00e is now an ancestor, and its duplicate-registration deletion is present in this branch. The previous macOS failure was in configuration, before the fixture ran. The new head can configure with the fix already included; the checklist still declares #13220 first in landing order. The external prerequisite branch is unchanged.

Fresh local verification:

  • Combined commit fa9a26172d243ed3bb4258ad0e2ea2dfc27de518 contains all 31 exact updated topic heads. The fixture in this PR is byte-identical to its previous published head and the combined tree; no test assertion or timeout is changed.
  • Windows/MinGW and Linux: rebuilt the 31 affected native targets and three related string targets, with real library dependencies. All 34 registered CTests pass on each OS, zero skips, including guest_wmemchr_boundary exactly once.
  • Direct configuration regression on both OSes: main's unchanged standalone write-watch CMake file fails with the two duplicate-name errors. Replacing only that file with the integrated prerequisite configures successfully and lists 18 unique tests, with execute-fault/read-fault once each. This verifies configuration/test preservation, not a local macOS runtime.
  • Per-head conventions with the complete PR description, whitespace, prerequisite ancestry, fixture retention, combined public-header/registration and skip-policy audits pass. This is focused native target validation, not a complete default product/PS5/GPU run.

Hosted-check snapshot at 2026-10-30T17:45:18+00:00 (UTC): 5 pending. Current-head checks. Earlier red checks belong to heads without the prerequisite; new-head CI remains pending until it completes. Please re-check this integrated head.

AI-assisted: yes.

@StoneDC

StoneDC commented Oct 31, 2026

Copy link
Copy Markdown
Contributor Author

Updated to 83f9700fe566891cc6402b57a85741ea3335b8d8 on recorded main bff0289787c98570491c8f175179c8a5651c8017.

The macOS register-context failure occurred during Git fetch (curl 56, early EOF, invalid index-pack), before configuration or tests. GitHub denied direct rerun with HTTP 403 (repository admin required). This main integration triggers a fresh eligible run.

Fresh combined validation 79d6c3df963f49d189b104bd0eca8b6d40023c57 includes this exact head and the four other refreshed native topics. Windows/MinGW and Linux both rebuilt actual affected targets and their library dependencies; all 9 registered CTests pass per OS, zero skips, including both NP tests, four libc fixtures and three related string groups. The shared BOM/shebang and environment-reference CTests also pass in a separate parallel run on each OS. Conventions, whitespace, exact ancestry, fixture retention, public-header and script-registration audits pass. This is focused native validation, not a complete default product, local macOS runtime, PS5/title or GPU run.

The fixture is byte-identical to the previous head; exact #13220 remains integrated and declared first in landing order. No external author branch was changed.

Please review the refreshed head and its new hosted checks.

Hosted snapshot at 2026-10-31T01:29:19.821405+00:00 (UTC): pending: 5. Current-head checks. These new hosted runs are not claimed passed until complete.

AI-assisted: yes.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants