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.


   5 # CDDL HEADER START
   6 #
   7 # The contents of this file are subject to the terms of the
   8 # Common Development and Distribution License, Version 1.0 only
   9 # (the "License").  You may not use this file except in compliance
  10 # with the License.
  11 #
  12 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  13 # or http://www.opensolaris.org/os/licensing.
  14 # See the License for the specific language governing permissions
  15 # and limitations under the License.
  16 #
  17 # When distributing Covered Code, include this CDDL HEADER in each
  18 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  19 # If applicable, add the following below this CDDL HEADER, with the
  20 # fields enclosed by brackets "[]" replaced with your own identifying
  21 # information: Portions Copyright [yyyy] [name of copyright owner]
  22 #
  23 # CDDL HEADER END
  24 #
  25 #ident  "%Z%%M% %I%     %E% SMI"
  26 #
  27 # This file generates three different C files:
  28 #
  29 #       <sys/priv_const.h>
  30 #               An implementation private set of manifest integer constant
  31 #               for privileges and privilege sets and manifest constants for
  32 #               set size, number of sets, number of privileges
  33 #
  34 #       os/priv_const.c
  35 #               A C source file containing the set names, privilege names
  36 #               arrays for the name <-> number mappings
  37 #
  38 #       <sys/priv_names.h>
  39 #               A public header file containing the PRIV_* defines
  40 #               that map to strings; these are for convenience.
  41 #               (it's easy to misspell a string, harder to misspell a
  42 #               manifest constant)
  43 #
  44 #       /etc/security/priv_names
  45 #               A privilege name to explanation mapping.


  90         pnamescmt = \
  91         "#\n" \
  92         "# Privilege name explanation file\n" \
  93         "# The format of entries is a privilege name starting at the\n" \
  94         "# beginning of a line directly folowed by a new line followed\n" \
  95         "# by several lines of texts starting with white space terminated\n" \
  96         "# by a line with a single newline or not starting with white space\n" \
  97         "#\n"
  98 }
  99 
 100 #
 101 # Privilege strings are represented as lower case strings;
 102 # PRIV_ is stripped from the strings.
 103 #
 104 /^([A-Za-z]* )?privilege / {
 105         if (NF == 3) {
 106                 key = toupper($1)
 107                 priv = toupper($3)
 108                 if (set[key] != "")
 109                         set[key] = set[key] ";"
 110                 set[key] = set[key] "\\\n\t\tPRIV_ASSERT((set), " priv ")"
 111         } else {
 112                 priv = toupper($2);
 113         }
 114         privs[npriv] = tolower(substr(priv, 6));
 115         inset = 0
 116         inpriv = 1
 117 
 118         privind[npriv] = privbytes;
 119 
 120         tabs = (32 - length(priv) - 1)/8
 121         # length + \0 - PRIV_
 122         privbytes += length(priv) - 4
 123         pdef[npriv] = "#define\t" priv substr("\t\t\t\t\t", 1, tabs)
 124 
 125         npriv++
 126         next
 127 }
 128 
 129 #
 130 # Set strings are represented as strings with an initial cap;


 340                 print "extern size_t privinfosize;" > privhfile
 341                 print "extern char *priv_str;" > privhfile
 342                 print "extern struct priv_set *priv_basic;" > privhfile
 343                 print "extern struct priv_impl_info *priv_info;" > privhfile
 344                 print "extern struct priv_info_names *priv_ninfo;" > privhfile
 345 
 346                 print "\n/* Privileges */" > privhfile
 347                  
 348                 for (i = 0; i < npriv; i++)
 349                         print pdef[i] sprintf("%3d", i) > privhfile
 350 
 351                 print "\n/* Privilege sets */" > privhfile
 352                 for (i = 0; i < nset; i++)
 353                         print sdef[i] sprintf("%3d", i) > privhfile
 354 
 355                 print "\n#define\tMAX_PRIVILEGE\t\t\t "  setsize * 32 \
 356                         > privhfile
 357 
 358                 # Special privilege categories.
 359                 for (s in set)
 360                         print "\n#define\tPRIV_" s "_ASSERT(set)" set[s] \
 361                                 > privhfile
 362 
 363                 print "\n#endif /* _KERNEL */" > privhfile
 364                 print "\n#ifdef __cplusplus\n}\n#endif" > privhfile
 365                 print "\n#endif /* _SYS_PRIV_CONST_H */" > privhfile
 366                 close(privhfile)
 367         }
 368 
 369         if (pubhfile) {
 370                 cast="((const char *)"
 371                 print "#ifndef _SYS_PRIV_NAMES_H" > pubhfile
 372                 print "#define\t_SYS_PRIV_NAMES_H\n" > pubhfile
 373 
 374                 print pragma "\n" > pubhfile
 375                 print "#ifdef __cplusplus\nextern \"C\" {\n#endif\n" > pubhfile
 376 
 377                 print "#ifndef __PRIV_CONST_IMPL" > pubhfile
 378                 print "/*\n * Privilege names\n */" > pubhfile
 379                 for (i = 0; i < npriv; i++) {
 380                         print "/*\n" privcmt[i] " */" > pubhfile




   5 # CDDL HEADER START
   6 #
   7 # The contents of this file are subject to the terms of the
   8 # Common Development and Distribution License, Version 1.0 only
   9 # (the "License").  You may not use this file except in compliance
  10 # with the License.
  11 #
  12 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  13 # or http://www.opensolaris.org/os/licensing.
  14 # See the License for the specific language governing permissions
  15 # and limitations under the License.
  16 #
  17 # When distributing Covered Code, include this CDDL HEADER in each
  18 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  19 # If applicable, add the following below this CDDL HEADER, with the
  20 # fields enclosed by brackets "[]" replaced with your own identifying
  21 # information: Portions Copyright [yyyy] [name of copyright owner]
  22 #
  23 # CDDL HEADER END
  24 #
  25 
  26 #
  27 # This file generates three different C files:
  28 #
  29 #       <sys/priv_const.h>
  30 #               An implementation private set of manifest integer constant
  31 #               for privileges and privilege sets and manifest constants for
  32 #               set size, number of sets, number of privileges
  33 #
  34 #       os/priv_const.c
  35 #               A C source file containing the set names, privilege names
  36 #               arrays for the name <-> number mappings
  37 #
  38 #       <sys/priv_names.h>
  39 #               A public header file containing the PRIV_* defines
  40 #               that map to strings; these are for convenience.
  41 #               (it's easy to misspell a string, harder to misspell a
  42 #               manifest constant)
  43 #
  44 #       /etc/security/priv_names
  45 #               A privilege name to explanation mapping.


  90         pnamescmt = \
  91         "#\n" \
  92         "# Privilege name explanation file\n" \
  93         "# The format of entries is a privilege name starting at the\n" \
  94         "# beginning of a line directly folowed by a new line followed\n" \
  95         "# by several lines of texts starting with white space terminated\n" \
  96         "# by a line with a single newline or not starting with white space\n" \
  97         "#\n"
  98 }
  99 
 100 #
 101 # Privilege strings are represented as lower case strings;
 102 # PRIV_ is stripped from the strings.
 103 #
 104 /^([A-Za-z]* )?privilege / {
 105         if (NF == 3) {
 106                 key = toupper($1)
 107                 priv = toupper($3)
 108                 if (set[key] != "")
 109                         set[key] = set[key] ";"
 110                 set[key] = set[key] "\\\n\t\tPRIV_ADDSET((set), " priv ")"
 111         } else {
 112                 priv = toupper($2);
 113         }
 114         privs[npriv] = tolower(substr(priv, 6));
 115         inset = 0
 116         inpriv = 1
 117 
 118         privind[npriv] = privbytes;
 119 
 120         tabs = (32 - length(priv) - 1)/8
 121         # length + \0 - PRIV_
 122         privbytes += length(priv) - 4
 123         pdef[npriv] = "#define\t" priv substr("\t\t\t\t\t", 1, tabs)
 124 
 125         npriv++
 126         next
 127 }
 128 
 129 #
 130 # Set strings are represented as strings with an initial cap;


 340                 print "extern size_t privinfosize;" > privhfile
 341                 print "extern char *priv_str;" > privhfile
 342                 print "extern struct priv_set *priv_basic;" > privhfile
 343                 print "extern struct priv_impl_info *priv_info;" > privhfile
 344                 print "extern struct priv_info_names *priv_ninfo;" > privhfile
 345 
 346                 print "\n/* Privileges */" > privhfile
 347                  
 348                 for (i = 0; i < npriv; i++)
 349                         print pdef[i] sprintf("%3d", i) > privhfile
 350 
 351                 print "\n/* Privilege sets */" > privhfile
 352                 for (i = 0; i < nset; i++)
 353                         print sdef[i] sprintf("%3d", i) > privhfile
 354 
 355                 print "\n#define\tMAX_PRIVILEGE\t\t\t "  setsize * 32 \
 356                         > privhfile
 357 
 358                 # Special privilege categories.
 359                 for (s in set)
 360                         print "\n#define\tPRIV_" s "_ADDSET(set)" set[s] \
 361                                 > privhfile
 362 
 363                 print "\n#endif /* _KERNEL */" > privhfile
 364                 print "\n#ifdef __cplusplus\n}\n#endif" > privhfile
 365                 print "\n#endif /* _SYS_PRIV_CONST_H */" > privhfile
 366                 close(privhfile)
 367         }
 368 
 369         if (pubhfile) {
 370                 cast="((const char *)"
 371                 print "#ifndef _SYS_PRIV_NAMES_H" > pubhfile
 372                 print "#define\t_SYS_PRIV_NAMES_H\n" > pubhfile
 373 
 374                 print pragma "\n" > pubhfile
 375                 print "#ifdef __cplusplus\nextern \"C\" {\n#endif\n" > pubhfile
 376 
 377                 print "#ifndef __PRIV_CONST_IMPL" > pubhfile
 378                 print "/*\n * Privilege names\n */" > pubhfile
 379                 for (i = 0; i < npriv; i++) {
 380                         print "/*\n" privcmt[i] " */" > pubhfile