Skip to content

runtime/race: setting cap_net_bind_service or cap_net_raw capabilities disables halt_on_error #59434

@ainar-g

Description

@ainar-g

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

$ go version
go version go1.20.2 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/ainar/.cache/go-build"
GOENV="/home/ainar/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/ainar/go/pkg/mod"
GONOPROXY="REMOVED"
GONOSUMDB="REMOVED"
GOOS="linux"
GOPATH="/home/ainar/go"
GOPRIVATE="REMOVED"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/ainar/go/go1.20"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/ainar/go/go1.20/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.20.2"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/home/ainar/dev/tmp/go/tmp/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 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build2426973317=/tmp/go-build -gno-record-gcc-switches"

What did you do?

package main

import (
	"fmt"
	"time"
)

func main() {
	for i := 0; i < 100; i++ {
		go f(&i)
	}

	time.Sleep(1 * time.Second)

	fmt.Println("the end")
}

func f(p *int) {
	fmt.Println(*p)
}
GORACE='atexit_sleep_ms=0 halt_on_error=1'
export GORACE

go build --race -o tmp_with_setcap
sudo setcap 'cap_net_bind_service+ep' ./tmp_with_setcap
./tmp_with_setcap

go build --race -o tmp_no_setcap
./tmp_no_setcap

What did you expect to see?

Neither of these two reaching the end.

What did you see instead?

The last one correctly terminates; the one with setcap doesn't and reaches the end.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.RaceDetectorcompiler/runtimeIssues related to the Go compiler and/or runtime.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions