Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 May 2014 16:44:57 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Peter Jeremy <peter@rulingia.com>
Cc:        freebsd-amd64@freebsd.org
Subject:   Re: i386 Go programs crash on amd64
Message-ID:  <20140526134457.GR74331@kib.kiev.ua>
In-Reply-To: <20140526113622.GB96083@server.rulingia.com>
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>

next in thread | previous in thread | raw e-mail | index | archive | help

--lMELkkGiwR4F0HOc
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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 some spills from
(probably) Go runtime. I am not sure that this is something which should
be looked at from the kernel side, at least initially. 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 ?

What I see is:

pooma% ./write-go                                   ~/build/bsd/DEV/stuff/t=
ests
runtime: newstack called from g=3D0x382d5500
        m=3D0x382e5800 m->curg=3D0x0 m->g0=3D0x382d55a0 m->gsignal=3D0x382d=
5500
fatal error: runtime: wrong goroutine in newstack

runtime stack:
runtime.throw(0x8096910)
        /usr/local/go/src/pkg/runtime/panic.c:464 +0x5f
runtime.newstack()
        /usr/local/go/src/pkg/runtime/stack.c:212 +0x90
runtime.morestack()
        /usr/local/go/src/pkg/runtime/asm_386.s:246 +0x5e
Hello World

goroutine 1 [panicwait]:
runtime.park(0x0, 0x0, 0x8097b74)
        /usr/local/go/src/pkg/runtime/proc.c:1342 +0x59
runtime.main()
        /usr/local/go/src/pkg/runtime/proc.c:229 +0x125
runtime.goexit()
        /usr/local/go/src/pkg/runtime/proc.c:1394
[1]    1537 segmentation fault (core dumped)  ./write-go

--lMELkkGiwR4F0HOc
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (FreeBSD)

iQIcBAEBAgAGBQJTg0VZAAoJEJDCuSvBvK1BPE8P/1wPkRkMq9GaYx+J2BTVtx95
FS4lbpNvv6yDHyjqhdxmL1YQymrLEfHlG0mnIvxK6CDyYGQt9gd+/yTkqPNSWkN5
AdNAfIgg35/ITChEQmuGBTjZDkLfMrr4vD1NC7CSP87GTCMySntzm5cBTj1NOK9/
tezG8I12JTuVbIYlH4iJ7Fb8FvOJ8fcdVPq/75XhlIKIfGoKNaXcm2jR1QKkTov2
IBuTdvkudcJcrXsQ/V48EjTCrjfhQkh0etJG2ZQj4smMsFFOvGVE209wzETXudRW
LvpctAHiFlLhQJ0QCsKodFMaMU+LRdU7omXGT22ulXCQ5nIdlKbt1lveabP+asH7
L5QJqqr0x4CJ9J6aP5Netg43EMSEiJ1fK1b9VrI/6WsoflZuywiS3B6wQvwJw1zF
beiLo1psjlhGLYvJSY/9b4lU3ghdYMHiviZf0i2Yb505f43CRJgkSv6PZQXIJSrb
TJC6/fa3HjKFnpjVLPdp3Xln1jY1GWhL9MBZTUpodn/F1Jyb6tpov3iNisYOhbXr
GEALqcYP9mNZnl4z59HbQF370yJEddfPvLIMpogqFWK7qDtedPVe39s4Wa2m/OTK
ANZ6ZmYMq4A+5LuMUXiMcvX3FQ4fHxCjHpc4QwNR313NLYI79iVQ3ZLmSjmvLtr4
fzt+H4Q9GDeTP3+mA1B1
=6PlJ
-----END PGP SIGNATURE-----

--lMELkkGiwR4F0HOc--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140526134457.GR74331>