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.


 570         START(prfdinfo, prfdinfo_t);
 571 
 572         SCALAR_FIELD(prfdinfo_t,        pr_fd,          0);
 573         SCALAR_FIELD(prfdinfo_t,        pr_mode,        0);
 574         SCALAR_FIELD(prfdinfo_t,        pr_uid,         0);
 575         SCALAR_FIELD(prfdinfo_t,        pr_gid,         0);
 576         SCALAR_FIELD(prfdinfo_t,        pr_major,       0);
 577         SCALAR_FIELD(prfdinfo_t,        pr_minor,       0);
 578         SCALAR_FIELD(prfdinfo_t,        pr_rmajor,      0);
 579         SCALAR_FIELD(prfdinfo_t,        pr_rminor,      0);
 580         SCALAR_FIELD(prfdinfo_t,        pr_ino,         0);
 581         SCALAR_FIELD(prfdinfo_t,        pr_offset,      0);
 582         SCALAR_FIELD(prfdinfo_t,        pr_size,        0);
 583         SCALAR_FIELD(prfdinfo_t,        pr_fileflags,   0);
 584         SCALAR_FIELD(prfdinfo_t,        pr_fdflags,     0);
 585         ARRAY_FIELD(prfdinfo_t,         pr_path,        0);
 586 
 587         END;
 588 }
 589 











 590 
 591 /*ARGSUSED*/
 592 int
 593 main(int argc, char *argv[])
 594 {
 595         const char *fmt = "\t&%s_layout,\n";
 596 
 597         /* get obj file for input */
 598         if (argc < 3) {
 599                 (void) fprintf(stderr,
 600                     "usage: %s {object_file} {MACH}\n", argv[0]);
 601                 exit(1);
 602         }
 603 
 604         objfile = argv[1];
 605         machname = argv[2];
 606 
 607         get_ctf_file(objfile);
 608 
 609         (void) printf("#include <struct_layout.h>\n");


 611         gen_auxv();
 612         gen_prgregset();
 613         gen_lwpstatus();
 614         gen_pstatus();
 615         gen_prstatus();
 616         gen_psinfo();
 617         gen_prpsinfo();
 618         gen_lwpsinfo();
 619         gen_prcred();
 620         gen_prpriv();
 621         gen_priv_impl_info();
 622         gen_fltset();
 623         gen_siginfo();
 624         gen_sigset();
 625         gen_sigaction();
 626         gen_stack();
 627         gen_sysset();
 628         gen_timestruc();
 629         gen_utsname();
 630         gen_prfdinfo();
 631 
 632 
 633         /*
 634          * Generate the full arch_layout description
 635          */
 636         (void) printf(
 637             "\n\n\n\nstatic const sl_arch_layout_t layout_%s = {\n",
 638             machname);
 639         (void) printf(fmt, "auxv");
 640         (void) printf(fmt, "fltset");
 641         (void) printf(fmt, "lwpsinfo");
 642         (void) printf(fmt, "lwpstatus");
 643         (void) printf(fmt, "prcred");
 644         (void) printf(fmt, "priv_impl_info");
 645         (void) printf(fmt, "prpriv");
 646         (void) printf(fmt, "psinfo");
 647         (void) printf(fmt, "pstatus");
 648         (void) printf(fmt, "prgregset");
 649         (void) printf(fmt, "prpsinfo");
 650         (void) printf(fmt, "prstatus");
 651         (void) printf(fmt, "sigaction");
 652         (void) printf(fmt, "siginfo");
 653         (void) printf(fmt, "sigset");
 654         (void) printf(fmt, "stack");
 655         (void) printf(fmt, "sysset");
 656         (void) printf(fmt, "timestruc");
 657         (void) printf(fmt, "utsname");
 658         (void) printf(fmt, "prfdinfo");

 659         (void) printf("};\n");
 660 
 661         /*
 662          * A public function, to make the information available
 663          */
 664         (void) printf("\n\nconst sl_arch_layout_t *\n");
 665         (void) printf("struct_layout_%s(void)\n", machname);
 666         (void) printf("{\n\treturn (&layout_%s);\n}\n", machname);
 667 
 668         return (0);
 669 }
 670 
 671 /*
 672  * Helper functions using the CTF library to get type info.
 673  */
 674 
 675 static void
 676 get_ctf_file(char *fname)
 677 {
 678         int ctferr;




 570         START(prfdinfo, prfdinfo_t);
 571 
 572         SCALAR_FIELD(prfdinfo_t,        pr_fd,          0);
 573         SCALAR_FIELD(prfdinfo_t,        pr_mode,        0);
 574         SCALAR_FIELD(prfdinfo_t,        pr_uid,         0);
 575         SCALAR_FIELD(prfdinfo_t,        pr_gid,         0);
 576         SCALAR_FIELD(prfdinfo_t,        pr_major,       0);
 577         SCALAR_FIELD(prfdinfo_t,        pr_minor,       0);
 578         SCALAR_FIELD(prfdinfo_t,        pr_rmajor,      0);
 579         SCALAR_FIELD(prfdinfo_t,        pr_rminor,      0);
 580         SCALAR_FIELD(prfdinfo_t,        pr_ino,         0);
 581         SCALAR_FIELD(prfdinfo_t,        pr_offset,      0);
 582         SCALAR_FIELD(prfdinfo_t,        pr_size,        0);
 583         SCALAR_FIELD(prfdinfo_t,        pr_fileflags,   0);
 584         SCALAR_FIELD(prfdinfo_t,        pr_fdflags,     0);
 585         ARRAY_FIELD(prfdinfo_t,         pr_path,        0);
 586 
 587         END;
 588 }
 589 
 590 static void
 591 gen_prsecflags(void)
 592 {
 593         START(prsecflags, prsecflags_t);
 594         SCALAR_FIELD(prsecflags_t, pr_version, 0);
 595         SCALAR_FIELD(prsecflags_t, pr_effective, 0);
 596         SCALAR_FIELD(prsecflags_t, pr_inherit, 0);
 597         SCALAR_FIELD(prsecflags_t, pr_lower, 0);
 598         SCALAR_FIELD(prsecflags_t, pr_upper, 0);
 599         END;
 600 }
 601 
 602 /*ARGSUSED*/
 603 int
 604 main(int argc, char *argv[])
 605 {
 606         const char *fmt = "\t&%s_layout,\n";
 607 
 608         /* get obj file for input */
 609         if (argc < 3) {
 610                 (void) fprintf(stderr,
 611                     "usage: %s {object_file} {MACH}\n", argv[0]);
 612                 exit(1);
 613         }
 614 
 615         objfile = argv[1];
 616         machname = argv[2];
 617 
 618         get_ctf_file(objfile);
 619 
 620         (void) printf("#include <struct_layout.h>\n");


 622         gen_auxv();
 623         gen_prgregset();
 624         gen_lwpstatus();
 625         gen_pstatus();
 626         gen_prstatus();
 627         gen_psinfo();
 628         gen_prpsinfo();
 629         gen_lwpsinfo();
 630         gen_prcred();
 631         gen_prpriv();
 632         gen_priv_impl_info();
 633         gen_fltset();
 634         gen_siginfo();
 635         gen_sigset();
 636         gen_sigaction();
 637         gen_stack();
 638         gen_sysset();
 639         gen_timestruc();
 640         gen_utsname();
 641         gen_prfdinfo();
 642         gen_prsecflags();
 643 
 644         /*
 645          * Generate the full arch_layout description
 646          */
 647         (void) printf(
 648             "\n\n\n\nstatic const sl_arch_layout_t layout_%s = {\n",
 649             machname);
 650         (void) printf(fmt, "auxv");
 651         (void) printf(fmt, "fltset");
 652         (void) printf(fmt, "lwpsinfo");
 653         (void) printf(fmt, "lwpstatus");
 654         (void) printf(fmt, "prcred");
 655         (void) printf(fmt, "priv_impl_info");
 656         (void) printf(fmt, "prpriv");
 657         (void) printf(fmt, "psinfo");
 658         (void) printf(fmt, "pstatus");
 659         (void) printf(fmt, "prgregset");
 660         (void) printf(fmt, "prpsinfo");
 661         (void) printf(fmt, "prstatus");
 662         (void) printf(fmt, "sigaction");
 663         (void) printf(fmt, "siginfo");
 664         (void) printf(fmt, "sigset");
 665         (void) printf(fmt, "stack");
 666         (void) printf(fmt, "sysset");
 667         (void) printf(fmt, "timestruc");
 668         (void) printf(fmt, "utsname");
 669         (void) printf(fmt, "prfdinfo");
 670         (void) printf(fmt, "prsecflags");
 671         (void) printf("};\n");
 672 
 673         /*
 674          * A public function, to make the information available
 675          */
 676         (void) printf("\n\nconst sl_arch_layout_t *\n");
 677         (void) printf("struct_layout_%s(void)\n", machname);
 678         (void) printf("{\n\treturn (&layout_%s);\n}\n", machname);
 679 
 680         return (0);
 681 }
 682 
 683 /*
 684  * Helper functions using the CTF library to get type info.
 685  */
 686 
 687 static void
 688 get_ctf_file(char *fname)
 689 {
 690         int ctferr;