Repository navigation
Description
Go version
go1.28-devel_e58509ab7ed2 linux/amd64
Output of go env in your module/workspace:
AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE=''
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN='/home/user/go/bin'
GOCACHE='/home/user/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/home/user/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3452989561=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/home/project/p4test'
GOMODCACHE='/home/user/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPACKAGESDRIVER=''
GOPATH='/home/user/go'
GOPRIVATE=''
GOPROXY='https://goproxy.cn,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.google.cn'
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/user/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='local'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.28-devel_e58509ab7ed2'
GOWORK=''
PKG_CONFIG='pkg-config'What did you do?
While reviewing the Linux syscall assembly implementations, I noticed that several syscall wrappers use unsigned less-than-or-equal comparisons to distinguish successful return values from errors.
On Linux, syscall return values in the range -4095 to -1 (inclusive) indicate errors.
However, the current implementations compare the return value against -4095 and branch to the success path when the value is less than or equal to that boundary.
For example, on linux/amd64:
CMPQ AX, $0xfffffffffffff001
JLS ok
Similar comparisons exist in the Linux syscall implementations for 386 and ARM.
What did you see happen?
All syscall return values in the range -4095 to -1, including the boundary value -4095, should be recognized as errors and handled through the appropriate error path.
What did you expect to see?
The unsigned less-than-or-equal comparison includes the boundary value -4095, causing it to be incorrectly classified as a successful syscall return value.
This may result in incorrect return values or missing error propagation when a syscall returns this boundary value.
The issue affects syscall implementations in the following packages on linux/386, linux/amd64, and linux/arm:
-
runtime
-
syscall
-
internal/runtime/syscall/linux
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsIn Progress
Activity
gopherbot commentedon Oct 15, 2026
Change https://go.dev/cl/848687 mentions this issue:
runtime, syscall: fix Linux syscall error boundary handlinggabyhelp commentedon Oct 15, 2026
Related Issues
Related Code Changes
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)