Print this page
uts: Allow for address space randomisation.
Randomise the base addresses of shared objects, non-fixed mappings, the
stack and the heap.  Introduce a service, svc:/system/process-security,
and a tool psecflags(1) to control and observe it

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/sys/proc.h
          +++ new/usr/src/uts/common/sys/proc.h
↓ open down ↓ 39 lines elided ↑ open up ↑
  40   40  #include <sys/segments.h>
  41   41  #endif
  42   42  #include <sys/utrap.h>
  43   43  #include <sys/model.h>
  44   44  #include <sys/refstr.h>
  45   45  #include <sys/avl.h>
  46   46  #include <sys/rctl.h>
  47   47  #include <sys/list.h>
  48   48  #include <sys/avl.h>
  49   49  #include <sys/door_impl.h>
       50 +#include <sys/secflags.h>
  50   51  
  51   52  #ifdef  __cplusplus
  52   53  extern "C" {
  53   54  #endif
  54   55  
  55   56  /*
  56   57   * Profile arguments.
  57   58   */
  58   59  struct prof {
  59   60          void            *pr_base;       /* buffer base */
↓ open down ↓ 280 lines elided ↑ open up ↑
 340  341          void            *p_dtrace_helpers; /* DTrace helpers, if any */
 341  342          struct pool     *p_pool;        /* pointer to containing pool */
 342  343          kcondvar_t      p_poolcv;       /* synchronization with pools */
 343  344          uint_t          p_poolcnt;      /* # threads inside pool barrier */
 344  345          uint_t          p_poolflag;     /* pool-related flags (see below) */
 345  346          uintptr_t       p_portcnt;      /* event ports counter */
 346  347          struct zone     *p_zone;        /* zone in which process lives */
 347  348          struct vnode    *p_execdir;     /* directory that p_exec came from */
 348  349          struct brand    *p_brand;       /* process's brand  */
 349  350          void            *p_brand_data;  /* per-process brand state */
      351 +        psecflags_t     p_secflags;     /* per-process security flags */
 350  352  
 351  353          /* additional lock to protect p_sessp (but not its contents) */
 352  354          kmutex_t p_splock;
 353  355          rctl_qty_t      p_locked_mem;   /* locked memory charged to proc */
 354  356                                          /* protected by p_lock */
 355  357          rctl_qty_t      p_crypto_mem;   /* /dev/crypto memory charged to proc */
 356  358                                          /* protected by p_lock */
 357  359          clock_t p_ttime;                /* buffered task time */
 358  360  
 359  361          /*
↓ open down ↓ 417 lines elided ↑ open up ↑
 777  779  #if defined(__sparcv9)
 778  780  extern  void    lwp_mmodel_newlwp(void);
 779  781  extern  void    lwp_mmodel_shared_as(caddr_t, size_t);
 780  782  #define LWP_MMODEL_NEWLWP()             lwp_mmodel_newlwp()
 781  783  #define LWP_MMODEL_SHARED_AS(addr, sz)  lwp_mmodel_shared_as((addr), (sz))
 782  784  #else
 783  785  #define LWP_MMODEL_NEWLWP()
 784  786  #define LWP_MMODEL_SHARED_AS(addr, sz)
 785  787  #endif
 786  788  
      789 +/* Security flag manipulation */
      790 +extern boolean_t secflag_enabled(proc_t *, uint_t);
      791 +extern void secflag_set(proc_t *, uint_t);
      792 +extern void secflag_enable(proc_t *, uint_t);
      793 +extern void secflag_disable(proc_t *, uint_t);
      794 +extern void secflag_promote(proc_t *);
      795 +
 787  796  /*
 788  797   * Signal queue function prototypes. Must be here due to header ordering
 789  798   * dependencies.
 790  799   */
 791  800  extern void sigqfree(proc_t *);
 792  801  extern void siginfofree(sigqueue_t *);
 793  802  extern void sigdeq(proc_t *, kthread_t *, int, sigqueue_t **);
 794  803  extern void sigdelq(proc_t *, kthread_t *, int);
 795  804  extern void sigaddq(proc_t *, kthread_t *, k_siginfo_t *, int);
 796  805  extern void sigaddqa(proc_t *, kthread_t *, sigqueue_t *);
↓ open down ↓ 24 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX