Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-37228: Fix loop.create_datagram_endpoint()'s usage of SO_REUSEADDR #17311

Merged

Conversation

aeros
Copy link
Contributor

@aeros aeros commented Nov 21, 2019

Edit: This PR has been revised based on @pitrou's proposal, due to Windows compatibility concerns.

https://bugs.python.org/issue37228

Copy link
Member

@1st1 1st1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually think that Antoine solution is more preferable. @asvetlov?

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@aeros
Copy link
Contributor Author

aeros commented Nov 21, 2019

@1st1

I actually think that Antoine solution is more preferable

I prefer Antoine's solution as well as far as elegance and API design goes, my only concern is that it would be fairly disruptive with regards to backwards compatibility (from raising an error upon passing reuse_address=True) to apply all the way back to 3.5+. I'll wait for @asvetlov's feedback though.

Edit: If the consensus is to use Antoine's proposal instead, I can modify this PR accordingly. As long as it's within the next couple of days, I should have the time to do so. If I don't have enough time, I'll close this PR and let someone else implement it.

@aeros aeros force-pushed the bpo37228-create_datagram_endpoint-reuse_address branch from aae05e6 to e3c895c Compare November 21, 2019 06:22
@aeros aeros changed the title bpo-37228: Fix loop.create_datagram_endpoint() reuse_address bpo-37228: Fix loop.create_datagram_endpoint()'s usage of SO_REUSEADDR Nov 21, 2019
@aeros aeros force-pushed the bpo37228-create_datagram_endpoint-reuse_address branch from e3c895c to 397c9be Compare November 21, 2019 07:59
@aeros
Copy link
Contributor Author

aeros commented Nov 21, 2019

Due to Windows compatibility concerns, I no longer think that changing SO_REUSEADDR -> SO_REUSEPORT is going to be a viable option. As a result, I will start working on implementing Antoine's proposal. For more details, see https://bugs.python.org/msg357143.

@aeros aeros force-pushed the bpo37228-create_datagram_endpoint-reuse_address branch from 397c9be to d748ca1 Compare November 21, 2019 09:45
@@ -527,6 +529,10 @@ Opening network connections
The *family*, *proto*, *flags*, *reuse_address*, *reuse_port,
*allow_broadcast*, and *sock* parameters were added.

.. versionchanged:: 3.5.10
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming that version 3.5.10 would be the next released 3.5.x, and the earliest version that this change will apply to. Is this correct?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is being added to multiple releases mid-stream, I think the right approach is for each branch to have its own versionchanged value, except perhaps master which would also have the 3.8 version (since 3.9 isn't released yet). So perhaps change this to the right 3.8.x version and then either manually cherry-pick for 3.7 and earlier (which might need to be done anyway if there are merge conflicts) or submit separate post-merge PRs for them to change the versionadded value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ned-deily

So perhaps change this to the right 3.8.x version and then either manually cherry-pick for 3.7 and earlier (which might need to be done anyway if there are merge conflicts) or submit separate post-merge PRs for them to change the versionadded value.

Sounds good, I can do that. I'll set master and the 3.8 branch to 3.8.1; 3.7 to 3.7.6; 3.6 to 3.6.10; and 3.5 to 3.5.10. The easiest way to handle this would probably be through using cherry-pick to open the backport PRs manually. As a result, I'll remove the ``needs backport to x` labels, so that @miss-islington doesn't automatically open the backport PRs.

Should we check with @larryhastings regarding the 3.5 backport? I believe it would be appropriate since this is a significant security vulnerability.

@aeros
Copy link
Contributor Author

aeros commented Nov 21, 2019

@1st1 I finished changing the PR based on @pitrou's proposal, due to the Windows compatibility issues with the previous implementation.

I have made the requested changes; please review again.

@bedevere-bot
Copy link

Thanks for making the requested changes!

@1st1: please review the changes made to this pull request.

@aeros
Copy link
Contributor Author

aeros commented Nov 21, 2019

I'll add a Misc/NEWS entry.

@aeros aeros requested a review from 1st1 December 3, 2019 03:06
@aeros
Copy link
Contributor Author

aeros commented Dec 8, 2019

Based on @ned-deily's suggestion to manually set the versionchanged to separate values for the 3.7, 3.6, and 3.5 branches, I'll remove the needs backport to 3.7 and needs backport to 3.6 labels so that @miss-islington doesn't open the backport PRs automatically.

If this PR is accepted and merged, I'll use cherry-picker to manually open the backport PRs for 3.7, 3.6, and 3.5.

Regarding the "What's New" entries, I would prefer to do those separately to simplify the merge conflicts. I'll have definitely time to take care of this on Monday, but for today and tomorrow I'll likely be busy with finishing up my final exams (last week of the Fall semester).

I should have time to make very small changes or reply to feedback, but I will likely not have time to do anything substantial until Monday (Dec 9th), unless I'm able to finish my work early on Sunday.

Edit: If any larger changes are needed before Monday, feel free to open a PR to my branch at https://github.com/aeros/cpython/tree/bpo37228-create_datagram_endpoint-reuse_address and I should be able to merge it. I've also ticked allow edits from maintainers, which allows minor changes to the contents of the PR through the GitHub UI.

Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bedevere-bot
Copy link

@ambv: Please replace # with GH- in the commit message next time. Thanks!

@miss-islington
Copy link
Contributor

Thanks @aeros for the PR, and @ambv for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 9, 2019
pythonGH-17311)

(cherry picked from commit ab513a3)

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
@bedevere-bot bedevere-bot removed the needs backport to 3.8 only security fixes label Dec 9, 2019
@bedevere-bot
Copy link

GH-17529 is a backport of this pull request to the 3.8 branch.

ambv pushed a commit that referenced this pull request Dec 9, 2019
GH-17311) (#17529)

(cherry picked from commit ab513a3)

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
@ambv
Copy link
Contributor

ambv commented Dec 9, 2019

Note: merged for 3.8 and 3.9. @aeros removed backport labels to 3.6 and 3.7 here. The issue on BPO still lists those versions as affected. Please fix either way.

@aeros
Copy link
Contributor Author

aeros commented Dec 10, 2019

@ambv

@aeros removed backport labels to 3.6 and 3.7 here. The issue on BPO still lists those versions as affected. Please fix either way.

This is because they need to be manually backported, due to a difference in the versionchanged note. I'll take care of this process and attach the backport PRs to the bpo issue.

ned-deily pushed a commit to ned-deily/cpython that referenced this pull request Dec 11, 2019
pythonGH-17311) (pythonGH-17529)

(cherry picked from commit ab513a3)

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
ned-deily added a commit that referenced this pull request Dec 11, 2019
GH-17311) (GH-17570)

(cherry picked from commit ab513a3)

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
aeros added a commit to aeros/cpython that referenced this pull request Dec 11, 2019
aeros added a commit to aeros/cpython that referenced this pull request Dec 11, 2019
…USEADDR (pythonGH-17311).

(cherry picked from commit ab513a3)

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
ned-deily pushed a commit that referenced this pull request Dec 11, 2019
…USEADDR (GH-17311). (GH-17571)

(cherry picked from commit ab513a3)

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
shihai1991 pushed a commit to shihai1991/cpython that referenced this pull request Jan 31, 2020
fantix added a commit to fantix/uvloop that referenced this pull request May 9, 2020
fantix added a commit to fantix/uvloop that referenced this pull request May 9, 2020
fantix added a commit to MagicStack/uvloop that referenced this pull request May 13, 2020
Olaf1022 added a commit to Olaf1022/Ultra-fast-asyncio that referenced this pull request Aug 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants