diff --git a/test/fixedbugs/issue11656.go b/test/fixedbugs/issue11656.go index 50182633645..acd3f4f3e5d 100644 --- a/test/fixedbugs/issue11656.go +++ b/test/fixedbugs/issue11656.go @@ -27,13 +27,6 @@ import ( ) func main() { - // This test is currently failing on some architectures. - // See issue #43283. - switch runtime.GOARCH { - case "ppc64", "mips", "mipsle", "mips64", "mips64le": - return - } - debug.SetPanicOnFault(true) defer func() { if err := recover(); err == nil { @@ -61,27 +54,30 @@ func f(n int) { x uintptr } - // We want to force an illegal instruction, to get a crash - // at a PC value != 0. + // We want to force a seg fault, to get a crash at a PC value != 0. // Not all systems make the data section non-executable. ill := make([]byte, 64) switch runtime.GOARCH { case "386", "amd64": - binary.LittleEndian.PutUint16(ill, 0x0b0f) // ud2 + ill = append(ill, 0x89, 0x04, 0x25, 0x00, 0x00, 0x00, 0x00) // MOVL AX, 0 case "arm": - binary.LittleEndian.PutUint32(ill, 0xe7f000f0) // no name, but permanently undefined + binary.LittleEndian.PutUint32(ill, 0xe3a00000) // MOVW $0, R0 + binary.LittleEndian.PutUint32(ill, 0xe5800000) // MOVW R0, (R0) case "arm64": - binary.LittleEndian.PutUint32(ill, 0xd4207d00) // brk #1000 + binary.LittleEndian.PutUint32(ill, 0xf90003ff) // MOVD ZR, (ZR) case "ppc64": - binary.BigEndian.PutUint32(ill, 0x7fe00008) // trap + binary.BigEndian.PutUint32(ill, 0xf8000000) // MOVD R0, (R0) case "ppc64le": - binary.LittleEndian.PutUint32(ill, 0x7fe00008) // trap + binary.LittleEndian.PutUint32(ill, 0xf8000000) // MOVD R0, (R0) case "mips", "mips64": - binary.BigEndian.PutUint32(ill, 0x00000034) // trap + binary.BigEndian.PutUint32(ill, 0xfc000000) // MOVV R0, (R0) case "mipsle", "mips64le": - binary.LittleEndian.PutUint32(ill, 0x00000034) // trap + binary.LittleEndian.PutUint32(ill, 0xfc000000) // MOVV R0, (R0) case "s390x": - binary.BigEndian.PutUint32(ill, 0) // undefined instruction + ill = append(ill, 0xa7, 0x09, 0x00, 0x00) // MOVD $0, R0 + ill = append(ill, 0xe3, 0x00, 0x00, 0x00, 0x00, 0x24) // MOVD R0, (R0) + case "riscv64": + binary.LittleEndian.PutUint32(ill, 0x00003023) // MOV X0, (X0) default: // Just leave it as 0 and hope for the best. }