Repository navigation
Conversation
The console's struct tm is nine ints with no tm_gmtoff or tm_zone (measured on a PS4 Pro, firmware 10.71: mktime, gmtime_s and localtime_s change 36 bytes of a 64-byte buffer, in libc and in libSceLibcInternal). GuestTm was the 56-byte FreeBSD layout, so the conversions wrote 20 bytes past a guest's struct tm. gmtime_s stores tm_isdst -1 as the console does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
I reviewed the patch and its test coverage. Two items need coordination before merge:
I have not approved pending those points; the hosted checks I saw were still running for Windows relinker and macOS write-watch. |
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
@MarcZX10 Thank you for the review. 1. Order with #10129. I proposed on #10129 that it lands first (comment); this PR now lists 2. PS5 evidence. I have no PS5 and no PS5 title or PS5 system module on disk, so I cannot measure or read the PS5
So the PS5 size stays unmeasured. If you would rather not change the guest ABI on PS4 evidence alone, I can add a debt entry stating that the PS5 layout is assumed from the PS4. A PS5 owner could also run the 64-byte guard probe from the description, which takes one call each to |
MarcZX10
left a comment
There was a problem hiding this comment.
Blocking compatibility mismatch with the measured console behavior documented in dependency #10129. That PR records that %z is emitted even when tm_isdst == -1, and %Z selects tzname[tm_isdst > 0] (the standard-name slot when the value is -1). This PR makes gmtime_s set tm_isdst to -1, but formatTime currently breaks out of %z for every negative value, guestZoneName returns an empty string for %Z, and the updated unknown dst fixture expects [][]. Once GuestTm no longer carries zone fields, these paths need to preserve #10129’s measured rule using the guest timezone globals. Please add a regression for a non-UTC guest zone formatted from a gmtime result and align both conversions with the dependency’s recorded behavior before merging.
# Conflicts: # core/libs/prx/libc/src/Time.cpp
… zone gmtime_s now stores tm_isdst -1, so strftime must not drop %z or empty %Z for it. Follow the rule boykopovar#10129 measured on a PS5: %z is the guest zone's offset, one hour more only when tm_isdst is positive, and %Z is tzname[tm_isdst > 0]. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@MarcZX10 Thanks, both points are fixed in 4168860. I first merged today's 1.
2. Regression for a non-UTC zone from a On the merge head with the fix, Windows 11, MinGW-w64 GCC (winlibs), Ninja, run three times:
The description is updated to match; it no longer says a UTC |
MarcZX10
left a comment
There was a problem hiding this comment.
Re-reviewed the updated head. The 36-byte GuestTm layout and the %z/%Z handling now match the console measurements and the behavior recorded in #10129, including tm_isdst == -1. The added guarded-write and non-UTC gmtime formatting regressions address my prior finding. No blocking issue remains in this diff.
|
I manually compared the exact current heads of #10409 and my #10987 after the overlap checker flagged shared time files. A three-way merge reports conflicts in |
|
@ntamas94 Thanks. The PS5 side agrees with your PS4 probe: a PS5 title's bundled libc.prx writes exactly nine ints in Two things before this can go further:
|
|
Tested with a real title: Fatal Frame II: Maiden of Black Water PPSA32802 (retail dump, 01.002.002), Linux, RTX 4080 SUPER, Vulkan 1.4.351. I merged this branch onto current
So this fixes the crash on a real title. For current |
|
@edubox thanks, that's useful evidence: the 0x30-byte guest |
|
@ntamas94, following up on the reviewer overlap finding for our #12549. Its normalization change is now qualified at I compared your Could you confirm the landing order? I propose #12549 first, then #10409 refreshed onto main, preserving the in-range normalization guard and equivalent-calendar test. If either order is acceptable once #10409 is refreshed, that also settles the review concern. I will record your actual answer rather than presume agreement. |
|
Thank you for your work on this. Main has moved, and the PR now conflicts in:
Could you merge current Thank you! |
# Conflicts: # core/libs/prx/libc/src/Time.cpp # core/libs/prx/libc/src/TimeExtras.cpp # core/libs/tests/GuestMktime.cpp # docs/dev/debt/libc.md
The check added in boykopovar#17417 compared timegm's output with gmtime_s's, which stores tm_isdst -1 on this branch as the console does; timegm stores 0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
I merged current Conflicts:
Tests on the merge head (Windows, WinLibs GCC, Release):
AI-assisted: yes |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — comments
The change addresses the reported struct tm over-write, but I did not read every reviewed file or run the reported checks, so a formal approval is not justified.
What I ran
Reviewed head 42bda7d256cf30779cee7cd93b8ab618d1441d35 using the pinned repo_read.py reader. No tests or builds were run.
Results
| Check | Result | Note |
|---|---|---|
| Diff inspection | passed | Prepared diff reviewed |
| Tests and build | not run | Results in description are author reported |
Findings
Blocking
None identified in the portions inspected.
Non-blocking
None.
Not verified
The report says Windows 11 MinGW-w64/Ninja tests and convention checks passed, and describes console probes; these were not run or independently verified. Read the description, commits, manifest, diff, GuestTime.hpp, portions of Time.cpp and TimeExtras.cpp. The remaining portions of Time.cpp, and the changed test and documentation files, were not read. All nine changed files are listed as reviewed in the manifest; their full texts were included, but not all were inspected. No files were excluded by the manifest.
To get this to a good state
Nothing is required. This is a review comment because the review was incomplete.
# Conflicts: # core/libs/prx/libc/include/GuestTime.hpp # core/libs/prx/libc/src/Time.cpp # core/libs/prx/libc/src/TimeExtras.cpp # core/libs/tests/GuestTimeConversion.cpp # core/libs/tests/GuestTimeExtras.cpp # docs/dev/debt/libc.md
The guest tm carries no tm_gmtoff, so setToCurrentLocalTime and calculateLocalTimeOffset take the offset from the difference between the local and UTC fields of the same time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merged current Conflicts: New commit: Tests on the merge head (Windows, WinLibs GCC 15.2, Release): AI-assisted: yes |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
Nothing blocks this change; the implementation and tests support the stated 36-byte guest struct tm layout and the reported console formatting behavior.
What I ran
Reviewed head 28df803867fe7ddaae1a6839ba57985ff06eed3b against base main using the prepared diff and pinned repository reader. No test commands were run; the Windows and console runs described in the PR body are author-reported.
Results
| Check | Result | Note |
|---|---|---|
| Changed-line review | passed | All 10 changed files inspected |
| Targeted code review | passed | Conversion and WebKit callers inspected |
| Tests run by reviewer | not run | No commands run |
| Author-reported checks | not run | Results not independently verified |
Findings
Blocking
None.
Non-blocking
None.
Not verified
I read all changed files listed in the manifest and the relevant conversion, formatting, WebKit caller, and test code. I did not run tests or independently verify the console probes, Windows results, title behavior, or CI. The PR description and commit list were read; excluded files: none.
To get this to a good state
Nothing is required.
malekaifa
left a comment
There was a problem hiding this comment.
Blocking transitive regression on exact head 28df803867fe7ddaae1a6839ba57985ff06eed3b.
The 36-byte GuestTm change itself is well supported, but the %Z change in libc also changes libSceLibcInternal C++ time_put<wchar_t> even though this PR only cites console evidence for libc/strftime behavior. libSceLibcInternal/FacetPut.cpp forwards its wide do_put to LibcWideTimePutDoPut_nid_no_patch, and that helper formats through wcsftime_nid_postfix. Therefore changing libc case 'Z' to emit nothing makes LibcInternal time_put<wchar_t>::do_put('%Z') emit nothing too.
That is exactly inconsistent with the existing non-Windows regression in GuestLibcInternalFacetPut.cpp: CheckWideTimePutDoPut() sets a 15-letter zone (ABCDEFGHIJKLMNO0) and requires %Z to produce ABCDEFGHIJKLMNO; it separately verifies the 16-letter case returns empty only because the first buffer cannot fit it. oneandonlydean has now reproduced guest_libc_internal_facet_put failing on this exact head and put the PR on hold until a new head passes it.
Please do not just delete/weaken that check without evidence. Either:
- preserve the existing LibcInternal facet
%Zbehavior by decoupling its formatter from libc's newly measured%Zrule, while keeping the 36-byte struct and libc%Zfix; or - provide LibcInternal/time_put console evidence showing
%Zis also empty there, then update the LibcInternal implementation/test deliberately to that measured behavior.
Note that libSceLibcInternal/Export.cpp has its own %Z path (GentimeField(Zone, ...)) that still emits a zone field, so the current PR otherwise leaves LibcInternal time formatting internally inconsistent.
Please rerun guest_libc_internal_facet_put on the new exact head in addition to the existing libc time tests. Hosted checks being green on this head do not cover this isolated failure.
AI-assisted: yes
What
The console's
struct tmis nineints, 36 bytes, with notm_gmtoffortm_zone. AnyPS5'sGuestTmwas the 56-byte FreeBSD layout, somktime,timegm,localtime_s,localtime_r,gmtime_sandgmtime_rwrote 20 bytes past a guest'sstruct tm, andstrftimeread the same 20 bytes back as an offset and a zone-name pointer. A guest with itsstruct tmon the stack has its canary overwritten and aborts on return.GuestTmis now 36 bytes:strftimekeepsmain's%zcode from fix(libc): format strftime and asctime fields as measured on a PS5 #10129, which reads the guest zone globals:%zis the guesttimezoneoffset, one hour more only whentm_isdstis positive, printed for anytm_isdstincluding -1.%Zprints nothing, as on the console: a PS4 Pro (firmware 10.71) prints nothing for it and exports notzname(probe below), and the PS5 payload fix(libc): format strftime and asctime fields as measured on a PS5 #10129 measured printed nothing either.tznameand the UTF-8 names from fix(libc): convert Windows time zone names to UTF-8 #10987 stay; they just do not reach the guest throughstruct tmor%Z;gmtime_sstorestm_isdst-1 andgmtimestores 0, as measured on the console (below);gmtime_randtimegmfollowgmtime, as in FreeBSD (not measured).mktimetherefore reads agmtimeresult as standard time, as the console does;tzsetsets 0 on its own UTC copy sotimezonestays the standard offset.guest_mktimegains a guard-byte test: each conversion gets a 64-byte 0xAA buffer and the bytes from 36 on must stay 0xAA. The tests that read the two removed fields now check the hour or the formatted text instead;guest_strftimegains a regression in itsUTC+3zone: agmtime_sresult (tm_isdst-1) formats%z|%Zas-0300|.guest_time_conversion's POSIX-zone check (Windows) derives the offset withtimegminstead oftm_gmtoff.The branch has current
mainmerged in;Time.cppismain's with this PR's struct and conversion changes on top, and the tests use the declarations ofprx/libc/include/Api.hpp.Tested
Windows 11, MinGW-w64 GCC (winlibs), Ninja, on this branch with
main828e443 merged in, three runs each:guest_mktime,guest_strftime,guest_time_conversion,guest_time_extras,guest_wide_formatting,guest_crt,guest_errand the fourguest_ampr_*tests pass. Earlier, on 4168860: withmain'sGuestTime.hpp,Time.cppandTimeExtras.cpp,guest_mktimeaborts with "A calendar conversion wrote past the 36-byte struct tm".public_headers(audit) andpython tools/check_conventions.py --base mainpass. edubox's run of Fatal Frame II (PPSA32802) on Linux, above, shows the__stack_chk_failafterlocaltime_sgone with this change.Measured on a PS4 Pro (firmware 10.71) with a homebrew probe: each call gets a 64-byte buffer filled with 0xAA (the first 36 bytes hold 2026-10-23 12:00:00 for
mktime);touchedis the offset just past the last byte that changed:Bytes 36 to 63 stay 0xAA in all six calls, for the system
libc.sprxand forlibSceLibcInternal.sprx. The firmware 10.71libSceLibcInternal.sprxagrees:mktime(offset 0xc230) reads offsets 0x0 to 0x20 of its argument, and the routine it andgmtime_s(0x1930) store through (0x1ff70) writes only offsets 0x0 to 0x20. Not run with a title.A third probe (
libc_tzname.c, 2026-11-08) callslocaltimeandstrftimefrom the console'slibc.sprx: 1736942400 givestm_isdst0,%Zempty (returns 0) and%z+0100; 1752580800 givestm_isdst1,%Zempty and%z+0200;sceKernelDlsymfinds notzname. The Windows checks #10987 added inguest_time_conversionnow require the same:%Zempty,%zthe zone's offset for that time (derived from the host zone the test runs in) and the zone'stm_isdst. With%Zprintingtznameagain,guest_time_conversionandguest_strftimefail.A second probe on the same console (firmware 10.710.001) calls
gmtimefromlibc.sprx:gmtime(1000000000)returns[40 46 1 9 8 101 0 251 0]andgmtime(951825600)[0 0 12 29 1 100 2 59 0], sotm_isdstis 0 there, andmktimeof either result is one hour earlier than the timestamp (999996400, 951822000): the console's zone is one hour east of UTC in standard time, and both results are read as standard time, the September one included.guest_mktimenow checks both values and that round trip inCET-1CEST; withgmtimestoring -1 again it fails ("gmtime did not store tm_isdst 0").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)