Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Jan 2009 12:07:49 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r187470 - head/sys/amd64/amd64
Message-ID:  <200901201207.n0KC7n57044684@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Tue Jan 20 12:07:49 2009
New Revision: 187470
URL: http://svn.freebsd.org/changeset/base/187470

Log:
  The context switch to the 32bit binary does not properly restore
  the fsbase value. The switch loads the fs segment register, that
  invalidates the value in fsbase msr, thus value in %r9 can not be
  considered the current value for fsbase anymore.
  
  Unconditionally reload fsbase when switching to 32bit binary.
  
  PR:	130526
  MFC after:	3 weeks

Modified:
  head/sys/amd64/amd64/cpu_switch.S

Modified: head/sys/amd64/amd64/cpu_switch.S
==============================================================================
--- head/sys/amd64/amd64/cpu_switch.S	Tue Jan 20 11:34:28 2009	(r187469)
+++ head/sys/amd64/amd64/cpu_switch.S	Tue Jan 20 12:07:49 2009	(r187470)
@@ -199,6 +199,7 @@ done_load_seg:
 	cmpq	PCB_FSBASE(%r8),%r9
 	jz	1f
 	/* Restore userland %fs */
+restore_fsbase:
 	movl	$MSR_FSBASE,%ecx
 	movl	PCB_FSBASE(%r8),%eax
 	movl	PCB_FSBASE+4(%r8),%edx
@@ -281,7 +282,7 @@ load_seg:
 	movl	PCB_DS(%r8),%ds
 	movl	PCB_ES(%r8),%es
 	movl	PCB_FS(%r8),%fs
-	jmp	done_load_seg
+	jmp	restore_fsbase
 	/* Restore userland %gs while preserving kernel gsbase */
 2:	movq	PCPU(GS32P),%rax
 	movq	PCB_GS32SD(%r8),%rcx



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