Print this page
OS-7125 Need mitigation of L1TF (CVE-2018-3646)
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/disp/thread.c
          +++ new/usr/src/uts/common/disp/thread.c
↓ open down ↓ 67 lines elided ↑ open up ↑
  68   68  #include <sys/tsol/tndb.h>
  69   69  #include <sys/cpc_impl.h>
  70   70  #include <sys/sdt.h>
  71   71  #include <sys/reboot.h>
  72   72  #include <sys/kdi.h>
  73   73  #include <sys/schedctl.h>
  74   74  #include <sys/waitq.h>
  75   75  #include <sys/cpucaps.h>
  76   76  #include <sys/kiconv.h>
  77   77  #include <sys/ctype.h>
       78 +#include <sys/ht.h>
  78   79  
       80 +#ifndef STACK_GROWTH_DOWN
       81 +#error Stacks do not grow downward; 3b2 zombie attack detected!
       82 +#endif
       83 +
  79   84  struct kmem_cache *thread_cache;        /* cache of free threads */
  80   85  struct kmem_cache *lwp_cache;           /* cache of free lwps */
  81   86  struct kmem_cache *turnstile_cache;     /* cache of free turnstiles */
  82   87  
  83   88  /*
  84   89   * allthreads is only for use by kmem_readers.  All kernel loops can use
  85   90   * the current thread as a start/end point.
  86   91   */
  87   92  kthread_t *allthreads = &t0;    /* circular list of all threads */
  88   93  
↓ open down ↓ 420 lines elided ↑ open up ↑
 509  514          lgrp_move_thread(t, &cp_default.cp_lgrploads[LGRP_ROOTID], 1);
 510  515  
 511  516          /*
 512  517           * Inherit the current cpu.  If this cpu isn't part of the chosen
 513  518           * lgroup, a new cpu will be chosen by cpu_choose when the thread
 514  519           * is ready to run.
 515  520           */
 516  521          if (CPU->cpu_part == &cp_default)
 517  522                  t->t_cpu = CPU;
 518  523          else
 519      -                t->t_cpu = disp_lowpri_cpu(cp_default.cp_cpulist, t->t_lpl,
 520      -                    t->t_pri, NULL);
      524 +                t->t_cpu = disp_lowpri_cpu(cp_default.cp_cpulist, t,
      525 +                    t->t_pri);
 521  526  
 522  527          t->t_disp_queue = t->t_cpu->cpu_disp;
 523  528          kpreempt_enable();
 524  529  
 525  530          /*
 526  531           * Initialize thread state and the dispatcher lock pointer.
 527  532           * Need to hold onto pidlock to block allthreads walkers until
 528  533           * the state is set.
 529  534           */
 530  535          switch (state) {
↓ open down ↓ 788 lines elided ↑ open up ↑
1319 1324          kthread_t       *t = curthread; /* current thread */
1320 1325          kthread_t       *itp;           /* interrupted thread */
1321 1326          int             i;              /* interrupt level */
1322 1327          extern int      intr_passivate();
1323 1328  
1324 1329          ASSERT(t->t_intr != NULL);
1325 1330  
1326 1331          itp = t->t_intr;                /* interrupted thread */
1327 1332          t->t_intr = NULL;               /* clear interrupt ptr */
1328 1333  
     1334 +        ht_end_intr();
     1335 +
1329 1336          /*
1330 1337           * Get state from interrupt thread for the one
1331 1338           * it interrupted.
1332 1339           */
1333 1340  
1334 1341          i = intr_passivate(t, itp);
1335 1342  
1336 1343          TRACE_5(TR_FAC_INTR, TR_INTR_PASSIVATE,
1337 1344              "intr_passivate:level %d curthread %p (%T) ithread %p (%T)",
1338 1345              i, t, t, itp, itp);
↓ open down ↓ 869 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX