tools: an audit of exports that access guest pointer parameters directly, instead of one EFAULT fix per function #14445
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 LeandroLP23 on 2026-11-01T13:52:54Z.
One
EFAULTfix per function keeps coming. Of the 268fixpull requests opened on Oct 29–30, 28 addEFAULT(or an unwritable/unreadable-pointer check) to one export each: 17 merged, 8 still open. Examples: #13443, #13537, #13552, #13576, #13577, #13587 and #13582. More single-function issues are open too: #13951, #13955, #13959.The cause is the same each time. An export reads or writes a guest pointer parameter directly (
*out = …,out->field,std::memcpy(out, …),std::strlen(path)), and the fix routes it throughGuestCopyOut_nid_no_patch/GuestCopyIn_nid_no_patchor theCopyGuest*helpers inlibc/include/General.hpp. The helpers exist, but no rule or tool points at the exports that bypass them, so they are found one per pull request.Proposal:
tools/guest_pointer_audit.py, an audit in the style ofimport_audit.py, not a CI gate. It reusesprogress.py's parsing (APS5_VABIdefinitions, comment and literal stripping) and, for each exported function, reports the pointer parameters the body uses through->,[],*or a rawmem*/str*/std::copycall without passing them to one of the safe helpers. Output isfile:line: function: parameter (kind)plus a per-library count, or JSON.A prototype over
maine53aff3f56finds 2,739 such parameter uses in 2,210 exports. The largest groups are libc (345), libkernel (252), libSceNpCppWebApi (232), libSceJson2 (185) and libSceNpCommon (171); libkernel_sys has 23. A random sample of 10 libkernel/libkernel_sys findings were all real direct accesses, for exampleuuidgen'sstore[index], which #13187 fixes.What it doesn't decide. On the console,
EFAULTcomes from the kernel's copyin/copyout, that is from syscalls. A userland function such as mostpthread_*/scePthreadAttr*ones probably faults there too, and several merged fixes describeEFAULTas a host-safety fallback with the console behaviour unmeasured. So the audit only lists candidates, and the error to return stays a per-function decision.Questions:
EFAULTfixes be grouped per file or per library, using this list, instead of one per function?GuestCopyIn/GuestCopyOutor theCopyGuest*helpers"? Or only for syscall-backed exports?AI-assisted: yes (Claude Code)