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/compile: SIGILL when cross-compiling from netbsd/arm64 to linux/mips #52651

Open
bcmills opened this issue May 2, 2022 · 2 comments
Open
Labels
arch-arm64 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. OS-NetBSD
Milestone

Comments

@bcmills
Copy link
Contributor

bcmills commented May 2, 2022

            # internal/abi
            SIGILL: illegal instruction
            PC=0x273d40 m=4 sigcode=4
            instruction bytes: 0xa8 0x74 0x41 0x79 0x8 0x1 0x7f 0xb2 0xa8 0x74 0x1 0x79 0xd2 0xf9 0xff 0x17
            
            goroutine 9 [running]:
            cmd/internal/obj/mips.preprocess(0x4000176400, 0x4000443080, 0x40000a81a0)
            	/var/gobuilder/buildlet/go/src/cmd/internal/obj/mips/obj0.go:247 +0x1bd0 fp=0x4000637d50 sp=0x4000637bd0 pc=0x273d40
            cmd/internal/obj.Flushplist(0x4000176400, 0x4000637f28, 0x40000a81a0, {0xffffffffe6e7, 0xc})
            	/var/gobuilder/buildlet/go/src/cmd/internal/obj/plist.go:150 +0x630 fp=0x4000637e80 sp=0x4000637d50 pc=0x135610
            cmd/compile/internal/objw.(*Progs).Flush(...)
            	/var/gobuilder/buildlet/go/src/cmd/compile/internal/objw/prog.go:124
            cmd/compile/internal/ssagen.Compile(0x40003fdb80, 0x778704?)
            	/var/gobuilder/buildlet/go/src/cmd/compile/internal/ssagen/pgen.go:208 +0x574 fp=0x4000637f50 sp=0x4000637e80 pc=0x5d48b4
            cmd/compile/internal/gc.compileFunctions.func4.1(0x0?)
            	/var/gobuilder/buildlet/go/src/cmd/compile/internal/gc/compile.go:153 +0x3c fp=0x4000637f90 sp=0x4000637f50 pc=0x7785cc
            cmd/compile/internal/gc.compileFunctions.func3.1()
            	/var/gobuilder/buildlet/go/src/cmd/compile/internal/gc/compile.go:140 +0x48 fp=0x4000637fd0 sp=0x4000637f90 pc=0x778718
            runtime.goexit()
            	/var/gobuilder/buildlet/go/src/runtime/asm_arm64.s:1155 +0x4 fp=0x4000637fd0 sp=0x4000637fd0 pc=0x74814
            created by cmd/compile/internal/gc.compileFunctions.func3
            	/var/gobuilder/buildlet/go/src/cmd/compile/internal/gc/compile.go:138 +0x7c

greplogs --dashboard -md -l -e \\A.\*-arm\(.\*\\n\)\*\\s\*SIGILL --since=2022-01-01

2022-04-28T18:02:40-c15d0a9/netbsd-arm64-bsiegert

Looks like some kind of memory corruption to me, although at N=1 it isn't clear to me whether this is bug is specific to netbsd or arm64, or even some kind of weird bug in the mips compiler backend. 😅

(CC @golang/netbsd @golang/arm)

@bcmills bcmills added OS-NetBSD NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. arch-arm64 labels May 2, 2022
@cherrymui
Copy link
Member

        cmd/internal/obj/mips.preprocess(0x4000176400, 0x4000443080, 0x40000a81a0)
       	/var/gobuilder/buildlet/go/src/cmd/internal/obj/mips/obj0.go:247 +0x1bd0 fp=0x4000637d50 sp=0x4000637bd0 pc=0x273d40

At this PC the instructions are

	MOVHU   186(R5), R8
	ORR     $2, R8, R8
	MOVH    R8, 186(R5)
	JMP     804

which indeed have those bytes and are valid instructions. So it is not bad codegen. Perhaps some kernel weirdness? Or some other process sending a SIGILL? (why?) Or bad I-cache? (The printed bytes are presumably loaded through D-cache. The content of the I-cache might be different.)

@randall77
Copy link
Contributor

That instruction looks fine.

Here's the section of the compile binary at that git hash on netbsd/arm64:

  obj0.go:246           0x273d3c                b4ff3ac5                CBZ R5, -1578(PC)                                       
  obj0.go:247           0x273d40                794174a8                MOVHU 186(R5), R8                   <- this one                    
  obj0.go:247           0x273d44                b27f0108                ORR $2, R8, R8                                          

Looks like the instruction decoder and actual memory don't agree on the instruction involved. Definitely smells like corruption of some sort.

@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jul 13, 2022
@mknyszek mknyszek moved this to Triage Backlog in Go Compiler / Runtime Jul 15, 2022
@seankhliao seankhliao added this to the Unplanned milestone Aug 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-arm64 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. OS-NetBSD
Projects
Status: Triage Backlog
Development

No branches or pull requests

5 participants