-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
net: add handling for abstract socket name #6772
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
net: add handling for abstract socket name #6772
Conversation
afe849e to
062c36b
Compare
Darksonn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could make sense to release as an 1.39.3. Thoughts?
yes, I agree. |
|
I just created a |
aa870b7 to
50fe61a
Compare
Bumps tokio from 1.39.2 to 1.39.3. Release notes Sourced from tokio's releases. Tokio v1.39.3 1.39.3 (August 17th, 2024) This release fixes a regression where the unix socket api stopped accepting the abstract socket namespace. (#6772) #6772: tokio-rs/tokio#6772 Commits 3d439ab chore: prepare Tokio v1.39.3 (#6782) b2ea40b net: add handling for abstract socket name (#6772) See full diff in compare view Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase. Dependabot commands and options You can trigger Dependabot actions by commenting on this PR: @dependabot rebase will rebase this PR @dependabot recreate will recreate this PR, overwriting any edits that have been made to it @dependabot merge will merge this PR after your CI passes on it @dependabot squash and merge will squash and merge this PR after your CI passes on it @dependabot cancel merge will cancel a previously requested merge and block automerging @dependabot reopen will reopen this PR if it is closed @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
| let addr = { | ||
| let os_str_bytes = path.as_ref().as_os_str().as_bytes(); | ||
| if os_str_bytes.starts_with(b"\0") { | ||
| StdSocketAddr::from_abstract_name(os_str_bytes)? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there might a bug here.
The leading '\0' should not be passed to the StdSocketAddr::from_abstract_name() because this way there will be two leading NUL chars in the final name (i.e. \0\0...).
Here the addr is initialized with mem::zeroed() and later the passed name is copied to the ptr + 1:
crate::ptr::copy_nonoverlapping(
name.as_ptr(),
addr.sun_path.as_mut_ptr().add(1) as *mut u8,
name.len(),
);So, there are two NULs - one from zeroed() and another from name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you open an issue or PR?
| let addr = { | ||
| let os_str_bytes = path.as_ref().as_os_str().as_bytes(); | ||
| if os_str_bytes.starts_with(b"\0") { | ||
| StdSocketAddr::from_abstract_name(os_str_bytes)? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as https://github.com/tokio-rs/tokio/pull/6772/files#r2335889347 if my analysis is correct
Motivation
Closes #6767.
Solution
If the beginning of the path is
\0, we fallback to std'sfrom_abstract_name.