Print this page
10924 Need mitigation of L1TF (CVE-2018-3646)
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Peter Tribble <peter.tribble@gmail.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/i86pc/sys/machcpuvar.h
          +++ new/usr/src/uts/i86pc/sys/machcpuvar.h
↓ open down ↓ 126 lines elided ↑ open up ↑
 127  127           */
 128  128          greg_t          kf_kernel_cr3;
 129  129          greg_t          kf_user_cr3;
 130  130          greg_t          kf_tr_ret_rsp;
 131  131  
 132  132          uint64_t        kf_unused;              /* For 16-byte align */
 133  133  
 134  134          uint64_t        kf_upper_redzone;
 135  135  };
 136  136  
      137 +typedef struct cpu_ht {
      138 +        lock_t ch_lock;
      139 +        char ch_pad[56];
      140 +        struct cpu *ch_sib;
      141 +        volatile uint64_t ch_intr_depth;
      142 +        volatile uint64_t ch_state;
      143 +        volatile uint64_t ch_sibstate;
      144 +} cpu_ht_t;
      145 +
 137  146  /*
 138  147   * This first value, MACHCPU_SIZE is the size of all the members in the cpu_t
 139  148   * AND struct machcpu, before we get to the mcpu_pad and the kpti area.
 140  149   * The KPTI is used to contain per-CPU data that is visible in both sets of
 141  150   * page-tables, and hence must be page-aligned and page-sized. See
 142  151   * hat_pcp_setup().
 143  152   *
 144      - * There is a CTASSERT in os/intr.c that checks these numbers.
      153 + * There are CTASSERTs in os/intr.c that verify this all works out.
 145  154   */
 146      -#define MACHCPU_SIZE    (572 + 1584)
      155 +#define MACHCPU_SIZE    (1568 + 688)
 147  156  #define MACHCPU_PAD     (MMU_PAGESIZE - MACHCPU_SIZE)
 148  157  #define MACHCPU_PAD2    (MMU_PAGESIZE - 16 - 3 * sizeof (struct kpti_frame))
 149  158  
 150  159  struct  machcpu {
 151  160          /*
 152  161           * x_call fields - used for interprocessor cross calls
 153  162           */
 154  163          struct xc_msg   *xc_msgbox;
 155  164          struct xc_msg   *xc_free;
 156  165          xc_data_t       xc_data;
↓ open down ↓ 55 lines elided ↑ open up ↑
 212  221  
 213  222          /*
 214  223           * A stamp that is unique per processor and changes
 215  224           * whenever an interrupt happens. Userful for detecting
 216  225           * if a section of code gets interrupted.
 217  226           * The high order 16 bits will hold the cpu->cpu_id.
 218  227           * The low order bits will be incremented on every interrupt.
 219  228           */
 220  229          volatile uint32_t       mcpu_istamp;
 221  230  
      231 +        cpu_ht_t                mcpu_ht;
      232 +
 222  233          char                    mcpu_pad[MACHCPU_PAD];
 223  234  
 224  235          /* This is the start of the page */
 225  236          char                    mcpu_pad2[MACHCPU_PAD2];
 226  237          struct kpti_frame       mcpu_kpti;
 227  238          struct kpti_frame       mcpu_kpti_flt;
 228  239          struct kpti_frame       mcpu_kpti_dbg;
 229  240          char                    mcpu_pad3[16];
 230  241  };
 231  242  
↓ open down ↓ 29 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX