macOS: every checked guest copy is a mach_vm_read_overwrite call (guest_icu_comparisons 16 s on M1, 0.19 s on Linux CI) #26519
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 Romannachwievor on 2026-11-24T03:45:00Z.
On macOS, every checked guest copy is a
mach_vm_read_overwritecall.GuestCopyIn_nid_no_patchandGuestCopyInUnsynced_nid_no_patchgo throughCopyGuestBytes(General.cpp:96,main5e16f4422d). Linux x86-64 triesGuestFaultCopy::Copyfirst (:105), and Windows triesGuestArenaCopyOwned_nid_no_patchfirst (:100). On macOS there is no in-process path, so each copy is a Mach call (:116).The test that shows it is
guest_icu_comparisons, which hasTIMEOUT 20(libSceIcu/CMakeLists.txt:389). Since commits1077cb0ed3and1d50979dbd(11-18), its strings are read through checked guest copies in page-bounded chunks.guest_icu_comparisonsctest -j8The M1 runs used macOS 26.5, an x86_64 Release build under Rosetta 2, on
mainc55872d43fplus #17425 and #11049 (needed for the macOS full build). An earlier M1 run onmain0af6acc89e(11-21) also timed out underctest -j6and passed alone in 13.96 s.To check where the time goes, I put a plain
memcpybehind an environment variable in the macOS branch ofCopyGuestBytes, as a local experiment only. With it, both of two runs crashed with SIGSEGV after 2.44 s, inLengththroughUnitReader::AtinlibSceIcu.prx(macOS crash report). That crash is expected: the later cases make reads that a checked copy has to refuse, and a plainmemcpydoes not refuse them.Exhaustive(), which makes most of the copies, runs first and reads only in-memory arrays. Without the variable the same binary took 17.94 and 21.99 s for the whole test.sampleof the unmodified test showed the main thread inside Rosetta runtime routines in every sample. So most of the time goes to the copy path, not to ICU. I did not measure a title, but everyGuestCopyInon macOS takes the same path.I have not tried a fix. One option is an in-process copy that recovers from faults, as
GuestFaultCopydoes on Linux (specifics/linux/GuestFaultCopy.cpp). Another is an ownership check first, as Windows does with the guest arena. Raising the test's timeout would only hide the cost. This matters for the macOS full-build job proposed in #24117 / #24341, sincectest -jthere would time this test out.AI-assisted: yes (Claude Code)