Repository navigation
fix(libkernel): fail bind and connect with EFAULT on an unreadable address - #17253
Merged
oneandonlydean merged 1 commit intoNov 16, 2026
Merged
Conversation
12 tasks done
|
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.
|
Contributor
|
Windows check of head Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release. The hosted Windows check does not run these tests on pull requests.
AI-assisted: yes. |
gabichuuuuu
reviewed
Nov 9, 2026
gabichuuuuu
left a comment
Contributor
There was a problem hiding this comment.
Windows run of head 9ca464d50a, merged onto main 286b14d2f7 in one tree with 47 other small open PRs that touch different files. Setup: Windows 11, WinLibs GCC 15.2 r7 (x86_64-ucrt-posix-seh, the CI toolchain), Release, BUILD_TESTING=ON.
guest_socket_address_lengthwith--repeat until-fail:5: 5 / 5 pass.- Negative control, with
main'sUdp.cppand this PR's test: 5 / 5 runs fail.
12 tasks done
Gruzzberry
force-pushed
the
fix/socket-bind-connect-efault
branch
from
November 12, 2026 17:46
9ca464d to
c4491af
Compare
This was referenced Nov 13, 2026
12 tasks done
…dress Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Gruzzberry
force-pushed
the
fix/socket-bind-connect-efault
branch
from
November 15, 2026 21:24
c4491af to
55c6c6e
Compare
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
bindandconnectread the guestsockaddrthrough the raw pointer after only checking the length and the null pointer, so an unusable address such as0x10or an unreadable page crashed the host. FreeBSD 11.4'ssys_bindandsys_connectcallgetsockaddrbefore they look the descriptor up: a length aboveSOCK_MAXADDRLEN(255) givesENAMETOOLONG, a length below the size ofsa_familygivesEINVAL, and an address that cannot be copied in givesEFAULT. Both functions now copy the address into a local 255-byte buffer withGuestCopyIn_nid_no_patchright afterAddressLengthError, returnEFAULTwhen that fails and use the copy from then on, which is whatsendtoalready does. The existing order is kept, sobind(-1, ...)andconnect(-1, ...)with an unreadable address giveEFAULTbeforeEBADF, as in the kernel, and every later read stays within the copiedlength.Tested
Windows 11 (10.0.26200), WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release,
-DBUILD_TESTING=ON, onmainf5fe807.guest_socket_address_length: new checks thatbindandconnectfail withEFAULTfor the address0x10and an unreadable page on an invalid descriptor, on a stream socket and on a datagram socket. WithSocket/src/Udp.cppreverted tomainthe test fails (an unreadable address on a valid socket crashed the host, and on descriptor -1mainansweredEBADF); with this change it passes, three runs out of three.python tools/check_conventions.py --base upstream/main: passes.Overlaps
preserve blocking sockets over nonblocking native transport), feat(libkernel): cancel blocked POSIX writes with partial progress #12700 and feat(libkernel): support deferred cancellation in POSIX accept #12965 (a stack by one author) rewriteconnect_nid_postfixinSocket/src/Udp.cpp, where this PR adds three lines at the top ofconnectandbind. They already conflict withmain, sopr_overlap.pydid not compare them. This PR goes first and they rebase onto it (three lines each); asked on fix(libkernel): preserve blocking sockets over nonblocking native transport #12688.GuestSockets::ReadvandWritevin the same file, far frombindandconnect. fix(libkernel): wait for the rest of a MSG_WAITALL stream receive in the guest layer #11896 changesrecv; feat(libkernel): cancel blocked POSIX reads with owned operations #12682, fix(libkernel): fail sends and receives on a socketpair end whose peer closed on Windows #15785, fix(libSceNet): keep close-on-exec for fcntl on a sceNetSocket socket as FreeBSD does #16826, feat(libkernel): support kevent read and write events on regular files #7088 and feat(aot): consolidate native ARM64 compiler, runtime and consumers #5021 touch other parts ofUdp.cpp.Checklist
main; no other open PR implements the same functionNotImplemented_nid_no_patch); no silent stubs added.mdfiles or images added to the repositoryAI-assisted (Claude Code).
🤖 Generated with Claude Code