Repository navigation
Conversation
10 tasks done
This was referenced Oct 13, 2026
xXPBSXx
force-pushed
the
fix/socket-address-length
branch
from
October 13, 2026 07:03
d06efc5 to
004eb28
Compare
10 tasks done
This was referenced Oct 13, 2026
This was referenced Oct 13, 2026
This was referenced Oct 13, 2026
This was referenced Oct 13, 2026
bind, connect and sendto answered EFAULT for an address length below 2 and EAFNOSUPPORT for an AF_INET address below 16 or an AF_INET6 address below 28 bytes. FreeBSD 11.4's getsockaddr fails a length below 2 with EINVAL and above SOCK_MAXADDRLEN (255) with ENAMETOOLONG, and the protocols compare the length with sizeof(struct sockaddr_in) or sockaddr_in6 and fail with EINVAL. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
10 tasks done
xXPBSXx
force-pushed
the
fix/socket-address-length
branch
from
October 13, 2026 14:20
004eb28 to
9fc03d3
Compare
…ess_length Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This was referenced Oct 14, 2026
Collaborator
|
Closing: no title is known to reach this. With the queue at 700+ open PRs, please hold off on new PRs that don't name a title needing the change until it's down. If a title stops on this on current main, reopen with the title ID and the log line. |
9 tasks done
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.
What
bind,connectandsendtoon a libkernel socket checked the guestsockaddrlength inAddress()(Udp.cpp) with rules of their own: a length below 2 failed withEFAULT(14), and anAF_INETaddress below 16 or anAF_INET6address below 28 bytes withEAFNOSUPPORT(47). FreeBSD 11.4 answers these differently:getsockaddrfails a length aboveSOCK_MAXADDRLEN(255) withENAMETOOLONG(63) and a length belowoffsetof(struct sockaddr, sa_data)(2) withEINVAL(22).sa_len) withsizeof(struct sockaddr_in)/sockaddr_in6and fail a mismatch withEINVAL(tcp_usr_connect,in_pcbconnect_setup). A null address with a length of 2 to 255 isEFAULT(copyin), as before; a null address with a length below 2 now fails withEINVALand one above 255 withENAMETOOLONG, becausegetsockaddrchecks the length before it copies (read inrelease/11.4.0).Address()now returns these three errors. A full-size address is unchanged. Not changed, because the console's answer is not known: an address longer thansockaddr_in/sockaddr_in6is still accepted (FreeBSD saysEINVAL), and a different family still fails withEAFNOSUPPORT. Both are in the TechnicalDebt entry.No title evidence: found by writing failure-path tests from the FreeBSD source (see Tested), no title I ran passes a short address. This is FreeBSD conformance.
Overlap: the overlap bot lists no pull request for this one, and
git merge-treeof the head9fc03d33aagainstmainbf8dc610eis clean (checked, not rebuilt). The test registration sits beforeguest_socket_read_writeincore/libs/prx/libkernel/CMakeLists.txtand the TechnicalDebt entry after thesend, sendtoentry inlibkernel.md, away from the places the other socket PRs use. #5565 (Dripl1x,TCP_NODELAY,SO_NOSIGPIPEandSO_NBIO) conflicts with this PR indocs/dev/debt/libkernel.md(git merge-treeof the two heads, re-checked againstmaince5c83953; both heads are clean againstmain); whichever lands second rebases the debt entry.Tested
Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, on
mainc2565f014; moved since to a newermain(git merge-treeagainstmainbf8dc610eis clean; not rebuilt there) with its test registration and debt entry at their own places:guest_socket_address_length(new) passes: lengths 0, 1, 3, 8, 15 (AF_INET), 20 (AF_INET6) fail withEINVAL, 256 withENAMETOOLONG, a null address withEFAULT, a fullsockaddr_instill binds.Udp.cpp(connect with a length below the size of sa_family must fail with EINVAL (22) (errno 14)).guest_udp,guest_tcp,guest_sce_net,guest_poll,guest_dup,guest_select,guest_socket*): pass together with the new one.python tools/check_conventions.py --base upstream/mainpasses.main0f2683cb7:guest_socket_address_lengthtakes 0.21 s (ctest, serial, Windows). The fullguest_*/ libc / libkernel group passes (391 of 391, 0 failed; the build also contains the other branches of this series).2e553b97c(test only):guest_socket_address_lengthnow checks the result ofsocket(AF_INET6, ...)and closes that socket (before, a host without IPv6 would have answeredEBADFinstead ofEINVAL, and the descriptor stayed open). Rebuilt and run on the new head (base1e7f4967e, Windows 10, MinGW GCC 15.2.0, Release,-j4):guest_socket_address_lengthpasses; withUdp.cpptaken back to the base it fails (connect with a length below the size of sa_family must fail with EINVAL (22) (errno 14));python tools/check_conventions.py --base upstream/mainpasses.Checklist
main; no other open PR implements the same functions (overlaps described above)NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt (docs/dev/debt/libkernel.md).mdfiles or images added to the repositoryAI-assisted (Claude Code).
🤖 Generated with Claude Code