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/brand/common/brand_solaris.s
          +++ new/usr/src/uts/intel/brand/common/brand_solaris.s
↓ open down ↓ 22 lines elided ↑ open up ↑
  23   23   * Copyright 2019 Joyent, Inc.
  24   24   */
  25   25  
  26   26  /*
  27   27   * This is an assembly file that gets #include-ed into the brand-specific
  28   28   * assembly files (e.g. sn1_brand_asm.s) for Solaris-derived brands.
  29   29   * We can't make these into functions since in the trap context there's
  30   30   * no easy place to save the extra parameters that would be required, so
  31   31   * each brand module needs its own copy of this code.  We #include this and
  32   32   * use brand-specific #defines to replace the XXX_brand_... definitions.
  33      - */ 
       33 + */
  34   34  
  35   35  #ifdef lint
  36   36  
  37   37  #include <sys/systm.h>
  38   38  
  39   39  #else /* !lint */
  40   40  
  41   41  #include <sys/asm_linkage.h>
  42   42  #include <sys/privregs.h>
  43   43  #include <sys/segments.h>
↓ open down ↓ 38 lines elided ↑ open up ↑
  82   82   * To 'return' to our user-space handler, we just need to place its address
  83   83   * into %rcx.  The original return address is passed back in SYSCALL_REG.
  84   84   */
  85   85  ENTRY(XXX_brand_syscall32_callback)
  86   86          CALLBACK_PROLOGUE(XXX_emulation_table, SPD_HANDLER, SYSCALL_REG,
  87   87              SCR_REG, SCR_REGB);
  88   88          CALC_TABLE_ADDR(SCR_REG, SPD_HANDLER);
  89   89          mov     %rcx, SYSCALL_REG; /* save orig return addr in syscall_reg */
  90   90          mov     SCR_REG, %rcx;  /* place new return addr in %rcx */
  91   91          mov     %gs:CPU_RTMP_R15, SCR_REG; /* restore scratch register */
  92      -        call    *x86_md_clear           /* Flush micro-arch state */
       92 +        call    x86_md_clear            /* Flush micro-arch state */
  93   93          mov     V_SSP(SP_REG), SP_REG   /* restore user stack pointer */
  94   94          jmp     nopop_sys_syscall32_swapgs_sysretl
  95   95  9:
  96   96          retq
  97   97  SET_SIZE(XXX_brand_syscall32_callback)
  98   98  
  99   99  /*
 100  100   * syscall handler for 64-bit user processes:
 101  101   * See "64-BIT INTERPOSITION STACK" in brand_asm.h.
 102  102   * To 'return' to our user-space handler, we just need to place its address
 103  103   * into %rcx.  The original return address is passed back in SYSCALL_REG.
 104  104   */
 105  105  ENTRY(XXX_brand_syscall_callback)
 106  106          CALLBACK_PROLOGUE(XXX_emulation_table, SPD_HANDLER, SYSCALL_REG,
 107  107              SCR_REG, SCR_REGB);
 108  108          CALC_TABLE_ADDR(SCR_REG, SPD_HANDLER);
 109  109          mov     %rcx, SYSCALL_REG; /* save orig return addr in syscall_reg */
 110  110          mov     SCR_REG, %rcx;  /* place new return addr in %rcx */
 111  111          mov     %gs:CPU_RTMP_R15, SCR_REG; /* restore scratch register */
 112      -        call    *x86_md_clear           /* Flush micro-arch state */
      112 +        call    x86_md_clear            /* Flush micro-arch state */
 113  113          mov     V_SSP(SP_REG), SP_REG   /* restore user stack pointer */
 114  114          jmp     nopop_sys_syscall_swapgs_sysretq
 115  115  9:
 116  116          retq
 117  117  SET_SIZE(XXX_brand_syscall_callback)
 118  118  
 119  119  /*
 120  120   * See "64-BIT INTERPOSITION STACK" in brand_asm.h.
 121  121   * To 'return' to our user-space handler, we just need to place its address
 122  122   * into %rdx.  The original return address is passed back in SYSCALL_REG.
↓ open down ↓ 76 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX