From owner-freebsd-amd64@FreeBSD.ORG Fri May 23 23:34:50 2014 Return-Path: Delivered-To: freebsd-amd64@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7F68ED64 for ; Fri, 23 May 2014 23:34:50 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 07A2421A1 for ; Fri, 23 May 2014 23:34:49 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.8/8.14.8) with ESMTP id s4NNYicm054590; Sat, 24 May 2014 02:34:44 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.3 kib.kiev.ua s4NNYicm054590 Received: (from kostik@localhost) by tom.home (8.14.8/8.14.8/Submit) id s4NNYiff054589; Sat, 24 May 2014 02:34:44 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 24 May 2014 02:34:44 +0300 From: Konstantin Belousov To: Peter Wemm Subject: Re: i386 Go programs crash on amd64 Message-ID: <20140523233444.GH74331@kib.kiev.ua> References: <20140523225300.GA14433@server.rulingia.com> <537FD853.3000505@wemm.org> <537FD9A2.2010607@wemm.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="kIMHD3Fq2o6qJDUb" Content-Disposition: inline In-Reply-To: <537FD9A2.2010607@wemm.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home Cc: freebsd-amd64@freebsd.org X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 May 2014 23:34:50 -0000 --kIMHD3Fq2o6qJDUb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, May 23, 2014 at 04:28:34PM -0700, Peter Wemm wrote: > On 5/23/14, 4:22 PM, Peter Wemm wrote: > > On 5/23/14, 3:53 PM, Peter Jeremy wrote: > >> I've been playing with Go (lang/go) and found that i386 Go binaries > >> segfault when run on amd64 (9.x, 10.x or HEAD). I've narrowed it down > >> to the LDT handling but am not sure whether it's on the FreeBSD or Go > >> side. > >> > >> As far as I can see, the i386 binary is correctly calling i386_set_ldt= () > >> and the i386_set_ldt() emulation in the amd64 kernel matches the i386 > >> kernel - but the net result doesn't work. > >> > >> Can anyone offer any suggestions as to how to resolve this? Provide the minimal test case. > >> > > We don't emulate i386_set_ldt(). > > > > The 32 bit version of libc on amd64 has a different implementation=20 > > that calls sysarch(I386_SET_FSBASE, ..) and friends. Normally this is= =20 > > handled transparently by static linking, but obviously that's an issue= =20 > > for Go. >=20 > Actually, that's an even more interesting question. WHY are they using=20 > i386_set_ldt()? Where is it coming from? As near as I can tell, libc,=20 > libthr etc call I386_SET_GSBASE for tls. We do support ldt for 32bit binaries on amd64. --kIMHD3Fq2o6qJDUb Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (FreeBSD) iQIcBAEBAgAGBQJTf9sTAAoJEJDCuSvBvK1BNIcQAJJsgBhDGijLSmX7bcBSs51d xG7xOUGIDwT4dnzzJODV/FIpy/TrSL3J430hZugIqcU/ebby+fJJG9fwEhz8np3V sM6WK5gqeQtHpiZ2SbJLXbiKA6Hj5wXgTOqLpLnqz8C3ym5JTqole4NyRa8y/7iS Qjy1jZgEOS5UIJN1JKtjKiFpeqrU7ZqfQmG667yOKE0WxedfMPETGbLToUGTz6B2 7tI56uG1hakvbU1PChWFz1Y6DBv5/5Zb472p47jtr/7wG9n/A9Wj1UWMfPeH2K5G GYbXwvqLcsX466XEsFYl7NvujfxK5gz48C3iAmnMYK9q9/fIvuZMqvcHIbX/Qsm0 IGKLLUYlcTSjqgR7TYgqA2iSObKsKfSaBDGRPywl71qcCjxn87KwvaTxqg6nZUl5 THrsA0rAQ9VzifZAI8TrsSINZQteLyVKNcTilB5RhoVGezsIwll1YWMh/5CI1D8p YI7p1VrFee3DU+Xgd2xtWPY2EwYKaFKmjQfRCa6Rlv80cVJSROW55YTlOXfAskBQ i92PS20Fn5Rp5+4IjnCod7vilPX6BBuMZfaFd3BUvRy6hkT6l204AA5tGFdKMbQf 8QKvVTxK0h0cExYNviCqFbBvnoqrIKX+Y8ThtCSHfu0nBBjfGBfbOY4L7HUTB6gg Yhg0AMxsOzZdDAaDHQuZ =U0QP -----END PGP SIGNATURE----- --kIMHD3Fq2o6qJDUb--