Repository navigation
Conversation
The libc.prx that titles ship (PPSA07923, PPSA05916) fills only when dest is not null, destsz is at most SIZE_MAX >> 3 and count is at most destsz. Any other call returns ERANGE, writes nothing and calls the constraint handler with "memset_s: bad destination argument", ERANGE and a null pointer. main returned EINVAL without the handler, used SIZE_MAX >> 1, and filled destsz bytes when count was larger. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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.
|
The debt notes now state the titles' memset_s rule and that a violation writes nothing where C11 K.3.7.4.1 fills min(count, destsz) bytes. Suggested by oneandonlydean in review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@oneandonlydean following your note on #12593:
It's a docs-only change. Conventions pass, and the debt file still merges cleanly with #10270 (the only conflict remains AI-assisted: yes (Claude Code). |
rooklz
left a comment
There was a problem hiding this comment.
I ran this on macOS, which the body doesn't list (head 37d0c191b5, based on main 319621ba2e).
Standalone ASan+UBSan build (macOS 26, Apple clang, -arch x86_64): the PR's Strings.cpp and WideConversion.cpp (for set_constraint_handler_s), linked to CheckMemset and the recording handler taken verbatim from GuestBoundsChecking.cpp. I added three abort-only symbols for unrelated Strings.cpp imports; none of them is called.
- head: passes, with no sanitizer reports.
main'sStrings.cppwith the new test: fails withmemset_s accepted a violation, as the body says.
Mutants of memset_s_nid_postfix: the test kills all 16.
- Limit changed to
>> 2, to>> 4, or applied tocountinstead ofdestsz. count > destszchanged to>=.- Each of the three guards dropped one at a time. Dropping the null check is caught as an ASan SEGV.
- Handler not called, called twice, given
destas its pointer, given error 22, or given the messagebad argument. - Returning 22.
- Filling
destszbytes, orcount - 1bytes. - Zeroing
destszbytes on a violation.
Other checks:
- No internal caller of
memset_s_nid_postfixexists outside the export, so the stricter checks can't change another libc path. - After the removal,
GuestStrings.cppandGuestBoundsChecking.cppcompile without new warnings (-Wall -Wextra). check_conventionspasses.git merge-treeagainstmainis clean.pr_overlaplists only the shareddocs/dev/debt/libc.md, plus #5021 and #11892 inStrings.cpp. #11892 merges cleanly with this PR. #5021 already conflicts withmainitself.
LGTM once #9935 lands, as stated.
|
A Windows run with GCC 16: Windows 11 Pro 10.0.22631, i9-9900K, MSYS2 UCRT64 GCC 16.1.0, Release, this PR (
AI-assisted: yes (Claude Code) |
|
Current-main integration — 2026-11-04. Head Linux x86-64, GCC 16.2.1, Ninja Release, BUILD_TESTING=ON: rebuilt actual libc/Ampr and selected executables. Source/parent/gitlink proofs, library/test hashes, raw logs/JUnit and head-leased push receipts: qualification archive, SHA-256 |
✅ AMD GPU test: passedPR head
Unstable on main (5, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (14, not counted against this PR)Passed on retry (2, failed in the parallel run, passed when re-run with a 360 s timeout; not counted against this PR)Validation IDs already present on main (4 IDs in 807 tests)Skipped (61)ReproduceAutomated build and test on a contributor's AMD machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
What
memset_snow accepts and rejects calls the way thelibc.prxthat titles ship does. Measured natively on PPSA07923 and PPSA05916, both of which agree:destis not null,destsz <= SIZE_MAX >> 3, andcount <= destsz. A0/0call on a validdestsucceeds.ERANGE(34), writes nothing, and calls the constraint handler with"memset_s: bad destination argument",ERANGEand a null pointer. That includes a nulldestwithdestsz = count = 0.On
mainit returnedEINVAL(22) without calling the handler, usedSIZE_MAX >> 1as the limit, and filleddestszbytes whencountwas larger.The old checks in
guest_stringsassertedmain's behaviour, which the titles contradict, so they move toguest_bounds_checkingasCheckMemset, which installs a recording handler.Fulfilled dependency: #9935 reached main through merged #10270, so the default constraint handler now writes and returns. orezraey’s request to keep this memset_s change separate from #10270’s copy functions is retained.
Fulfilled #10270 merge note (historical qualification):
core/libs/tests/GuestStrings.cppconflicts textually, because #10270's hunk at line 130 sits next to the removedmemset_slines. The resolution is #10270's merged file with those seven lines removed (sixRequire(memset_s_nid_postfix(...))lines and thesentineldeclaration). Merged that way onmain319621ba2ewith #102700bc7597aed:guest_bounds_checking,guest_strings,guest_safe_errors,guest_crtandguest_wide_stringspass 3/3;Tested
Current-main integration — 2026-11-04. Head
a2f6e23c8731896479fee84eccfa75396d6050c8includes mainb11c7bf84f5d2f636ff60166cc3371bd071e24d5and preserves previous public commits and attribution/licence notices. Retains the measured memset_s violation behavior and write-preservation fixtures while preserving main’s updated copy-function size bounds and returning default handler.Linux x86-64, GCC 16.2.1, Ninja Release, BUILD_TESTING=ON: rebuilt actual libc/Ampr and selected executables.
guest_bounds_checking,guest_strings,guest_safe_errors,guest_crteach 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,
main319621ba2e.Native comparison: a scratch loader calls the titles'
memset_sby NID next to this build's, with the same recording handler on both sides. It makes 20,000 random calls:SIZE_MAX >> 1and one above it;Each call compares the return value, whether the handler ran and with which error, and the destination bytes.
main: 11,242 of 20,000 differ, on both titles.SIZE_MAX), which also gave the message and the null pointer.CheckMemsetchecks 10 of those cases against this build.Regression: with the previous
Strings.cpp, the newCheckMemsetfails (memset_s accepted a violation).Test set:
guest_bounds_checking,guest_strings,guest_safe_errors,guest_crtandguest_wide_stringspass 3/3. Conventions pass.Independent Windows evidence from bunbeans2-arch: Windows 11 Pro, MSYS2 UCRT64 GCC 16.1.0, Release; head
37d0c191b5a04732daaca697ca5678ac9c670aafintegrated with main98ddd9c179.guest_bounds_checkingandguest_strings: change passed 5/5; reverting only production changes while retaining the regression tests failed 5/5 atmemset_s accepted a violation; plain main passed 3/3. This is the reporter's execution, not a new local Windows run.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)🤖 Generated with Claude Code