Repository navigation
test(libc): check unsigned comparisons at protected boundaries - #12884
Merged
Merged
Conversation
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
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.
|
Contributor
|
Windows run (Windows 11, MSYS2 UCRT64 GCC 16.1), this PR (f7aec58) merged onto main f7f03da, Not checked: whether the test fails on a broken comparison (test-only PR, no fix to revert). AI-assisted: yes (Claude Code) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds protected-boundary memcmp coverage for all 65,536 one-byte pairs and longer equal/prefix spans with an opposing later difference. It checks unsigned ordering and first-difference precedence.
Implementation basis: Expected comparison signs use integer arithmetic on unsigned byte values, not host memcmp. Both operands end at real protected pages. Contract: https://github.com/freebsd/freebsd-src/blob/833d39bd2e38421a14ea489a956261a0fa993fbc/lib/libc/string/memcmp.3 . The test requires the sign, not one particular nonzero magnitude.
Known limits: Lengths are finite and pointers valid; constant-time behavior, invalid pointers and console-specific nonzero result magnitudes are not asserted.
Existing implementation/schema: core/libs/prx/libc/src/Strings.cpp
Exact topic head
f7aec5893a99b661a9015b0663c505ac68320c47is one independent commit on main5454cd2e455994d992aca39335ce60507eeda1eb. The repository overlap checker against157b02c4f1803e9d2cd757677b9a805961203fc4reported no confirmed overlap. It could not complete shared-file comparisons for older PRs already conflicting with main: #5021, #6085, #7081, #7447, #7715, #8150, #10324, #10615, #11625, #12271, #12682, #12688, #12700. Scoped file diffs were reviewed separately. 11 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 feature or test matrix. The new test has its own source and registration, with no required landing order. If shared registration code changes before landing, this branch needs refreshed merge and affected test checks. Depends on: none. The 20 independent topics also merged together into tested integration81a0f73e5972352ba2b50ce53077921c51112273on the same main.Tested
Tested topic head:
f7aec5893a99b661a9015b0663c505ac68320c47. Final combined integration:81a0f73e5972352ba2b50ce53077921c51112273, main5454cd2e455994d992aca39335ce60507eeda1eb. 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.Built and ran registered
guest_memcmp_protectedagainst the actual unpatched libc on Linux and Windows, no skips. A separate control compiled the whole relevant production source unit and this fixture: the unchanged source passed and an intentional production-function defect was caught. Those source-unit and fixture bytes are unchanged after the main refresh; current-head CMake runtime was rechecked separately. This control is not described as a full product build.cmake --build <full-linux-build> --parallel 8: full Linux default product build passed, including a final build at the integration above. Windows used the full configuration and built the affected libc/test targets and relinker with--parallel 8; a complete default Windows build is not claimed.ctest --test-dir <build> -R "^(tools_sanitizer_json|tools_annotation_symbols_json|tools_compile_plan|tools_catalog_json|tools_nid_offline|tools_audit_strict_partial|tools_intervals_complete|tools_pad_preview|tools_release_notes_check|tools_progress_diff_json|guest_memmove_snapshot|guest_memcpy_protected|guest_memcmp_protected|guest_span_protected|guest_substring_protected|guest_tokenizer_protected|guest_strncpy_protected|guest_strncat_protected|guest_wmemmove_snapshot|guest_wide_length_protected)$" -j 8 -V --output-on-failure: 20/20 passed on each platform, zero skips. Conventions, whitespace, script registration and the public-header audit passed. No PS5/title execution or GPU validation protocol was run; macOS and hosted full-build CI are not reported as passed.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)