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: incorrect length of abstract Unix domain socket paths beginning with null character #63579

Open
1f604 opened this issue Oct 16, 2023 · 3 comments
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@1f604
Copy link

1f604 commented Oct 16, 2023

What version of Go are you using (go version)?

$ go version
go version go1.21.3 linux/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/x/.cache/go-build'
GOENV='/home/x/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/x/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/x/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.21.3'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/dev/null'
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-build3291950043=/tmp/go-build -gno-record-gcc-switches'

What did you do?

https://go.dev/play/p/QzrhBGKYhJc

What did you expect to see?

Num       RefCount Protocol Flags    Type St Inode Path
0000000000000000: 00000001 00000000 00010000 0001 01        1 @begins-with-null-1
0000000000000000: 00000001 00000000 00010000 0001 01        2 @begins-with-at-1
0000000000000000: 00000001 00000000 00010000 0001 01        3 @begins-with-null-2
0000000000000000: 00000001 00000000 00010000 0001 01        4 @begins-with-at-2

What did you see instead?

Num       RefCount Protocol Flags    Type St Inode Path
0000000000000000: 00000001 00000000 00010000 0001 01        1 @begins-with-null-1\x0
0000000000000000: 00000001 00000000 00010000 0001 01        2 @begins-with-at-1
0000000000000000: 00000001 00000000 00010000 0001 01        3 @begins-with-null-2\x0
0000000000000000: 00000001 00000000 00010000 0001 01        4 @begins-with-at-2

In the syscall file there is code that special-cases handling of unix socket names beginning with @ by removing the trailing NUL character but it does not do the same for unix socket names starting with the NUL character.

It seems obvious to me that this is just a simple oversight and the fix is very simple. Lemme just make a PR...

@gopherbot
Copy link

Change https://go.dev/cl/535776 mentions this issue: syscall: stop counting trailing NUL for abstract addresses starting with NUL

@gopherbot
Copy link

Change https://go.dev/cl/535955 mentions this issue: syscall: stop counting trailing NUL for abstract addresses starting with NUL

@cagedmantis cagedmantis added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Oct 20, 2023
@cagedmantis cagedmantis added this to the Backlog milestone Oct 20, 2023
@cagedmantis
Copy link
Contributor

cc @golang/runtime

gopherbot pushed a commit that referenced this issue Oct 20, 2023
…ith NUL

Changes trailing-NUL-counting behavior for abstract addresses
starting with the NUL character to be the same as abstract
addresses starting with the @ character.

For #63579.

Change-Id: I206e4d0d808396998cb7d92a9e26dda854cb1248
GitHub-Last-Rev: 0ff0a9c
GitHub-Pull-Request: #63580
Reviewed-on: https://go-review.googlesource.com/c/go/+/535776
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
gopherbot pushed a commit to golang/sys that referenced this issue Oct 23, 2023
… NUL

Changes trailing-NUL-counting behavior for abstract addresses
starting with the NUL character to be the same as abstract
addresses starting with the @ character.

For golang/go#63579.

Change-Id: I2f26de4bcf614c4635ad188b1afa3d14ebd9a95f
Reviewed-on: https://go-review.googlesource.com/c/sys/+/535955
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
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. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
Status: In Progress
Development

No branches or pull requests

3 participants