-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
syscall: support for abstract unix domain socket with len(name) == len(sa.raw.Path) #21965
Labels
Milestone
Comments
ianlancetaylor
changed the title
Support for abstract unix domain socket with len(name) == len(sa.raw.Path)
syscall: support for abstract unix domain socket with len(name) == len(sa.raw.Path)
Sep 21, 2017
Something along the lines of that patch looks fine, with a test case. Thanks. |
ianlancetaylor
added
the
NeedsFix
The path to resolution is known, but the work has not been done.
label
Sep 21, 2017
Change https://golang.org/cl/66190 mentions this issue: |
Change https://golang.org/cl/66333 mentions this issue: |
gopherbot
pushed a commit
that referenced
this issue
Sep 28, 2017
Also changed name from TestUnix... to TestUnixgram.... Updates #21965 Change-Id: I2833110b77e9fe1b28d4a15feb3d70453ab98d3b Reviewed-on: https://go-review.googlesource.com/66333 Run-TryBot: Ian Lance Taylor <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Mikio Hara <[email protected]> Reviewed-by: Rob Pike <[email protected]>
akimd
added a commit
to akimd/hyperkit
that referenced
this issue
Nov 20, 2017
First pinata tried to let them in stateDir. However, at least its current name there (`com.docker.driver.amd64-linux`) is so long that our socket names become invalid for the OS (plenty of pages about this on the Internet, e.g. golang/go#21965). Allow the user to decide where to store them. Pinata uses this feature have shorter socket path names. Signed-off-by: Akim Demaille <[email protected]>
akimd
added a commit
to akimd/hyperkit
that referenced
this issue
Nov 23, 2017
When moving to use hyperkit.go, Docker for Mac first tried to leave them in stateDir. However, its current name there (`"com.docker.driver.amd64-linux"`) is so long that the socket names become invalid for the OS (plenty of pages about this on the Internet, e.g. golang/go#21965). Allow the user to decide where to store them. Docker for Mac uses this feature have shorter socket path names. Signed-off-by: Akim Demaille <[email protected]>
akimd
added a commit
to akimd/hyperkit
that referenced
this issue
Dec 6, 2017
When moving to use hyperkit.go, Docker for Mac first tried to leave them in stateDir. However, its current name there (com.docker.driver.amd64-linux) is so long that the socket names become invalid for the OS (plenty of pages about this on the Internet, e.g. golang/go#21965). Allow the user to decide where to store them. Docker-for-Mac uses this feature to have shorter socket path names. Signed-off-by: Akim Demaille <[email protected]>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
What version of Go are you using (
go version
)?go version go1.9 linux/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?GOOS="linux" GOARCH="amd64"
But the issue seems to be present on every linux system (also tested on armv7)
What did you do?
I have a C server process which creates an unix domain socket with the following code:
By calling the
bind()
function with the fullsizeof(addr_un)
as the size, it creates an abstract unix socket whose name is actually 108 bytes long (one starting null byte, the socket name, and more null bytes as padding at the end). While not a good practice, that kind of code does exists in the wild.I tried to make net.Dial() connection to this server from a go program
What did you expect to see?
Obviously,
net.Dial("unix", "@something")
fails. This is expected behaviour because the abstract unix socket name length (10 in this case) does not match the server size (108), but I expected the following code to work:What did you see instead?
This code also fails because the
func (sa *SockaddrUnix) sockaddr()
function insrc/syscall/syscall_linux.go
returns an EINVAL error if the sockaddr name is greater or equal to the length of the sockaddr raw path (declared as 108 for linux).This limit makes sense for non-abstract unix domain sockets, as the path have to be a null terminated string, but as the abstract unix domain sockets does not have this limitation, it artificially forbids connection to any socket with
len(name) == len(sa.raw.Path)
I made the following change to my go distribution, which seems to solve the problem without creating any other visible issues (all tests are still OK):
If the patch seams reasonable, I can submit it properly to Gerrit.
The text was updated successfully, but these errors were encountered: