Repository navigation
fix(libSceNet): check the descriptor before how in sceNetShutdown, as libkernel's shutdown does - #28635
Conversation
… libkernel's shutdown does Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Change: Bug fix Merge Risk:
|
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
The change checks the socket descriptor before validating how, and the added regression checks cover invalid modes on a closed descriptor.
What I ran
Reviewed head 50e5108ea912e2e7e13bc2836be97c5c83e8ec2c. I inspected the changed shutdown function, the socket state test, and the debt entry through repo_read.py; I did not run a build or tests.
python3 repo_read.py cat core/libs/prx/libSceNet/Export.cpp 2100 2170
env -u ANYPS5_READ_LOG python3 repo_read.py cat core/libs/tests/GuestNetSocketState.cpp 1 112
env -u ANYPS5_READ_LOG python3 repo_read.py search RequireError core/libs/tests/GuestNetSocketState.cpp
Results
| Check | Result | Note |
|---|---|---|
| Changed code review | passed | All three listed files reviewed |
| Build and tests | not run | No independent execution |
| Author-reported checks | not run | Reported in the PR description |
Negative control
The author reports that restoring the prior Export.cpp behavior while keeping the new test makes guest_net_socket_state abort. I did not run this control.
Findings
Blocking
None.
Non-blocking
None.
Sources
Not verified
I did not run tests, builds, or console checks, and did not independently verify the cited FreeBSD or libkernel behavior. The reviewed files were core/libs/prx/libSceNet/Export.cpp, core/libs/tests/GuestNetSocketState.cpp, and docs/dev/debt/changes/fix-libscenet-shutdown-descriptor-first.md; files.json lists no excluded files.
To get this to a good state
No changes are required; no commands need rerunning.
|
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.
|
|
Tested
AI-assisted: yes (Claude Code); the runs are automated, this summary was written from their reports. |
ligmaSec
left a comment
There was a problem hiding this comment.
GuestNetSocketState passed on Linux x86_64 at 50e5108ea912. I also checked successful write shutdown over IPv4 and IPv6 loopback. The peer read the queued byte and then EOF, while the reverse direction still delivered bytes. The invalid-descriptor and invalid-direction cases in the supplied test passed with their expected errno precedence.
AI-assisted: yes.
Plyxen
left a comment
There was a problem hiding this comment.
I read the diff at 50e5108ea9. Windows 11 with GCC 15.2 and Linux (Ubuntu 24.04 in WSL2, GCC 13.3), merged into main at b97867d3ce6 together with other open PRs (so not an isolated build).
guest_net_socket_state: pass on both.- Control (same tree and tests, the changed files of those PRs put back to
main's): aborts on both.
Not checked: a title.
AI-assisted: yes (Claude Code)
What
sceNetShutdownrefused an invalidhowwithEINVALbefore it looked the descriptor up, so a closed or unknown descriptor with a badhowgotEINVAL. FreeBSD 11.4'skern_shutdownlooks the descriptor up first (EBADF) andsoshutdownthen checkshow; libkernel'sshutdowndoes the same. The check now follows the lookup.GuestNetSocketState.cppchecks thatsceNetShutdownon a closed descriptor withhow-1 and 3 fails withEBADF, next to its existingEINVALchecks on an open socket. The debt fragment adds an entry saying the order is not measured on a console.Tested
Commit 50e5108 on
main4a7fd1c, Release, in a workflow on my fork: https://github.com/Dr-Coconut/AnyPS5/actions/runs/46832781536windows-latest, image windows-2025-vs2026, WinLibs GCC 15.2.015.2.0posix-14.0.0-ucrt-r7) and Linux (GitHub-hostedubuntu-latest, image ubuntu-26.04, GCC 15.2.0), with the change:guest_net_socket_statepasses, and so do the eightguest_net_address_fault_*tests.Export.cpprestored tomainand the new case kept:guest_net_socket_stateaborts (itsRequireprints no line); the controls pass.Not run on macOS. No title tested.
tools/check_conventions.pypasses andtools/debt_fold.py --checkaccepts the fragment.tools/pr_overlap.py --branchreported no overlap among the open pull requests it could merge; it could not compare eight that conflict withmain. Compared by hand: #12682, #12688, #12700 and #12965 rework blocking transfers and connects on Windows; #5836 adds peer-socket types; #16826 keeps close-on-exec infcntl; #18108 changes socket options; #23975 adds a DNS override. None of them changessceNetShutdown.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)🤖 Generated with Claude Code
Summary by CodeRabbit
sceNetShutdownnow return a bad-descriptor error before invalid shutdown modes are checked.