Date: Thu, 29 May 2014 08:55:42 +1000 From: Peter Jeremy <peter@rulingia.com> To: Konstantin Belousov <kostikbel@gmail.com> Cc: freebsd-amd64@freebsd.org Subject: Re: i386 Go programs crash on amd64 Message-ID: <20140528225542.GA46230@server.rulingia.com> In-Reply-To: <20140526134457.GR74331@kib.kiev.ua> References: <20140523225300.GA14433@server.rulingia.com> <537FD853.3000505@wemm.org> <537FD9A2.2010607@wemm.org> <20140523233444.GH74331@kib.kiev.ua> <20140524033944.GA96083@server.rulingia.com> <20140524074101.GI74331@kib.kiev.ua> <20140526113622.GB96083@server.rulingia.com> <20140526134457.GR74331@kib.kiev.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
--5mCyUwZo2JvN/JJP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2014-May-26 16:44:57 +0300, Konstantin Belousov <kostikbel@gmail.com> wr= ote: >On Mon, May 26, 2014 at 09:36:22PM +1000, Peter Jeremy wrote: >> On 2014-May-24 10:41:01 +0300, Konstantin Belousov <kostikbel@gmail.com>= wrote: >> >> >Provide the minimal test case. >> >>=20 >> >> The following go program, compiled on i386 and run on amd64 will die >> >> with a segmentation violation or bus error: >> >> ------- >> >> package main >> >>=20 >> >> import "fmt" >> >>=20 >> >> func main() { >> >> fmt.Println("Hello World") >> >> } >> >> ------- >> >No, this is not consumable. >> > >> >I need a self-contained minimal example written in C/asm. >>=20 >> Actually, I've found that >> -------- >> package main >> import "syscall" >> func main() { syscall.Write(1, []byte("Hello World\n")) } >> -------- >> also crashes ~66 syscalls after the first sysarch(2) call. That >> reduces the binary to 520K (go reports this is 50K lines of assembler). >>=20 >> >If this is too hard to produce, give the the self-contained >> >binary, again as small as possible (small by comparing the >> >number of syscalls before the issue manifests itself). >>=20 >> I've uploaded the source, binary and disassembly to >> freefall:~peterj/write{.go,,.S} (and verified it crashes). >>=20 >> If I get time, I'll see if I can strip some of the support code out of >> Go to shrink it further. > >What exactly do you mean by 'crashing' ? I see it dying with either SIGBUS or SIGSEGV. On freefall, I see: freefall% ./write=20 zsh: segmentation fault (core dumped) ./write > I see some spills from (probably) Go runtime. I've tried further experiments with different hardware and different loading and get different results: Sometimes I get nothing other than a coredump and an other times I get part or all of a runtime spill similar to you. I suspect there may be multiple issues. > I am not sure that this is something which should >be looked at from the kernel side, at least initially. As I wrote in my initial mail, I am not certain whether this is a problem with Go or FreeBSD. And having done some poking at corefiles with gdb (you need gdb7.6 from ports to grok the Go debug information), I have found that all my programs are dying at: mov %gs:0xfffffff8,%ecx but it seems to be timing related as to when the offending instruction is executed. I will do some further investigation into how segment wraparound is handled. > E.g., the 32bit >binaries on amd64 have stack starting near the top of the address space, >i.e. 4G - some amount. Could this be a problem for the Go ? That seems unlikely but I guess it's a possibility. --=20 Peter Jeremy --5mCyUwZo2JvN/JJP Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (FreeBSD) iQJ8BAEBCgBmBQJThmluXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRFRUIyOTg2QzMwNjcxRTc0RTY1QzIyN0Ux NkE1OTdBMEU0QTIwQjM0AAoJEBall6Dkogs06PEP/RfJgCzPesp03/LGb0EFCZzi cvvikhrOlrLr1xMX43zinRsnEvB4jxItLTPzMfLiGLo0nUl1RZPlxG8Ta2UaNu9n QD8Wjcuau1AigtF5W9DaE3oqed98mLSsCCvsuWc2iKx/CWCoHJawgbmEugvaekEZ kniiw2y/2Vxtx2AdkSCozHpqmsVrQr1gvPBSp8H5UN27eFgEY+DSTWRP4bUGDyPc BohvumUdJ+F1naujpSf1WX5T8oLElAiUhUuZNZI2Cy9Y2VJpVpc936ibzAYRd795 i1exWDvrqBlKm2hiif+YR1ECsSYZvD1b4AxZOTn2btEYSxczEjQfvBYS+YETTUQX rQ0iSrdiE7Rsm4lom4+039NDwGwY/L98DClN53ItF6S1jAVQfc4N6hg7AZ8WzSEj Ujv2Gci27x7X2q64RVEOx1P8e9LREKZtTRvGv9hcOWRiyZje3d58k1AE7/MdIyTV rGFjlXJLlWHhvNnemnA6qaNxRgo/VR+zNoYmdhUn0m1aLhdL+DDhkRPwoXIOt3Ym r8XMI3dKPwqJ9HIReJxFVn5b7TvOakOCt559c+CpQlZQ0ZRT1Ztnp01RNiG06wh8 29H2q8i6A0OsDA89qcsi31RJUCpXKPJqClDB3xYYww5DDCu+dG99mjJCay4ixBx1 9iBuGhV33HQmQGsREa9Q =D+nb -----END PGP SIGNATURE----- --5mCyUwZo2JvN/JJP--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140528225542.GA46230>