fix(libkernel): inherit accepted socket nonblocking mode #2079

Closed
STUPIDCONTEM wants to merge 1 commit from upstream-pr/2079 into main
STUPIDCONTEM commented 2026-10-09 07:03:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by STUPIDCONTEM on 2026-10-09T07:03:12Z.


Evidence review (2026-10-09)

Game/title evidence has not been established. Validation below is host regression/build evidence only; it does not establish title compatibility. Older checked items and test results describe their stated revisions, not current merge readiness.

Game/title ID: none verified. No PS5 title execution is claimed.

What

Accepted TCP connections now inherit the listener's guest nonblocking mode. Previously the accepted socket's cached mode always started as blocking; on Windows this disagreed with the inherited native mode, while Linux's native accept does not inherit O_NONBLOCK. Set both the accepted native socket and its guest cache from the listener mode before publishing the descriptor.

The contract follows FreeBSD stable/11 accept(2). The accepted socket remains independently configurable after creation. Mode-setting errors close the newly accepted native socket through the existing guard.

Tested

Windows 10 Pro 19045, WinLibs GCC 15.2.0 UCRT posix SEH r7, Release, BUILD_TESTING=ON; based on main f145139676.

  • Extended guest_tcp checks blocking and nonblocking inheritance, no-data EAGAIN, independent mode changes on accepted socket and listener, and data transfer after returning the accepted connection to blocking mode. A bounded poll waits for the pending connection before nonblocking accept.
  • The corrected regression fails on unchanged upstream at the accepted socket's F_GETFL assertion. With the fix it passes 50 consecutive runs.
  • Default and explicit libs builds passed. Full CTest passed 488/488 in 25.94 seconds. An earlier full run timed out waiting for the unrelated windows_import_modules GUI child, followed by a temporary-file cleanup PermissionError. That test passed three repeat runs, followed by the successful full run; the intermittent GUI-child timeout is being investigated separately.
  • Parent independently reviewed the implementation and regression. Committed-head conventions, whitespace and test-registration checks passed.

No Linux or title run was performed. Open #1091 adds socket readiness events and #1727 adds read/write wrappers in the same file; neither changes accept mode inheritance. The changes are confined to accept and its existing TCP regression.

Checklist

  • Based on current main; no other open PR implements the same change (historical base; current readiness not asserted)
  • One topic per PR; follow-ups go in a new PR
  • No comments added to code
  • No silent stubs added
  • No investigation notes, reports or images added to the repository
  • No third-party code added
  • Generic behavior, not specific to one title
  • Depends on: none
  • AI-assisted: yes; parent independently reviewed and tested the final change
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4797221630 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2079). Originally posted by [STUPIDCONTEM](https://github.com/STUPIDCONTEM) on 2026-10-09T07:03:12Z. --- ### Evidence review (2026-10-09) Game/title evidence has not been established. Validation below is host regression/build evidence only; it does not establish title compatibility. Older checked items and test results describe their stated revisions, not current merge readiness. Game/title ID: **none verified**. No PS5 title execution is claimed. ### What Accepted TCP connections now inherit the listener's guest nonblocking mode. Previously the accepted socket's cached mode always started as blocking; on Windows this disagreed with the inherited native mode, while Linux's native accept does not inherit O_NONBLOCK. Set both the accepted native socket and its guest cache from the listener mode before publishing the descriptor. The contract follows [FreeBSD stable/11 accept(2)](https://github.com/freebsd/freebsd-src/blob/stable/11/lib/libc/sys/accept.2). The accepted socket remains independently configurable after creation. Mode-setting errors close the newly accepted native socket through the existing guard. ### Tested Windows 10 Pro 19045, WinLibs GCC 15.2.0 UCRT posix SEH r7, Release, BUILD_TESTING=ON; based on main f145139676a48306681d3a4d5fabf83938759daf. - Extended guest_tcp checks blocking and nonblocking inheritance, no-data EAGAIN, independent mode changes on accepted socket and listener, and data transfer after returning the accepted connection to blocking mode. A bounded poll waits for the pending connection before nonblocking accept. - The corrected regression fails on unchanged upstream at the accepted socket's F_GETFL assertion. With the fix it passes 50 consecutive runs. - Default and explicit libs builds passed. Full CTest passed 488/488 in 25.94 seconds. An earlier full run timed out waiting for the unrelated windows_import_modules GUI child, followed by a temporary-file cleanup PermissionError. That test passed three repeat runs, followed by the successful full run; the intermittent GUI-child timeout is being investigated separately. - Parent independently reviewed the implementation and regression. Committed-head conventions, whitespace and test-registration checks passed. No Linux or title run was performed. Open #1091 adds socket readiness events and #1727 adds read/write wrappers in the same file; neither changes accept mode inheritance. The changes are confined to accept and its existing TCP regression. ### Checklist - [ ] Based on current main; no other open PR implements the same change (historical base; current readiness not asserted) - [x] One topic per PR; follow-ups go in a new PR - [x] No comments added to code - [x] No silent stubs added - [x] No investigation notes, reports or images added to the repository - [x] No third-party code added - [x] Generic behavior, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes; parent independently reviewed and tested the final change

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!2079
No description provided.