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

syscall: unable to use the full length for abstract socket starting with null #70893

Open
albertsundjaja opened this issue Dec 18, 2024 · 3 comments · May be fixed by #70901
Open

syscall: unable to use the full length for abstract socket starting with null #70893

albertsundjaja opened this issue Dec 18, 2024 · 3 comments · May be fixed by #70901
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@albertsundjaja
Copy link

albertsundjaja commented Dec 18, 2024

Go version

go version go1.23.3 linux/amd64

Output of go env in your module/workspace:

GO111MODULE='on'
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/albert/.cache/go-build'
GOENV='/home/albert/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/albert/go/pkg/mod'
GONOPROXY='bitbucket.org/vivcourt/*'
GONOSUMDB='bitbucket.org/vivcourt/*'
GOOS='linux'
GOPATH='/home/albert/go'
GOPRIVATE='bitbucket.org/vivcourt/*'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/albert/go/pkg/mod/golang.org/[email protected]'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/albert/go/pkg/mod/golang.org/[email protected]/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.23.3'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/albert/.config/go/telemetry'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/albert/glue/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3031541326=/tmp/go-build -gno-record-gcc-switches'

What did you do?

https://go.dev/play/p/Lro4QrH5-BK

What did you see happen?

padded addr1 (@begins-with-at) with length: 108
padded addr2 (begins-with-null) with length: 108
panic: listen unix begins-with-null: bind: invalid argument

goroutine 1 [running]:
main.main()
/tmp/sandbox3694864181/prog.go:27 +0x294

What did you expect to see?

both address (beginning with @ and null or 0) should be useable to specify abstract unix domain socket with length of 108 (full path length)

the issue seems to be this line of code that checks for @ for abstract domain socket but not for 0
https://github.com/golang/go/blob/master/src/syscall/syscall_linux.go#L557

considering how the next part of the code checks for 0 and sl > 3 https://github.com/golang/go/blob/master/src/syscall/syscall_linux.go#L569
I would expect that specifying 0 to indicate it's a domain socket to be a valid way of doing so

let me know if this is something that should be fixed, I would be more than happy to create a PR. Thanks!

@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Dec 18, 2024
@ianlancetaylor
Copy link
Member

Sure, send a patch. Thanks.

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/637335 mentions this issue: syscall: allow \x00-prefixed unix abstract socket to use full path length

@dr2chase dr2chase added the NeedsFix The path to resolution is known, but the work has not been done. label Dec 18, 2024
@mknyszek mknyszek added this to the Go1.25 milestone Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsFix The path to resolution is known, but the work has not been done.
Projects
Development

Successfully merging a pull request may close this issue.

6 participants