Repository navigation
fix(libkernel): isolate Windows positioned file transfers - #2029
STUPIDCONTEM wants to merge 1 commit into
Conversation
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed the complete diff at 458e7e4. The Windows path no longer seeks on the shared descriptor: it checks granted data access, reopens a separate handle, uses the requested offset, and closes it. The tests cover concurrency on a duplicated descriptor, sequential offset preservation, access modes, EOF, and Windows sharing failure. Exact-head Linux/GCC 12.2 build and guest_positioned_io passed (1/1, 0.03 s); conventions and diff checks pass. The author reports five Windows regression runs and full CTest 489/489 on Windows. GitHub reports no checks for this head, and I could not execute the Windows-specific path here.
|
Which title hits this race? Reopening the file adds a |
|
The new #2423 report overlaps the same Windows |
|
I prepared a local integration candidate based on your current head |
|
@oneandonlydean I cannot currently provide a title ID or before/after title load-time measurements. The regression demonstrates the shared-offset race, but does not establish a game benefit or justify the per-transfer ReOpenFile/NtQueryObject cost. I have returned this PR to draft pending that evidence. @MarcZX100 Thanks for identifying the #2423 overlap and preserving the separate file handle in your candidate. I will keep this branch focused on its original scope; please do not push the combined error-return changes into it. #2041 was explicitly declined pending a title ID and a log at the resize throw, and #2423's probes do not supply that missing title evidence. No combined Windows validation is claimed. |
Evidence review (2026-10-09)
Draft pending the requested title-specific failure evidence and before/after title load-time measurements. The synthetic concurrency regression does not establish a game benefit or justify per-transfer reopen/query overhead. The #2423 probes supply no title ID, so their separate error-return changes are not being folded into this PR.
Game/title ID: none verified. No PS5 title execution is claimed.
What
Concurrent positional I/O on Windows saved and restored the shared file pointer. A simultaneous sequential read could observe the positional transfer's offset, and restoring it could discard another thread's progress.
NativePositionednow uses a separately reopened file object for each transfer. It checks the original handle's granted access before reopening, so a read-only descriptor cannot gain write access (or vice versa). The original file pointer is never moved. EOF behavior is retained; reopen failures return an I/O error without a seek-and-restore fallback.The new
guest_positioned_ioregression exercises all four scalar/vector positional APIs concurrently with sequential reads, including a duplicated descriptor. It checks exact file contents through an independent native reader, permission failures, short reads, EOF, zero-length transfers, and exclusive-sharing failures. TechnicalDebt records the sharing/locking limitation.Host behavior follows Microsoft's ReOpenFile and NtQueryObject documentation.
Scope: synchronous positional I/O only. #1135 concerns the separate AIO implementation. Inspected #1777 and #1518; their Stdio.cpp changes address random devices and timestamps rather than this helper.
Tested
Windows 10 Pro 19045, WinLibs MinGW-w64 GCC 15.2.0 UCRT/posix/SEH r7, Release, Ninja, BUILD_TESTING=ON, SPIRV-Tools disabled. Base:
f145139676a48306681d3a4d5fabf83938759daf.concurrent transfers preserve sequential data and positioned results; existing guest_filesystem and guest_file_vector pass.libsbuild succeed.Linux and a PS5 title/homebrew were not run. No game compatibility or performance improvement is claimed. Reopening for each transfer has overhead; restrictive host sharing/locks can prevent a transfer.
Overlap review: #1807 adds an adjacent sandbox documentation entry; there is no functional dependency. #2001 also changes
NativePositioned, but removes the shared-position save/restore while retaining transfers on the original handle; it does not implement the separate-handle isolation in this PR. This PR remains independently based on main; those overlapping hunks need reconciliation if either change lands first.An external review approved this exact head and reports a Linux/GCC 12.2 build plus passing
guest_positioned_io(1/1). This is reviewer-reported validation, separate from the local Windows results above.Checklist
main; no other open PR implements the same change (historical base; current readiness not asserted)