Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Superseded by merged upstream #3295, now included in main
6bb4fdc4f35. Main protects host streams while allowing descriptors that were initially closed to be used by the guest; this draft’s unconditional guard is no longer needed. Closing the review PR and preserving its branch/history.What
Integration follow-up: our game-testing branch now adopts upstream boykopovar#3295 (9c30f0e), committed locally as 15357c6. The full Linux build, fourteen targeted tests and seventeen closed-standard-descriptor fixture cases pass. An isolated guest open/close of descriptor 0 fails under the old unconditional guard and passes with the replacement. The fixture disables write-watch because its userfaultfd would otherwise occupy descriptor 0 before main. All eight descriptor masks also pass with normal write-watch enabled. This draft retains the original implementation for historical comparison; it is no longer the policy used in the current game-testing integration. No fresh game runtime or standalone PR3295 full build is claimed.
A guest repeatedly closing descriptor 0 can close host stdin and then close an unrelated host file that reuses that number. This patch rejects guest closes of descriptors 0, 1 and 2 through sceKernelClose, close and _close. Kernel close returns EPERM without changing guest errno; the POSIX aliases return -1 with errno EPERM. Normal descriptors and socket dispatch retain their existing paths.
Regression coverage checks repeated calls through all three APIs, unchanged stream identity, normal descriptor closure and invalid-descriptor handling. The before-change regression failed; the candidate passed.
Validation: rebased topic commit 3df3b56 on upstream main 2a5eca1; conventions pass. The full Linux integration build b34fa2c passed, and thirteen related tests passed: patched_libraries, file_position, file_streams, guest_standard_streams, guest_filesystem, guest_posix_filesystem, guest_terminal, guest_kernel_errors, both named-shared-memory descriptor reuse tests, guest_socket_read_write, guest_file_vector and guest_kernel_fcntl. The two affected close functions and regression function are identical between this branch and the tested integration. No independent standalone full build, Windows run or PS5 hardware validation is claimed.
Historical RollerCoaster Tycoon Adventures Deluxe PPSA17330 evidence tied repeated sceKernelClose(0) calls to resources.assets descriptor reuse and stale asset data. The integration reached its title screen after the fix. Later integration gameplay/normal closure also required separate fixes and must not be attributed to this patch alone. No new title run was performed for this rebase.
Known limitation: this patch protects descriptor numbers 0-2 unconditionally. A host launched with a standard descriptor already closed may legitimately open a file at that number, which this patch would prevent the guest from closing. Guest standard streams are not modeled as a separate descriptor namespace. The PS5 error result remains unverified and documented in TechnicalDebt.
Upstream #3295 addresses the same host-stream problem, records which standard descriptors were open at library load, and chooses EBADF rather than EPERM. Its policy handles the initially-closed case more broadly. This draft publishes our existing work and Linux regression evidence for comparison; it is not proposed as a second upstream implementation. Upstream boykopovar#4474 occupies our contributor allowance.
AI-assisted: yes. No proprietary assets, binaries or investigation artifacts are committed.
Tested
Full Linux integration build b34fa2c and thirteen targeted library/file checks passed. Affected close functions and regression exactly match the topic branch. No independent standalone full build, Windows or fresh title run.
Checklist
October 13 upstream update
Merged upstream
9d0a41d5a10into this branch and resolved its conflicts while preserving this PR's scope. The published head is9f33f553ae. It also merges cleanly with newer upstream0214069e33c(the intervening change only updates the build workflow). Local conventions pass. The validation reported above applies to its original tested revision; validation of the updated head is running in the full build.