Author: kib
Date: Thu Sep 28 08:46:15 2017
New Revision: 324079
URL: https://svnweb.freebsd.org/changeset/base/324079

Log:
  Restore a part of r323722.
  
  Do not return from interrupt using the POP_FRAME;iret instruction
  sequence, always jump to doreti.
  
  The user segments selectors saved on the stack might become invalid
  because userspace manipulated LDT in a parallel thread.  trap() is
  aware of such issue, but it is only prepared to handle it at iret and
  segment registers load operations in doreti path.
  
  Also remove POP_FRAME macro because it is no longer used.
  
  Reviewed by:  bde, jhb (as part of r323722)
  Sponsored by: The FreeBSD Foundation
  MFC after:    1 week

Modified:
  head/sys/i386/i386/apic_vector.s
  head/sys/i386/include/asmacros.h

Modified: head/sys/i386/i386/apic_vector.s
==============================================================================
--- head/sys/i386/i386/apic_vector.s    Thu Sep 28 08:38:24 2017        
(r324078)
+++ head/sys/i386/i386/apic_vector.s    Thu Sep 28 08:46:15 2017        
(r324079)
@@ -189,8 +189,7 @@ IDTVEC(xen_intr_upcall)
        SUPERALIGN_TEXT
 invltlb_ret:
        call    as_lapic_eoi
-       POP_FRAME
-       iret
+       jmp     doreti
 
        SUPERALIGN_TEXT
 IDTVEC(invltlb)
@@ -274,10 +273,8 @@ IDTVEC(cpustop)
 
        call    as_lapic_eoi
        call    cpustop_handler
+       jmp     doreti
 
-       POP_FRAME
-       iret
-
 /*
  * Executed by a CPU when it receives an IPI_SUSPEND from another CPU.
  */
@@ -290,10 +287,8 @@ IDTVEC(cpususpend)
 
        call    as_lapic_eoi
        call    cpususpend_handler
+       jmp     doreti
 
-       POP_FRAME
-       jmp     doreti_iret
-
 /*
  * Executed by a CPU when it receives a RENDEZVOUS IPI from another CPU.
  *
@@ -314,7 +309,6 @@ IDTVEC(rendezvous)
        call    smp_rendezvous_action
 
        call    as_lapic_eoi
-       POP_FRAME
-       iret
+       jmp     doreti
        
 #endif /* SMP */

Modified: head/sys/i386/include/asmacros.h
==============================================================================
--- head/sys/i386/include/asmacros.h    Thu Sep 28 08:38:24 2017        
(r324078)
+++ head/sys/i386/include/asmacros.h    Thu Sep 28 08:46:15 2017        
(r324079)
@@ -153,13 +153,6 @@
        pushl   $0 ;                                                    \
        movw    %fs,(%esp)
        
-#define        POP_FRAME                                                       
\
-       popl    %fs ;                                                   \
-       popl    %es ;                                                   \
-       popl    %ds ;                                                   \
-       popal ;                                                         \
-       addl    $4+4,%esp
-
 /*
  * Access per-CPU data.
  */
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to