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

cmd/asm: panic assembling VGATHERDPD instruction #43421

Open
mmcloughlin opened this issue Dec 29, 2020 · 0 comments
Open

cmd/asm: panic assembling VGATHERDPD instruction #43421

mmcloughlin opened this issue Dec 29, 2020 · 0 comments
Labels
NeedsFix
Milestone

Comments

@mmcloughlin
Copy link
Contributor

@mmcloughlin mmcloughlin commented Dec 29, 2020

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

$ go version
go version go1.15.6 darwin/amd64

Does this issue reproduce with the latest release?

Yes, it's present in go1.16beta1 too.

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

go env Output
$ go env
GO111MODULE="auto"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/mbm/Library/Caches/go-build"
GOENV="/Users/mbm/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/mbm/Development/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/mbm/Development/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.15.6/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.15.6/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/mbm/Development/avo/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/cj/jl6w0c1j4sz5vs05h5l1cby40000gn/T/go-build260372576=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Assembling the following code:

TEXT ·test(SB), 0, $0
	VGATHERDPD	32(Y13*8), Z17
	RET

What did you expect to see?

Assembler should produce an error.

What did you see instead?

$ go tool asm panic.s
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1189ec2]

goroutine 1 [running]:
cmd/internal/obj/x86.(*AsmBuf).doasm(0xc0000bfb90, 0xc00009c820, 0xc0000ce100, 0xc0000935f0)
	/usr/local/Cellar/go/1.15.6/libexec/src/cmd/internal/obj/x86/asm6.go:4235 +0x74e2
cmd/internal/obj/x86.(*AsmBuf).asmins(0xc0000bfb90, 0xc00009c820, 0xc0000ce100, 0xc0000935f0)
	/usr/local/Cellar/go/1.15.6/libexec/src/cmd/internal/obj/x86/asm6.go:5382 +0x65
cmd/internal/obj/x86.span6(0xc00009c820, 0xc0000ce100, 0xc00008e540)
	/usr/local/Cellar/go/1.15.6/libexec/src/cmd/internal/obj/x86/asm6.go:2154 +0x545
cmd/internal/obj.Flushplist(0xc00009c820, 0xc0000bfe30, 0x0, 0x0, 0x0)
	/usr/local/Cellar/go/1.15.6/libexec/src/cmd/internal/obj/plist.go:107 +0x762
main.main()
	/usr/local/Cellar/go/1.15.6/libexec/src/cmd/asm/main.go:91 +0x74b

I'm guessing this is an unsafe use of p.GetFrom3():

if p.GetFrom3().Reg >= REG_K0 && p.GetFrom3().Reg <= REG_K7 {

@agnivade agnivade added the NeedsFix label Dec 30, 2020
@agnivade agnivade added this to the Backlog milestone Dec 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsFix
Projects
None yet
Development

No branches or pull requests

2 participants