svn commit: r275934 - stable/9/sys/amd64/amd64

Konstantin Belousov kib at FreeBSD.org
Fri Dec 19 09:42:42 UTC 2014


Author: kib
Date: Fri Dec 19 09:42:40 2014
New Revision: 275934
URL: https://svnweb.freebsd.org/changeset/base/275934

Log:
  MFC r275833:
  The iret instruction may generate #np and #ss fault, besides #gp.
  When returning to usermode, the handler for that exceptions is also
  executed with wrong gs base.  Handle all three possible faults in the
  same way, checking for iret fault, and performing full iret.

Modified:
  stable/9/sys/amd64/amd64/exception.S
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/amd64/amd64/exception.S
==============================================================================
--- stable/9/sys/amd64/amd64/exception.S	Fri Dec 19 09:36:59 2014	(r275933)
+++ stable/9/sys/amd64/amd64/exception.S	Fri Dec 19 09:42:40 2014	(r275934)
@@ -154,9 +154,13 @@ IDTVEC(xmm)
 IDTVEC(tss)
 	TRAP_ERR(T_TSSFLT)
 IDTVEC(missing)
-	TRAP_ERR(T_SEGNPFLT)
+	subq	$TF_ERR,%rsp
+	movl	$T_SEGNPFLT,TF_TRAPNO(%rsp)
+	jmp	prot_addrf
 IDTVEC(stk)
-	TRAP_ERR(T_STKFLT)
+	subq	$TF_ERR,%rsp
+	movl	$T_STKFLT,TF_TRAPNO(%rsp)
+	jmp	prot_addrf
 IDTVEC(align)
 	TRAP_ERR(T_ALIGNFLT)
 
@@ -319,6 +323,7 @@ IDTVEC(page)
 IDTVEC(prot)
 	subq	$TF_ERR,%rsp
 	movl	$T_PROTFLT,TF_TRAPNO(%rsp)
+prot_addrf:
 	movq	$0,TF_ADDR(%rsp)
 	movq	%rdi,TF_RDI(%rsp)	/* free up a GP register */
 	leaq	doreti_iret(%rip),%rdi


More information about the svn-src-stable-9 mailing list