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


 191         sl_field_t              pr_aslwpid;
 192         sl_field_t              pr_agentid;
 193         sl_field_t              pr_sigpend;
 194         sl_field_t              pr_brkbase;
 195         sl_field_t              pr_brksize;
 196         sl_field_t              pr_stkbase;
 197         sl_field_t              pr_stksize;
 198         sl_field_t              pr_utime;
 199         sl_field_t              pr_stime;
 200         sl_field_t              pr_cutime;
 201         sl_field_t              pr_cstime;
 202         sl_field_t              pr_sigtrace;
 203         sl_field_t              pr_flttrace;
 204         sl_field_t              pr_sysentry;
 205         sl_field_t              pr_sysexit;
 206         sl_field_t              pr_dmodel;
 207         sl_field_t              pr_taskid;
 208         sl_field_t              pr_projid;
 209         sl_field_t              pr_nzomb;
 210         sl_field_t              pr_zoneid;

 211         sl_field_t              pr_lwp;
 212 } sl_pstatus_layout_t;
 213 
 214 /*
 215  * Layout description of prstatus_t, from <sys/old_procfs.h>.
 216  */
 217 typedef struct {
 218         sl_field_t              sizeof_struct;
 219         sl_field_t              pr_flags;
 220         sl_field_t              pr_why;
 221         sl_field_t              pr_what;
 222         sl_field_t              pr_info;
 223         sl_field_t              pr_cursig;
 224         sl_field_t              pr_nlwp;
 225         sl_field_t              pr_sigpend;
 226         sl_field_t              pr_sighold;
 227         sl_field_t              pr_altstack;
 228         sl_field_t              pr_action;
 229         sl_field_t              pr_pid;
 230         sl_field_t              pr_ppid;


 509  * Layout description of prdinfo_t, from <sys/procfs.h>.
 510  */
 511 typedef struct {
 512         sl_field_t              sizeof_struct;
 513         sl_field_t              pr_fd;
 514         sl_field_t              pr_mode;
 515         sl_field_t              pr_uid;
 516         sl_field_t              pr_gid;
 517         sl_field_t              pr_major;
 518         sl_field_t              pr_minor;
 519         sl_field_t              pr_rmajor;
 520         sl_field_t              pr_rminor;
 521         sl_field_t              pr_ino;
 522         sl_field_t              pr_offset;
 523         sl_field_t              pr_size;
 524         sl_field_t              pr_fileflags;
 525         sl_field_t              pr_fdflags;
 526         sl_field_t              pr_path;
 527 } sl_prfdinfo_layout_t;
 528 






 529 /*
 530  * This type collects all of the layout definitions for
 531  * a given architecture.
 532  */
 533 typedef struct {
 534         const sl_auxv_layout_t          *auxv;          /* auxv_t */
 535         const sl_fltset_layout_t        *fltset;        /* fltset_t */
 536         const sl_lwpsinfo_layout_t      *lwpsinfo;      /* lwpsinfo_t */
 537         const sl_lwpstatus_layout_t     *lwpstatus;     /* lwpstatus_t */
 538         const sl_prcred_layout_t        *prcred;        /* prcred_t */
 539         const sl_priv_impl_info_layout_t *priv_impl_info; /* priv_impl_info_t */
 540         const sl_prpriv_layout_t        *prpriv;        /* prpriv_t */
 541         const sl_psinfo_layout_t        *psinfo;        /* psinfo_t */
 542         const sl_pstatus_layout_t       *pstatus;       /* pstatus_t */
 543         const sl_prgregset_layout_t     *prgregset;     /* prgregset_t */
 544         const sl_prpsinfo_layout_t      *prpsinfo;      /* prpsinfo_t */
 545         const sl_prstatus_layout_t      *prstatus;      /* prstatus_t */
 546         const sl_sigaction_layout_t     *sigaction;     /* struct sigaction */
 547         const sl_siginfo_layout_t       *siginfo;       /* siginfo_t */
 548         const sl_sigset_layout_t        *sigset;        /* sigset_t */
 549         const sl_stack_layout_t         *stack;         /* stack_t */
 550         const sl_sysset_layout_t        *sysset;        /* sysset_t */
 551         const sl_timestruc_layout_t     *timestruc;     /* timestruc_t */
 552         const sl_utsname_layout_t       *utsname;       /* struct utsname */
 553         const sl_prfdinfo_layout_t      *prfdinfo;      /* prdinfo_t */

 554 } sl_arch_layout_t;
 555 
 556 
 557 
 558 extern  void            sl_extract_num_field(const char *data, int do_swap,
 559                             const sl_field_t *fdesc, sl_data_t *field_data);
 560 extern  Word            sl_extract_as_word(const char *data, int do_swap,
 561                             const sl_field_t *fdesc);
 562 extern  Lword           sl_extract_as_lword(const char *data, int do_swap,
 563                             const sl_field_t *fdesc);
 564 extern  Sword           sl_extract_as_sword(const char *data, int do_swap,
 565                             const sl_field_t *fdesc);
 566 extern  const char      *sl_fmt_num(const char *data, int do_swap,
 567                             const sl_field_t *fdesc, sl_fmt_num_t fmt_type,
 568                             sl_fmtbuf_t buf);
 569 
 570 
 571 extern  const sl_arch_layout_t  *sl_mach(Half);
 572 extern  const sl_arch_layout_t  *struct_layout_i386(void);
 573 extern  const sl_arch_layout_t  *struct_layout_amd64(void);


 191         sl_field_t              pr_aslwpid;
 192         sl_field_t              pr_agentid;
 193         sl_field_t              pr_sigpend;
 194         sl_field_t              pr_brkbase;
 195         sl_field_t              pr_brksize;
 196         sl_field_t              pr_stkbase;
 197         sl_field_t              pr_stksize;
 198         sl_field_t              pr_utime;
 199         sl_field_t              pr_stime;
 200         sl_field_t              pr_cutime;
 201         sl_field_t              pr_cstime;
 202         sl_field_t              pr_sigtrace;
 203         sl_field_t              pr_flttrace;
 204         sl_field_t              pr_sysentry;
 205         sl_field_t              pr_sysexit;
 206         sl_field_t              pr_dmodel;
 207         sl_field_t              pr_taskid;
 208         sl_field_t              pr_projid;
 209         sl_field_t              pr_nzomb;
 210         sl_field_t              pr_zoneid;
 211         sl_field_t              pr_secflags;
 212         sl_field_t              pr_lwp;
 213 } sl_pstatus_layout_t;
 214 
 215 /*
 216  * Layout description of prstatus_t, from <sys/old_procfs.h>.
 217  */
 218 typedef struct {
 219         sl_field_t              sizeof_struct;
 220         sl_field_t              pr_flags;
 221         sl_field_t              pr_why;
 222         sl_field_t              pr_what;
 223         sl_field_t              pr_info;
 224         sl_field_t              pr_cursig;
 225         sl_field_t              pr_nlwp;
 226         sl_field_t              pr_sigpend;
 227         sl_field_t              pr_sighold;
 228         sl_field_t              pr_altstack;
 229         sl_field_t              pr_action;
 230         sl_field_t              pr_pid;
 231         sl_field_t              pr_ppid;


 510  * Layout description of prdinfo_t, from <sys/procfs.h>.
 511  */
 512 typedef struct {
 513         sl_field_t              sizeof_struct;
 514         sl_field_t              pr_fd;
 515         sl_field_t              pr_mode;
 516         sl_field_t              pr_uid;
 517         sl_field_t              pr_gid;
 518         sl_field_t              pr_major;
 519         sl_field_t              pr_minor;
 520         sl_field_t              pr_rmajor;
 521         sl_field_t              pr_rminor;
 522         sl_field_t              pr_ino;
 523         sl_field_t              pr_offset;
 524         sl_field_t              pr_size;
 525         sl_field_t              pr_fileflags;
 526         sl_field_t              pr_fdflags;
 527         sl_field_t              pr_path;
 528 } sl_prfdinfo_layout_t;
 529 
 530 typedef struct {
 531         sl_field_t              sizeof_struct;
 532         sl_field_t              psf_effective;
 533         sl_field_t              psf_inherit;
 534 } sl_psecflags_layout_t;
 535 
 536 /*
 537  * This type collects all of the layout definitions for
 538  * a given architecture.
 539  */
 540 typedef struct {
 541         const sl_auxv_layout_t          *auxv;          /* auxv_t */
 542         const sl_fltset_layout_t        *fltset;        /* fltset_t */
 543         const sl_lwpsinfo_layout_t      *lwpsinfo;      /* lwpsinfo_t */
 544         const sl_lwpstatus_layout_t     *lwpstatus;     /* lwpstatus_t */
 545         const sl_prcred_layout_t        *prcred;        /* prcred_t */
 546         const sl_priv_impl_info_layout_t *priv_impl_info; /* priv_impl_info_t */
 547         const sl_prpriv_layout_t        *prpriv;        /* prpriv_t */
 548         const sl_psinfo_layout_t        *psinfo;        /* psinfo_t */
 549         const sl_pstatus_layout_t       *pstatus;       /* pstatus_t */
 550         const sl_prgregset_layout_t     *prgregset;     /* prgregset_t */
 551         const sl_prpsinfo_layout_t      *prpsinfo;      /* prpsinfo_t */
 552         const sl_prstatus_layout_t      *prstatus;      /* prstatus_t */
 553         const sl_sigaction_layout_t     *sigaction;     /* struct sigaction */
 554         const sl_siginfo_layout_t       *siginfo;       /* siginfo_t */
 555         const sl_sigset_layout_t        *sigset;        /* sigset_t */
 556         const sl_stack_layout_t         *stack;         /* stack_t */
 557         const sl_sysset_layout_t        *sysset;        /* sysset_t */
 558         const sl_timestruc_layout_t     *timestruc;     /* timestruc_t */
 559         const sl_utsname_layout_t       *utsname;       /* struct utsname */
 560         const sl_prfdinfo_layout_t      *prfdinfo;      /* prdinfo_t */
 561         const sl_psecflags_layout_t     *psecflags;     /* psecflags_t */
 562 } sl_arch_layout_t;
 563 
 564 
 565 
 566 extern  void            sl_extract_num_field(const char *data, int do_swap,
 567                             const sl_field_t *fdesc, sl_data_t *field_data);
 568 extern  Word            sl_extract_as_word(const char *data, int do_swap,
 569                             const sl_field_t *fdesc);
 570 extern  Lword           sl_extract_as_lword(const char *data, int do_swap,
 571                             const sl_field_t *fdesc);
 572 extern  Sword           sl_extract_as_sword(const char *data, int do_swap,
 573                             const sl_field_t *fdesc);
 574 extern  const char      *sl_fmt_num(const char *data, int do_swap,
 575                             const sl_field_t *fdesc, sl_fmt_num_t fmt_type,
 576                             sl_fmtbuf_t buf);
 577 
 578 
 579 extern  const sl_arch_layout_t  *sl_mach(Half);
 580 extern  const sl_arch_layout_t  *struct_layout_i386(void);
 581 extern  const sl_arch_layout_t  *struct_layout_amd64(void);