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.


  47 #endif
  48 
  49 #if !defined(_KERNEL) && _STRUCTURED_PROC == 0
  50 
  51 #include <sys/old_procfs.h>
  52 
  53 #else   /* !defined(_KERNEL) && _STRUCTURED_PROC == 0 */
  54 
  55 #include <sys/feature_tests.h>
  56 #include <sys/types.h>
  57 #include <sys/time_impl.h>
  58 #include <sys/signal.h>
  59 #include <sys/siginfo.h>
  60 #include <sys/fault.h>
  61 #include <sys/syscall.h>
  62 #include <sys/pset.h>
  63 #include <sys/procfs_isa.h>
  64 #include <sys/priv.h>
  65 #include <sys/stat.h>
  66 #include <sys/param.h>

  67 
  68 /*
  69  * System call interfaces for /proc.
  70  */
  71 
  72 /*
  73  * Control codes (long values) for messages written to ctl and lwpctl files.
  74  */
  75 #define PCNULL   0L     /* null request, advance to next message */
  76 #define PCSTOP   1L     /* direct process or lwp to stop and wait for stop */
  77 #define PCDSTOP  2L     /* direct process or lwp to stop */
  78 #define PCWSTOP  3L     /* wait for process or lwp to stop, no timeout */
  79 #define PCTWSTOP 4L     /* wait for stop, with long millisecond timeout arg */
  80 #define PCRUN    5L     /* make process/lwp runnable, w/ long flags argument */
  81 #define PCCSIG   6L     /* clear current signal from lwp */
  82 #define PCCFAULT 7L     /* clear current fault from lwp */
  83 #define PCSSIG   8L     /* set current signal from siginfo_t argument */
  84 #define PCKILL   9L     /* post a signal to process/lwp, long argument */
  85 #define PCUNKILL 10L    /* delete a pending signal from process/lwp, long arg */
  86 #define PCSHOLD  11L    /* set lwp signal mask from sigset_t argument */


 381         uid_t   pr_euid;        /* effective user id */
 382         uid_t   pr_ruid;        /* real user id */
 383         uid_t   pr_suid;        /* saved user id (from exec) */
 384         gid_t   pr_egid;        /* effective group id */
 385         gid_t   pr_rgid;        /* real group id */
 386         gid_t   pr_sgid;        /* saved group id (from exec) */
 387         int     pr_ngroups;     /* number of supplementary groups */
 388         gid_t   pr_groups[1];   /* array of supplementary groups */
 389 } prcred_t;
 390 
 391 /*
 392  * Process privileges.  PCSPRIV and /proc/<pid>/priv
 393  */
 394 typedef struct prpriv {
 395         uint32_t        pr_nsets;               /* number of privilege set */
 396         uint32_t        pr_setsize;             /* size of privilege set */
 397         uint32_t        pr_infosize;            /* size of supplementary data */
 398         priv_chunk_t    pr_sets[1];             /* array of sets */
 399 } prpriv_t;
 400 










 401 /*
 402  * Watchpoint interface.  PCWATCH and /proc/<pid>/watch
 403  */
 404 typedef struct prwatch {
 405         uintptr_t pr_vaddr;     /* virtual address of watched area */
 406         size_t  pr_size;        /* size of watched area in bytes */
 407         int     pr_wflags;      /* watch type flags */
 408         int     pr_pad;
 409 } prwatch_t;
 410 
 411 /* pr_wflags */
 412 #define WA_READ         0x04    /* trap on read access */
 413 #define WA_WRITE        0x02    /* trap on write access */
 414 #define WA_EXEC         0x01    /* trap on execute access */
 415 #define WA_TRAPAFTER    0x08    /* trap after instruction completes */
 416 
 417 /*
 418  * PCREAD/PCWRITE I/O interface.
 419  */
 420 typedef struct priovec {




  47 #endif
  48 
  49 #if !defined(_KERNEL) && _STRUCTURED_PROC == 0
  50 
  51 #include <sys/old_procfs.h>
  52 
  53 #else   /* !defined(_KERNEL) && _STRUCTURED_PROC == 0 */
  54 
  55 #include <sys/feature_tests.h>
  56 #include <sys/types.h>
  57 #include <sys/time_impl.h>
  58 #include <sys/signal.h>
  59 #include <sys/siginfo.h>
  60 #include <sys/fault.h>
  61 #include <sys/syscall.h>
  62 #include <sys/pset.h>
  63 #include <sys/procfs_isa.h>
  64 #include <sys/priv.h>
  65 #include <sys/stat.h>
  66 #include <sys/param.h>
  67 #include <sys/secflags.h>
  68 
  69 /*
  70  * System call interfaces for /proc.
  71  */
  72 
  73 /*
  74  * Control codes (long values) for messages written to ctl and lwpctl files.
  75  */
  76 #define PCNULL   0L     /* null request, advance to next message */
  77 #define PCSTOP   1L     /* direct process or lwp to stop and wait for stop */
  78 #define PCDSTOP  2L     /* direct process or lwp to stop */
  79 #define PCWSTOP  3L     /* wait for process or lwp to stop, no timeout */
  80 #define PCTWSTOP 4L     /* wait for stop, with long millisecond timeout arg */
  81 #define PCRUN    5L     /* make process/lwp runnable, w/ long flags argument */
  82 #define PCCSIG   6L     /* clear current signal from lwp */
  83 #define PCCFAULT 7L     /* clear current fault from lwp */
  84 #define PCSSIG   8L     /* set current signal from siginfo_t argument */
  85 #define PCKILL   9L     /* post a signal to process/lwp, long argument */
  86 #define PCUNKILL 10L    /* delete a pending signal from process/lwp, long arg */
  87 #define PCSHOLD  11L    /* set lwp signal mask from sigset_t argument */


 382         uid_t   pr_euid;        /* effective user id */
 383         uid_t   pr_ruid;        /* real user id */
 384         uid_t   pr_suid;        /* saved user id (from exec) */
 385         gid_t   pr_egid;        /* effective group id */
 386         gid_t   pr_rgid;        /* real group id */
 387         gid_t   pr_sgid;        /* saved group id (from exec) */
 388         int     pr_ngroups;     /* number of supplementary groups */
 389         gid_t   pr_groups[1];   /* array of supplementary groups */
 390 } prcred_t;
 391 
 392 /*
 393  * Process privileges.  PCSPRIV and /proc/<pid>/priv
 394  */
 395 typedef struct prpriv {
 396         uint32_t        pr_nsets;               /* number of privilege set */
 397         uint32_t        pr_setsize;             /* size of privilege set */
 398         uint32_t        pr_infosize;            /* size of supplementary data */
 399         priv_chunk_t    pr_sets[1];             /* array of sets */
 400 } prpriv_t;
 401 
 402 #define PRSECFLAGS_VERSION_1            1
 403 #define PRSECFLAGS_VERSION_CURRENT      PRSECFLAGS_VERSION_1
 404 typedef struct prsecflags {
 405         uint32_t pr_version;
 406         secflagset_t pr_effective;
 407         secflagset_t pr_inherit;
 408         secflagset_t pr_lower;
 409         secflagset_t pr_upper;
 410 } prsecflags_t;
 411 
 412 /*
 413  * Watchpoint interface.  PCWATCH and /proc/<pid>/watch
 414  */
 415 typedef struct prwatch {
 416         uintptr_t pr_vaddr;     /* virtual address of watched area */
 417         size_t  pr_size;        /* size of watched area in bytes */
 418         int     pr_wflags;      /* watch type flags */
 419         int     pr_pad;
 420 } prwatch_t;
 421 
 422 /* pr_wflags */
 423 #define WA_READ         0x04    /* trap on read access */
 424 #define WA_WRITE        0x02    /* trap on write access */
 425 #define WA_EXEC         0x01    /* trap on execute access */
 426 #define WA_TRAPAFTER    0x08    /* trap after instruction completes */
 427 
 428 /*
 429  * PCREAD/PCWRITE I/O interface.
 430  */
 431 typedef struct priovec {