fix(libkernel): answer sysarch XFPUSTATE's measured errors and empty copy, as a PS5 does #22046
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/22046"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by brajankw on 2026-11-17T03:06:23Z.
What
sysarchthrew for any non-null XFPUSTATE argument (operations 11 and 132). On a PS5 (firmware 12.70) operation 132 rejected lengths 1024 to 8192 withEINVALand null arguments and addresses withEFAULT, and accepted lengths 0, 64, 128, 256 and 512 (thesysarchentry indocs/dev/debt/libkernel.md).Following FreeBSD 11.4's order (copy the arguments in, compare the length unsigned, copy the state out):
EFAULT, including one whose last bytes are unreadable: operation 11 copies in 8 bytes and 132 copies in 16;EINVAL;EFAULT.Lengths 513 to 1023, whose limit was not measured, and copying out the live state still throw.
GuestSysarch.cppcovers both operations; the pendingsysarchdebt fragment from #22039 is updated here, as both change the same entry. It keeps the 13.60 LDT wording that136484585eadded.Tested
Linux (Debian 13, GCC 14.2.0, Release). Head
3d354f3678, rebased ontomain11c9e7764ewithout conflicts. The runs after the first two bullets are from earlier heads.3d354f3678, merged with #22013 and #22049 ontomain11c9e7764e:ctest -R '^(guest_sysarch|guest_memory|guest_mmap_fixed_anonymous|guest_virtual_query_arguments|np_uds_events|guest_np_uds_.*|guest_np_trophy_.*)$': 16 passed, andguest_mmap_executableskipped itself (exit 77) in this environment. This head adds Helldiverr's three pins: an unreadable argument (0x10) for both operations, length 512 with a null address, and an argument at the end of a readable page.guest_sysarch: operation 132 copying in 12 bytes instead of 16;EINVALinstead ofEFAULTfor an unreadable argument, for each operation; throwing from length 512.ctest -R '^guest_sysarch$': passed.Process.cppand this branch's test,guest_sysarchaborts at the first XFPUSTATE length check, which throws there.ctest(5896 tests,-j 12) with this branch and my other twelve branches of this round merged ontomain521fb7fec4: 5880 passed. The 16 failures are the set that fails onmainin the same environment: sixagc_drivercases (agc_driver_image_table_packed_guardspasses when run on its own) and ten that need a.gitdirectory, network or a passwd entry for the user.python3 tools/check_conventions.py --base origin/main: passed.python3 tools/pr_overlap.py --branchat3d354f3678: no conflicting pull request. #18190, which conflicts withmain, sharesProcess.cppand could not be compared; it renames exports and does not changesysarch's XFPUSTATE handling.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)Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-17T03:14:21Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
b8db0447b8:tools/check_conventions.pypassed.guest_sysarch_testsbuilt cleanly.guest_sysarch):core/libs/prx/libkernel/System/src/Process.cppreverted tomainand the new tests kept, the suite fails: Restoring the change makes it pass again.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T03:57:27Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the inspected implementation follows the documented measured behavior and adds coverage for both operation layouts.
What I ran
Reviewed head
be0bcdc4cafbd0ca72e3e2f15b2467b44df383b7. I did not run commands or tests. Readdescription.md,commits.md,manifest.json,diff.patch,README.md, and all changed lines inProcess.cpp,GuestSysarch.cpp, and the debt fragment using the pinned reader.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
Tests and the author's reported test results were not independently verified. Windows, macOS, and physical-console behavior were not tested during this review. Unchanged portions of the changed files were not read.
To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T11:36:41Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; its measured XFPUSTATE cases and deliberately unimplemented cases are handled consistently with the stated behavior.
What I ran
Reviewed head
3d354f3678db0debd914f58cedd2a24828e1eb27. I read the prepared description, commits, manifest, diff, and all three changed files listed as reviewed. I did not run commands or tests; the test results in the description are author-reported.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
I did not independently verify PS5 firmware behavior, run the reported tests, or inspect excluded files. The listed changed files were all included and read;
files.jsonwas unavailable as a review document, and the manifest lists no excluded changed files.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T12:59:27Z.
Review: COMMENTED
Built the branch’s changed sources and ran GuestSysarch on Linux against the existing runtime libraries. The test run passed and covered the XFPUSTATE argument and empty-copy cases.
AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by Plyxen on 2026-12-03T14:08:23Z.
Review: APPROVED
I read the diff at
3d354f3678. Windows 11 with GCC 15.2 and Linux (Ubuntu 24.04 in WSL2, GCC 13.3), merged intomainat6c6b29320fetogether with other open PRs (so not an isolated build).guest_sysarch: pass on both.main's, the same test fails too.Not checked: a console.
AI-assisted: yes (Claude Code)