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

Do not setsockopt(2) on AF_UNIX / AF_VSOCK sockets #280

Merged
merged 1 commit into from
Jan 22, 2025

Conversation

msanft
Copy link
Contributor

@msanft msanft commented Jan 16, 2025

With Linux 6.12, specifically this commit:
torvalds/linux@5b0af62, one can not call setsockopt(2) on non-inet (AF_INET/AF_INET6) sockets anymore. As the ttRPC socket can only ever be non-inet, we should not ever call setsockopt(2) here.

With Linux 6.12, specifically this commit:
torvalds/linux@5b0af62,
one can not call `setsockopt(2)` on non-inet (`AF_INET`/`AF_INET6`)
sockets anymore. As the ttRPC socket can only ever be non-inet, we
should not ever call `setsockopt(2)` here.

Signed-off-by: Moritz Sanft <[email protected]>
@msanft msanft force-pushed the msanft/setsockopt-fix branch from ae64b60 to 599048a Compare January 16, 2025 16:05
@Tim-Zhang Tim-Zhang requested review from lifupan and wllenyj January 17, 2025 07:27
Copy link
Member

@Tim-Zhang Tim-Zhang left a comment

Choose a reason for hiding this comment

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

Good catch, LGTM thanks @msanft,

This code was introduced by @wllenyj five years ago in a internal project and was ported by me on #48.

I suspect this is a misspelling of SO_REUSEADDR, however this line should not exist, it does not make any sense.

@lifupan lifupan merged commit 165b53e into containerd:master Jan 22, 2025
10 checks passed
Tim-Zhang added a commit to Tim-Zhang/ttrpc-rust that referenced this pull request Jan 22, 2025
Changelog:
- containerd#280

Signed-off-by: Tim Zhang <[email protected]>
@Tim-Zhang Tim-Zhang mentioned this pull request Jan 22, 2025
@stefano-garzarella
Copy link

With Linux 6.12, specifically this commit: torvalds/linux@5b0af62, one can not call setsockopt(2) on non-inet (AF_INET/AF_INET6) sockets anymore. As the ttRPC socket can only ever be non-inet, we should not ever call setsockopt(2) here.

Just to be clear here, you can call setsockopt(2) also to non-inet socket, what changed here is calling it with SO_REUSEPORT. It will fail now, but for example it was never really supported in AF_VSOCK (and AF_UNIX of course where there aren't port). See https://lore.kernel.org/regressions/CACW2H-7QEMKA+LUAzFJ+srmRCzSuLk2G7shWt0SGR9SfmxwOjA@mail.gmail.com/

@msanft
Copy link
Contributor Author

msanft commented Jan 22, 2025

Yeah, thanks for the addendum @stefano-garzarella. I should have made it more clear in my original post that this is specific to the way setsockopt(2) is used here in ttrpc-rust. (i.e. with SO_REUSEPORT)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants