amd64/130355: i386_set_fsbase() doesn't seem to set %fs for 32-bit
process under 7.1/amd64
Gary Byers
gb at clozure.com
Sat Jan 10 16:40:07 PST 2009
>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 at 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:
More information about the freebsd-amd64
mailing list