libSceNet debt: note how a title uses the sceNetGetsockopt error value #10096

Closed
opened 2026-10-23 08:58:23 +00:00 by xXPBSXx · 0 comments
xXPBSXx commented 2026-10-23 08:58:23 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-23T08:58:23Z.


The debt entry in docs/dev/debt/libSceNet.md records what one or more title call sites show; this updates it (call-site addresses included so the reading can be checked).

The changed entry now reads:

sceNetGetsockopt (libSceNet) reads SO_ERROR from the host socket. Winsock does not clear a socket's pending error when it is read, so on Windows the library reports a pending error once and shows it again only after a new sceNetConnect; a second failure with the same code on the same socket without a sceNetConnect in between would be hidden. One title (PPSA02225) disassembled for this entry has one call site (0x1056d34), with level 0xffff, option 0x1007 (the FreeBSD values of SOL_SOCKET and SO_ERROR; the title holds only the numbers) and a length variable set to 4 beforehand, reached only after a helper called with the value 2 returned true. For a negative result it takes the thread's error code as the value; for a result of 0 or more with a value of 0 it reports the connection as made, and otherwise it turns the value into an error code of its own. The call does not show how often the title reads it per connection attempt or whether it keeps using the socket after an error.

Fix: branch docs/debt-net-getsockopt-title.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5994919446 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/10096). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-23T08:58:23Z. --- The debt entry in `docs/dev/debt/libSceNet.md` records what one or more title call sites show; this updates it (call-site addresses included so the reading can be checked). The changed entry now reads: > [sceNetGetsockopt](../../../core/libs/prx/libSceNet/Export.cpp) (libSceNet) reads `SO_ERROR` from the host socket. Winsock does not clear a socket's pending error when it is read, so on Windows the library reports a pending error once and shows it again only after a new `sceNetConnect`; a second failure with the same code on the same socket without a `sceNetConnect` in between would be hidden. One title (PPSA02225) disassembled for this entry has one call site (0x1056d34), with level 0xffff, option 0x1007 (the FreeBSD values of `SOL_SOCKET` and `SO_ERROR`; the title holds only the numbers) and a length variable set to 4 beforehand, reached only after a helper called with the value 2 returned true. For a negative result it takes the thread's error code as the value; for a result of 0 or more with a value of 0 it reports the connection as made, and otherwise it turns the value into an error code of its own. The call does not show how often the title reads it per connection attempt or whether it keeps using the socket after an error. Fix: branch `docs/debt-net-getsockopt-title`. AI-assisted (Claude Code).
Sign in to join this conversation.
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#10096
No description provided.