fix(libkernel): answer sysarch's LDT, I/O permission and i386 GS base operations, as FreeBSD 11.4 does #22039
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/22039"
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:05:45Z.
What
sysarchthrew for operations 0, 1, 3, 4 and 10. FreeBSD 11.4's amd64sys_machdep.canswers them, and this process never has an LDT or an I/O permission map installed (thesysarchXFPUSTATE entry indocs/dev/debt/libkernel.mdlisted them as unimplemented):I386_GET_LDTreads its 16-byte arguments and returns 0 descriptors (amd64_get_ldtwith no LDT);I386_SET_LDTwithout descriptors returns 0, orEINVALfor a nonzero start with a count of 0 (amd64_set_ldt); with descriptors it would install an LDT and still throws (afterEINVALfor more than 512);I386_GET_IOPERMfails a start port from 65536 withEINVAL, otherwise writes back a length of 0 (amd64_get_iopermwith no TSS);I386_SET_IOPERMfails withEPERM, aspriv_check(PRIV_IO)does for a jailed process (the jail model agreed on #11216; not measured);I386_SET_GSBASEsets the GS base to the zero-extended 32-bit value through the existing GS base path.Unreadable arguments fail with
EFAULTfirst, ascopyindoes.GuestSysarch.cppcovers each case and the null arguments.Tested
Linux (Debian 13, GCC 14.2.0, Release), on
mainec7369ecb8.ctest -R '^guest_sysarch$': passed.main'sProcess.cppand this branch's test,guest_sysarchaborts at operation 0, 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 --branch: no overlap with open pull requests.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:24Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
32d98f93fb: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