Print this page
7029 want per-process exploit mitigation features (secflags)
7030 want basic address space layout randomization (aslr)
7031 noexec_user_stack should be a secflag
7032 want a means to forbid mappings around NULL.

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/os/priv.c
          +++ new/usr/src/uts/common/os/priv.c
↓ open down ↓ 81 lines elided ↑ open up ↑
  82   82  void
  83   83  priv_init(void)
  84   84  {
  85   85  #ifdef DEBUG
  86   86          int alloc_test_priv = 1;
  87   87  #else
  88   88          int alloc_test_priv = priv_debug;
  89   89  #endif
  90   90          rw_init(&privinfo_lock, NULL, RW_DRIVER, NULL);
  91   91  
  92      -        PRIV_BASIC_ASSERT(priv_basic);
  93      -        PRIV_UNSAFE_ASSERT(&priv_unsafe);
       92 +        PRIV_BASIC_ADDSET(priv_basic);
       93 +        PRIV_UNSAFE_ADDSET(&priv_unsafe);
  94   94          priv_fillset(&priv_fullset);
  95   95  
  96   96          /*
  97   97           * When booting with priv_debug set or in a DEBUG kernel, then we'll
  98   98           * add an additional basic privilege and we verify that it is always
  99   99           * present in E.
 100  100           */
 101  101          if (alloc_test_priv != 0 &&
 102  102              (priv_basic_test = priv_getbyname("basic_test", PRIV_ALLOC)) >= 0) {
 103  103                  priv_addset(priv_basic, priv_basic_test);
↓ open down ↓ 369 lines elided ↑ open up ↑
 473  473  
 474  474          /* memset? */
 475  475          for (i = 0; i < PRIV_SETSIZE; i++)
 476  476                  set->pbits[i] = ~(priv_chunk_t)0;
 477  477  }
 478  478  
 479  479  void
 480  480  priv_addset(priv_set_t *set, int priv)
 481  481  {
 482  482          ASSERT(priv >= 0 && priv < MAX_PRIVILEGE);
 483      -        __PRIV_ASSERT(set, priv);
      483 +        __PRIV_ADDSET(set, priv);
 484  484  }
 485  485  
 486  486  void
 487  487  priv_delset(priv_set_t *set, int priv)
 488  488  {
 489  489          ASSERT(priv >= 0 && priv < MAX_PRIVILEGE);
 490      -        __PRIV_CLEAR(set, priv);
      490 +        __PRIV_DELSET(set, priv);
 491  491  }
 492  492  
 493  493  boolean_t
 494  494  priv_ismember(const priv_set_t *set, int priv)
 495  495  {
 496  496          ASSERT(priv >= 0 && priv < MAX_PRIVILEGE);
 497      -        return (__PRIV_ISASSERT(set, priv) ? B_TRUE : B_FALSE);
      497 +        return (__PRIV_ISMEMBER(set, priv) ? B_TRUE : B_FALSE);
 498  498  }
 499  499  
 500  500  #define PRIV_TEST_BODY(test) \
 501  501          int i; \
 502  502  \
 503  503          for (i = 0; i < PRIV_SETSIZE; i++) \
 504  504                  if (!(test)) \
 505  505                          return (B_FALSE); \
 506  506  \
 507  507          return (B_TRUE)
↓ open down ↓ 239 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX