fix(libkernel): limit UTC-to-local DST output to 32 bits #3855
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3855"
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 Lorkydey on 2026-10-11T18:00:36Z.
What
Fix the PShare 1.0 (PPSA99773) Windows null read reported by babyhuey in https://github.com/boykopovar/AnyPS5/pull/3606#issuecomment-6111784938.
sceKernelConvertUtcToLocaltimewrites eight bytes through its DST output, while PShare passes a four-byteint. The extra four bytes overwrite the savedrbxinpshare::local_time, zeroing the model pointer later used byApp::draw_top_bar.Change that output to
int32_t*and extendguest_freebsd_clockswith a canary immediately after the four-byte result. The existing UTC conversion and optional output behavior stay the same.ABI evidence: the PShare 1.0 call site allocates an
intfor this result, and fpPS4 declares and writes it throughPDWORD. The reverse conversion in AnyPS5 already usesint32_t*. This has not been measured on a physical PS5; shadPS4 currently usesu64*, so the differing public declarations are explicit for review.Tested
Windows 11, MinGW-w64 GCC 15.2.0, Release, Ryzen 5 3600 / GTX 1660 SUPER. Base:
maina11c8f7f.guest_freebsd_clocksfails with this test against unchanged main (SIGABRT, adjacent canary overwritten), then passes with the one-line implementation change.guest_time_conversion,guest_process_time,guest_process_time_counter, their two scaled variants,guest_cpu_time_clocks, andguest_thread_cpu_clock.git diff --checkpass. The repository overlap checker found no overlap with 355 open PRs. No Linux runtime test or physical-console ABI test was run.PShare runtime validation also applies #3606 (
187fd853) to resolvegetlogin_r; that commit is not included in this PR. On main alone, the existing stop isFAIL: unresolved ELF import 78FiHequa9U (getlogin_r) from libkernel.prx.The public PShare 1.0 release was relinked with
--windows --registry, with its bundledlibc.prxand assets. Release ZIP SHA-256:a9a07cdeac7b6ab6d6ce5faebb1e128d232ce9c173b976170a77abecdb8be807.Before (
main+ #3606), all 20 sounds load, thenapp.exe+0x12f1breads0x240. A GDB hardware watchpoint catches the exact overwrite:After (this fix + #3606), the same instruction has
rax=0x60d100, matching the model pointer, and PShare reaches GPU submission. The next stop on this GPU is:This fixes the reported null read; it does not claim working presentation or a fully usable PShare.
Checklist
main; no other open PR implements the same functions.mdfiles or images added to the repositoryImported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-11T18:33:26Z.
Retested on Linux (Ubuntu 24.04, GCC 13) and Windows 11 (MinGW-w64 GCC 15.2 from WinLibs), Release, as asked on #3606.
guest_freebsd_clockspasses 5/5 (--repeat until-fail:5) on both, with this PR (36d37a06) alone on Linux and merged with #3606 (187fd853) ontomaina11c8f7fon both. No warnings inTime.cpporGuestFreebsdClocks.cpp.main'sTime.cppaborts on Linux, so the canary catches the 8-byte write.app.exe+0x12f1bread of0x240is gone (no0xc0000005inapp.log). It now gets to presentation and stops atAGC graphics: last provoking vertex with explicit per-vertex flat interpolation is unsupported, same as you saw. Cloud Play reaches that same AGC throw on Windows once its imports are in.Linux can't take PShare that far here, since the headless run stops in
sceVideoOutOpen.Imported from boykopovar/AnyPS5. Originally posted by Lorkydey on 2026-10-11T19:19:32Z.
Thanks @babyhuey for the cross-platform retest and for confirming the canary catches the overwrite!
I followed up on PShare’s graphics stop and tested AlxcBTW’s existing fix: AlxcBTW/AnyPS5#12, commit
c18298c3.On Windows 11 with a GTX 1660 SUPER, using
maina11c8f7f+ #3606 + #3855, adding that patch gets PShare past the provoking-vertex check. GPU frame captures now show the splash animation and the main Captures screen, including menus, text and icons.It still aborts later on
v_fma_mixlo/mixhi_f16 at pc 348 in FLOAT_MODE 204. That is the case covered by #3512, which I haven’t included in these runs.I posted the A/B results in #3581. AlxcBTW confirmed they’re adding PShare to the affected-title list and will open the fix upstream once #3546 is merged.