From owner-freebsd-current@FreeBSD.ORG Sat Aug 30 18:38:10 2008 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AA7D41065692 for ; Sat, 30 Aug 2008 18:38:10 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id 505CE8FC1D for ; Sat, 30 Aug 2008 18:38:10 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtp (Exim 4.63 (FreeBSD)) (envelope-from ) id 1KZVKq-000D4J-31; Sat, 30 Aug 2008 21:38:08 +0300 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id m7UIc4Hg084115 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 30 Aug 2008 21:38:04 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.2/8.14.2) with ESMTP id m7UIc4eD072161; Sat, 30 Aug 2008 21:38:04 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.2/8.14.2/Submit) id m7UIc4Fj072160; Sat, 30 Aug 2008 21:38:04 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 30 Aug 2008 21:38:04 +0300 From: Kostik Belousov To: Artem Belevich Message-ID: <20080830183804.GG2038@deviant.kiev.zoral.com.ua> References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="oxour8c+zPVguRmP" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.93.3, clamav-milter version 0.93.3 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1KZVKq-000D4J-31 b935a03b8f7575394421f88532b2c3b3 X-Terabit: YES Cc: Bernd Walter , freebsd-current@freebsd.org Subject: Re: __tls_get_addr problem with recent current X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Aug 2008 18:38:10 -0000 --oxour8c+zPVguRmP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Aug 30, 2008 at 09:46:05AM -0700, Artem Belevich wrote: > Hi, >=20 > Did someone figure out what was/is causing this problem? I believe > I've ran into the same issue on a freshly built (Aug 29th) RELENG_7 on > amd64 (Q9450 w/ 8GB RAM). >=20 > What's strange is that in my case the problem pops up when I run > 32-bit binaries from RELENG_6. Otherwise the system is stable. I can > buildworld continuously with -j8 without any problems. However, when I > try to build my code using hacked make from FreeBSD6/i386 things start > falling apart. All of a sudden I get cores from FreeBSD7/amd64 > binaries. All of them, as far as I can tell crash in __tls_get_addr. > So far I've been unable to reproduce the crashes in any other > scenarios, but I'm still trying. >=20 > Interestingly enough, crash always occurs on "mov %fs:0x0,%rdi" instru= ction, > yet the same code in the same binaries works fine when binaries are used > without mixing amd64/i386 binaries. Could that be that amd64 might > somehow inherit invalid registers from i386 binaries? Quite possible, almost sure. Could you, please, check whether the change below would fix it for you ? diff --git a/sys/amd64/amd64/cpu_switch.S b/sys/amd64/amd64/cpu_switch.S index f34b0cc..9e13ef4 100644 --- a/sys/amd64/amd64/cpu_switch.S +++ b/sys/amd64/amd64/cpu_switch.S @@ -265,6 +265,10 @@ load_seg: movl PCB_DS(%r8),%ds movl PCB_ES(%r8),%es movl PCB_FS(%r8),%fs + movl $MSR_FSBASE,%ecx + rdmsr + shlq $32,%rdx + leaq (%rax,%rdx),%r9 jmp done_load_seg /* Restore userland %gs while preserving kernel gsbase */ 2: movq PCB_GS32P(%r8),%rax --oxour8c+zPVguRmP Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAki5k4sACgkQC3+MBN1Mb4hoSgCgupiq1FYy9tJuBus5if45ii6x I88An19RL81V4ATFPwUyDHRqSPv7yKk6 =2b+R -----END PGP SIGNATURE----- --oxour8c+zPVguRmP--