Repository navigation
[main] Forward-port SocketAsyncEventArgs address-family reuse fix - #10450
Merged
Merged
Conversation
(cherry picked from commit 6f0fa48) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6d2559fe-05fb-4a93-9b04-40c9ac80fbd5
|
Azure Pipelines: Successfully started running 1 pipeline(s). 1 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
wfurt
approved these changes
Oct 26, 2026
rbhanda
enabled auto-merge
October 26, 2026 15:44
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Native buffer growth frees the old allocation before its replacement succeeds, allowing a double-free if allocation fails.
1 open issue
What changed in this PR
Forward-ports the SocketAsyncEventArgs address-family reuse fix to main, updating socket-address buffer sizing and adding regression coverage in System.Net.Sockets.
Changes:
- Size Windows native buffers from the current socket’s address family, grow them as needed, and use the declared buffer length for WSAMsg.
- Replace cached managed socket-address buffers when too small.
- Add regression tests for IPv4/IPv6 event-args reuse and caller-supplied address-family mismatches.
| File | Description |
|---|---|
src/runtime/src/libraries/System.Net.Sockets/tests/FunctionalTests/ReceiveFrom.cs |
Adds cross-family reuse and family-mismatch regression tests. |
src/runtime/src/libraries/System.Net.Sockets/src/System/Net/Sockets/SocketAsyncEventArgs.Windows.cs |
Tracks native buffer capacity and adjusts allocation and WSAMsg sizing. |
src/runtime/src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.cs |
Replaces undersized cached managed socket-address buffers. |
Review effort: Balanced
This was referenced Oct 28, 2026
This was referenced Nov 2, 2026
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.

Summary
Forward-port the released .NET 11 RC3 SocketAsyncEventArgs fix to
main.Source
Clean forward-port of public commit 6f0fa48bddc8e7baaf5932d9340487ef12621103, included in public tag
v11.0.0-rc.3.26522.148. No servicing version changes or unrelated fixes are included.@wfurt, please review the forward-port and confirm the fix and regression coverage on
main.Validation
git diff --checkpassed.11.0.100-rc.1.26420.103, which is not installed. The changed product and regression tests have not been built or executed locally.Note
This PR was prepared with GitHub Copilot.