From owner-freebsd-amd64@FreeBSD.ORG Sun Jan 11 00:40:07 2009 Return-Path: Delivered-To: freebsd-amd64@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 89E611065672 for ; Sun, 11 Jan 2009 00:40:07 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 65ED38FC13 for ; Sun, 11 Jan 2009 00:40:07 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n0B0e5qB046292 for ; Sun, 11 Jan 2009 00:40:05 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n0B0e55Q046291; Sun, 11 Jan 2009 00:40:05 GMT (envelope-from gnats) Resent-Date: Sun, 11 Jan 2009 00:40:05 GMT Resent-Message-Id: <200901110040.n0B0e55Q046291@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-amd64@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Gary Byers Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 61C38106566B for ; Sun, 11 Jan 2009 00:35:14 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 4FA6F8FC13 for ; Sun, 11 Jan 2009 00:35:14 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n0B0ZDwq089906 for ; Sun, 11 Jan 2009 00:35:13 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id n0B0ZDX5089905; Sun, 11 Jan 2009 00:35:13 GMT (envelope-from nobody) Message-Id: <200901110035.n0B0ZDX5089905@www.freebsd.org> Date: Sun, 11 Jan 2009 00:35:13 GMT From: Gary Byers To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 X-Mailman-Approved-At: Sun, 11 Jan 2009 00:52:47 +0000 Cc: Subject: amd64/130355: i386_set_fsbase() doesn't seem to set %fs for 32-bit process under 7.1/amd64 X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Jan 2009 00:40:07 -0000 >Number: 130355 >Category: amd64 >Synopsis: i386_set_fsbase() doesn't seem to set %fs for 32-bit process under 7.1/amd64 >Confidential: no >Severity: critical >Priority: high >Responsible: freebsd-amd64 >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Jan 11 00:40:05 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Gary Byers >Release: 7.1-RELEASE/amd64 >Organization: Clozure Associates >Environment: FreeBSD f71.abq.clozure.com 7.1-RELEASE FreeBSD 7.1-RELEASE #0: Thu Jan 1 08:58:24 UTC 2009 root@driscoll.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64 >Description: i386_set_fsbase(void *addr) has the effect of causing memory references relative to %fs to reference the linear address "addr"; part of this effect is achieved by loading a segment descriptor (GSEL(GUFS_SEL, SEL_UPL), which is generally = 0x13) into %fs on return from the sysarch syscall. This works as expected on (at least) i386 versions of 6.4-RELEASE, 7.0-RELEASE, and 7.1-RELEASE and on amd64 versions of 6.4-RELEASE and 7.0-RELEASE, but on 7.1-RELEASE/amd64 the i386_set_fsbase() call returns 0 but %fs is unchanged on return and subsequent attempts to reference memory relative to %fs seem to be equivalent to references relative to address 0. >How-To-Repeat: Compile (in a 32-bit FreeBSD/i386 environment) a small program that uses i386_set_fsbase() and checks to ensure that %fs has changed on successful return from the call to i386_set_fsbase(). Run the program on i386 versions of FreeBSD (6.4, 7.0, 7.1) and on amd64 versions of 6.4 and 7.0 and note that %fs is changed by the syscall. Run the program on 7.1-RELEASE/amd64 and note that it fails. (I'm not really sure if I'm supposed to provide a simple test case on the web form that I'm using to report this; I can easily do so if requested.) >Fix: Unknown. To the extent that I understand the issue, it seems to have to do with code that tries to ensure that the correct value is loaded into %fs on return from the syscall and on subsequent context switches; the code that actually sets the fsbase msr seems to be unchanged between the released versions of 7.0 and 7.1. >Release-Note: >Audit-Trail: >Unformatted: