Print this page
11787 Kernel needs to be built with retpolines
11788 Kernel needs to generally use RSB stuffing
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: John Levon <john.levon@joyent.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/intel/ia32/ml/exception.s
          +++ new/usr/src/uts/intel/ia32/ml/exception.s
↓ open down ↓ 145 lines elided ↑ open up ↑
 146  146           *
 147  147           * Nobody said that the design of sysenter was particularly
 148  148           * elegant, did they?
 149  149           */
 150  150  
 151  151          pushq   %r11
 152  152  
 153  153          /*
 154  154           * At this point the stack looks like this:
 155  155           *
 156      -         * (high address)       r_ss
      156 +         * (high address)       r_ss
 157  157           *                      r_rsp
 158  158           *                      r_rfl
 159  159           *                      r_cs
 160  160           *                      r_rip           <-- %rsp + 24
 161  161           *                      r_err           <-- %rsp + 16
 162  162           *                      r_trapno        <-- %rsp + 8
 163  163           * (low address)        %r11            <-- %rsp
 164  164           */
 165  165          leaq    sys_sysenter(%rip), %r11
 166  166          cmpq    %r11, 24(%rsp)  /* Compare to saved r_rip on the stack */
↓ open down ↓ 134 lines elided ↑ open up ↑
 301  301          TRACE_PTR(%r12, %rax, %eax, %rdx, $TT_TRAP)
 302  302          TRACE_REGS(%r12, %rsp, %rax, %rbx)
 303  303          TRACE_STAMP(%r12)
 304  304  
 305  305          movq    %rsp, %rbp
 306  306  
 307  307          movq    %rbp, %rdi
 308  308          call    av_dispatch_nmivect
 309  309  
 310  310          INTR_POP
 311      -        call    *x86_md_clear
      311 +        call    x86_md_clear
 312  312          jmp     tr_iret_auto
 313  313          /*NOTREACHED*/
 314  314          SET_SIZE(nmiint)
 315  315  
 316  316  #elif defined(__i386)
 317  317  
 318  318          /*
 319  319           * #NMI
 320  320           */
 321  321          ENTRY_NP(nmiint)
↓ open down ↓ 697 lines elided ↑ open up ↑
1019 1019          .globl  fasttable
1020 1020  
1021 1021  #if defined(__amd64)
1022 1022  
1023 1023          ENTRY_NP(fasttrap)
1024 1024          cmpl    $T_LASTFAST, %eax
1025 1025          ja      1f
1026 1026          orl     %eax, %eax      /* (zero extend top 32-bits) */
1027 1027          leaq    fasttable(%rip), %r11
1028 1028          leaq    (%r11, %rax, CLONGSIZE), %r11
1029      -        jmp     *(%r11)
     1029 +        movq    (%r11), %r11
     1030 +        INDIRECT_JMP_REG(r11)
1030 1031  1:
1031 1032          /*
1032 1033           * Fast syscall number was illegal.  Make it look
1033 1034           * as if the INT failed.  Modify %rip to point before the
1034 1035           * INT, push the expected error code and fake a GP fault.
1035 1036           *
1036 1037           * XXX Why make the error code be offset into idt + 1?
1037 1038           * Instead we should push a real (soft?) error code
1038 1039           * on the stack and #gp handler could know about fasttraps?
1039 1040           */
↓ open down ↓ 39 lines elided ↑ open up ↑
1079 1080  
1080 1081  #if defined(__amd64)
1081 1082  
1082 1083          /*
1083 1084           * RFLAGS 24 bytes up the stack from %rsp.
1084 1085           * XXX a constant would be nicer.
1085 1086           */
1086 1087          ENTRY_NP(fast_null)
1087 1088          XPV_TRAP_POP
1088 1089          orq     $PS_C, 24(%rsp) /* set carry bit in user flags */
1089      -        call    *x86_md_clear
     1090 +        call    x86_md_clear
1090 1091          jmp     tr_iret_auto
1091 1092          /*NOTREACHED*/
1092 1093          SET_SIZE(fast_null)
1093 1094  
1094 1095  #elif defined(__i386)
1095 1096  
1096 1097          ENTRY_NP(fast_null)
1097 1098          orw     $PS_C, 8(%esp)  /* set carry bit in user flags */
1098 1099          IRET
1099 1100          SET_SIZE(fast_null)
↓ open down ↓ 239 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX