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/cmd/sgs/elfdump/common/gen_struct_layout.c
          +++ new/usr/src/cmd/sgs/elfdump/common/gen_struct_layout.c
↓ open down ↓ 190 lines elided ↑ open up ↑
 191  191          SCALAR_FIELD(pstatus_t,         pr_cstime,      0);
 192  192          SCALAR_FIELD(pstatus_t,         pr_sigtrace,    0);
 193  193          SCALAR_FIELD(pstatus_t,         pr_flttrace,    0);
 194  194          SCALAR_FIELD(pstatus_t,         pr_sysentry,    0);
 195  195          SCALAR_FIELD(pstatus_t,         pr_sysexit,     0);
 196  196          SCALAR_FIELD(pstatus_t,         pr_dmodel,      0);
 197  197          SCALAR_FIELD(pstatus_t,         pr_taskid,      1);
 198  198          SCALAR_FIELD(pstatus_t,         pr_projid,      1);
 199  199          SCALAR_FIELD(pstatus_t,         pr_nzomb,       1);
 200  200          SCALAR_FIELD(pstatus_t,         pr_zoneid,      1);
      201 +        SCALAR_FIELD(pstatus_t,         pr_secflags,    0);
 201  202          SCALAR_FIELD(pstatus_t,         pr_lwp,         0);
 202  203  
 203  204          END;
 204  205  }
 205  206  
 206  207  
 207  208  /* prstatus_t, <sys/old_procfs.h> */
 208  209  static void
 209  210  gen_prstatus(void)
 210  211  {
↓ open down ↓ 369 lines elided ↑ open up ↑
 580  581          SCALAR_FIELD(prfdinfo_t,        pr_ino,         0);
 581  582          SCALAR_FIELD(prfdinfo_t,        pr_offset,      0);
 582  583          SCALAR_FIELD(prfdinfo_t,        pr_size,        0);
 583  584          SCALAR_FIELD(prfdinfo_t,        pr_fileflags,   0);
 584  585          SCALAR_FIELD(prfdinfo_t,        pr_fdflags,     0);
 585  586          ARRAY_FIELD(prfdinfo_t,         pr_path,        0);
 586  587  
 587  588          END;
 588  589  }
 589  590  
      591 +static void
      592 +gen_psecflags(void)
      593 +{
      594 +        START(psecflags, psecflags_t);
      595 +        SCALAR_FIELD(psecflags_t, psf_effective, 0);
      596 +        SCALAR_FIELD(psecflags_t, psf_inherit, 0);
      597 +        END;
      598 +}
      599 +
 590  600  
 591  601  /*ARGSUSED*/
 592  602  int
 593  603  main(int argc, char *argv[])
 594  604  {
 595  605          const char *fmt = "\t&%s_layout,\n";
 596  606  
 597  607          /* get obj file for input */
 598  608          if (argc < 3) {
 599  609                  (void) fprintf(stderr,
↓ open down ↓ 21 lines elided ↑ open up ↑
 621  631          gen_priv_impl_info();
 622  632          gen_fltset();
 623  633          gen_siginfo();
 624  634          gen_sigset();
 625  635          gen_sigaction();
 626  636          gen_stack();
 627  637          gen_sysset();
 628  638          gen_timestruc();
 629  639          gen_utsname();
 630  640          gen_prfdinfo();
      641 +        gen_psecflags();
 631  642  
 632  643  
 633  644          /*
 634  645           * Generate the full arch_layout description
 635  646           */
 636  647          (void) printf(
 637  648              "\n\n\n\nstatic const sl_arch_layout_t layout_%s = {\n",
 638  649              machname);
 639  650          (void) printf(fmt, "auxv");
 640  651          (void) printf(fmt, "fltset");
↓ open down ↓ 8 lines elided ↑ open up ↑
 649  660          (void) printf(fmt, "prpsinfo");
 650  661          (void) printf(fmt, "prstatus");
 651  662          (void) printf(fmt, "sigaction");
 652  663          (void) printf(fmt, "siginfo");
 653  664          (void) printf(fmt, "sigset");
 654  665          (void) printf(fmt, "stack");
 655  666          (void) printf(fmt, "sysset");
 656  667          (void) printf(fmt, "timestruc");
 657  668          (void) printf(fmt, "utsname");
 658  669          (void) printf(fmt, "prfdinfo");
      670 +        (void) printf(fmt, "psecflags");
 659  671          (void) printf("};\n");
 660  672  
 661  673          /*
 662  674           * A public function, to make the information available
 663  675           */
 664  676          (void) printf("\n\nconst sl_arch_layout_t *\n");
 665  677          (void) printf("struct_layout_%s(void)\n", machname);
 666  678          (void) printf("{\n\treturn (&layout_%s);\n}\n", machname);
 667  679  
 668  680          return (0);
↓ open down ↓ 286 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX