-
Notifications
You must be signed in to change notification settings - Fork 268
Go tests segfault with Go 1.21 (Fedora 38 and 39) #3267
Copy link
Copy link
Closed
Labels
Type: BugError or flaw producing unexpected resultsError or flaw producing unexpected results
Milestone
Description
On fedora 39, programs linked with -linkshared (which is required by shadow) segfault on simple io function calls. For example:
sudo docker run --rm -it fedora:39dnf update -y
dnf install -y golang
go install -buildmode=shared -linkshared std
cd /tmp
cat <<EOF >> foo.go
package main
import (
"fmt"
)
func main() {
fmt.Println("hello")
}
EOF
go build -linkshared -o foo foo.go
./foopanic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x7f4ce37148b3]
goroutine 1 [running]:
os.(*File).write(...)
/usr/lib/golang/src/os/file_posix.go:46
os.(*File).Write(0x0, {0xc000014088?, 0x6, 0x7f4ce3620145?})
/usr/lib/golang/src/os/file.go:183 +0x53
fmt.Fprintln({0x403b68, 0x0}, {0xc000354720, 0x1, 0x1})
/usr/lib/golang/src/fmt/print.go:305 +0x6f
fmt.Println(...)
/usr/lib/golang/src/fmt/print.go:314
If built without the -linkshared flag, then it completes successfully.
For the shadow tests, this results in:
The following tests FAILED:
60 - simple_http-shadow (Failed)
61 - gc-linux (Failed)
62 - gc-shadow (Failed)
64 - goroutines-linux (Failed)
65 - goroutines-shadow (Failed)
Adding an os import magically makes the example above work again:
import (
_ "os"
"fmt"
)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Type: BugError or flaw producing unexpected resultsError or flaw producing unexpected results