Changeset 335

Show
Ignore:
Timestamp:
09/24/07 12:30:39 (1 year ago)
Author:
mgoldman
Message:

Rebased to revision 2585

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • upstream/selinux/checkpolicy/ChangeLog

    r292 r335  
     12.0.4 2007-09-18 
     2        * Merged handle unknown policydb flag support from Eric Paris. 
     3          Adds new command line options -U {allow, reject, deny} for selecting 
     4          the flag when a base module or kernel policy is built. 
     5 
    162.0.3 2007-05-31 
    27        * Merged fix for segfault on duplicate require of sensitivity from Caleb Case. 
  • upstream/selinux/checkpolicy/VERSION

    r292 r335  
    1 2.0.3 
     12.0.4 
  • upstream/selinux/checkpolicy/checkmodule.c

    r10 r335  
    4040 
    4141extern int mlspol; 
     42extern int handle_unknown; 
    4243 
    4344static char *txtfile = "policy.conf"; 
     
    122123        p->policy_type = policy_type; 
    123124        p->policyvers = policyvers; 
     125        p->handle_unknown = handle_unknown; 
    124126 
    125127        pf.type = PF_USE_STDIO; 
     
    136138static void usage(char *progname) 
    137139{ 
    138         printf("usage:  %s [-V] [-b] [-m] [-M] [-o FILE] [INPUT]\n", progname); 
     140        printf("usage:  %s [-V] [-b] [-U handle_unknown] [-m] [-M] [-o FILE] [INPUT]\n", progname); 
    139141        printf("Build base and policy modules.\n"); 
    140142        printf("Options:\n"); 
     
    143145        printf("  -V         show policy versions created by this program\n"); 
    144146        printf("  -b         treat input as a binary policy file\n"); 
     147        printf("  -U OPTION  How to handle unknown classes and permissions\n"); 
     148        printf("               deny: Deny unknown kernel checks\n"); 
     149        printf("               reject: Reject loading of policy with unknowns\n"); 
     150        printf("               allow: Allow unknown kernel checks\n"); 
    145151        printf("  -m         build a policy module instead of a base module\n"); 
    146152        printf("  -M         enable MLS policy\n"); 
     
    157163        policydb_t modpolicydb; 
    158164 
    159         while ((ch = getopt(argc, argv, "ho:dbVmM")) != EOF) { 
     165        while ((ch = getopt(argc, argv, "ho:dbVU:mM")) != EOF) { 
    160166                switch (ch) { 
    161167                case 'h': 
     
    172178                        show_version = 1; 
    173179                        break; 
     180                case 'U': 
     181                        if (!strcasecmp(optarg, "deny")) { 
     182                                handle_unknown = DENY_UNKNOWN; 
     183                                break; 
     184                        } 
     185                        if (!strcasecmp(optarg, "reject")) { 
     186                                handle_unknown = REJECT_UNKNOWN; 
     187                                break; 
     188                        } 
     189                        if (!strcasecmp(optarg, "allow")) { 
     190                                handle_unknown = ALLOW_UNKNOWN; 
     191                                break; 
     192                        } 
     193                        usage(argv[0]); 
    174194                case 'm': 
    175195                        policy_type = POLICY_MOD; 
     
    188208                       MOD_POLICYDB_VERSION_MIN, MOD_POLICYDB_VERSION_MAX); 
    189209                exit(0); 
     210        } 
     211 
     212        if (handle_unknown && (policy_type != POLICY_BASE)) { 
     213                printf("Handling of unknown classes and permissions is only "); 
     214                printf("valid in the base module\n"); 
     215                exit(1); 
    190216        } 
    191217 
     
    215241                modpolicydb.policy_type = policy_type; 
    216242                modpolicydb.mls = mlspol; 
     243                modpolicydb.handle_unknown = handle_unknown; 
    217244 
    218245                if (read_source_policy(&modpolicydb, file, argv[0]) == -1) { 
  • upstream/selinux/checkpolicy/checkpolicy.c

    r10 r335  
    9191extern policydb_t *policydbp; 
    9292extern int mlspol; 
     93extern int handle_unknown; 
    9394 
    9495static char *txtfile = "policy.conf"; 
     
    100101{ 
    101102        printf 
    102             ("usage:  %s [-b] [-d] [-M] [-c policyvers (%d-%d)] [-o output_file] [input_file]\n", 
     103            ("usage:  %s [-b] [-d] [-U handle_unknown (allow,deny,reject) [-M] [-c policyvers (%d-%d)] [-o output_file] [input_file]\n", 
    103104             progname, POLICYDB_VERSION_MIN, POLICYDB_VERSION_MAX); 
    104105        exit(1); 
     
    391392        struct policy_file pf; 
    392393 
    393         while ((ch = getopt(argc, argv, "o:dbMVc:")) != EOF) { 
     394        while ((ch = getopt(argc, argv, "o:dbU:MVc:")) != EOF) { 
    394395                switch (ch) { 
    395396                case 'o': 
     
    406407                        show_version = 1; 
    407408                        break; 
     409                case 'U': 
     410                        if (!strcasecmp(optarg, "deny")) { 
     411                                handle_unknown = DENY_UNKNOWN; 
     412                                break; 
     413                        } 
     414                        if (!strcasecmp(optarg, "allow")) { 
     415                                handle_unknown = ALLOW_UNKNOWN; 
     416                                break; 
     417                        } 
     418                        if (!strcasecmp(optarg, "reject")) { 
     419                                handle_unknown = REJECT_UNKNOWN; 
     420                                break; 
     421                        } 
     422                        usage(argv[0]); 
    408423                case 'M': 
    409424                        mlspol = 1; 
     
    516531                /* Let sepol know if we are dealing with MLS support */ 
    517532                parse_policy.mls = mlspol; 
     533                parse_policy.handle_unknown = handle_unknown; 
    518534 
    519535                policydbp = &parse_policy; 
  • upstream/selinux/checkpolicy/policy_parse.y

    r222 r335  
    6868char *curfile = 0; 
    6969int mlspol = 0; 
     70int handle_unknown = 0; 
    7071 
    7172extern unsigned long policydb_lineno; 
  • upstream/selinux/checkpolicy/test/dismod.c

    r10 r335  
    666666} 
    667667 
     668int display_handle_unknown(policydb_t * policydb, FILE * out_fp) 
     669{ 
     670        if (policydb->handle_unknown == ALLOW_UNKNOWN) 
     671                fprintf(out_fp, "Allow unknown classes and perms\n"); 
     672        else if (policydb->handle_unknown == DENY_UNKNOWN) 
     673                fprintf(out_fp, "Deny unknown classes and perms\n"); 
     674        else if (policydb->handle_unknown == REJECT_UNKNOWN) 
     675                fprintf(out_fp, "Reject unknown classes and perms\n"); 
     676        return 0; 
     677} 
     678 
    668679static int read_policy(char *filename, policydb_t * policy) 
    669680{ 
     
    772783        printf("b)  Display avrule declarations\n"); 
    773784        printf("l)  Link in a module\n"); 
     785        printf("u)  Display the unknown handling setting\n"); 
    774786        printf("\n"); 
    775787        printf("f)  set output file\n"); 
     
    879891                        fprintf(out_fp, "avrule block declarations:\n"); 
    880892                        display_avblock(6, 0, &policydb, out_fp); 
     893                        break; 
     894                case 'u': 
     895                case 'U': 
     896                        display_handle_unknown(&policydb, out_fp); 
    881897                        break; 
    882898                case 'f': 
  • upstream/selinux/checkpolicy/test/dispol.c

    r10 r335  
    274274} 
    275275 
     276int display_handle_unknown(policydb_t * policydb, FILE * out_fp) 
     277{ 
     278        if (policydb->handle_unknown == ALLOW_UNKNOWN) 
     279                fprintf(out_fp, "Allow unknown classes and permisions\n"); 
     280        else if (policydb->handle_unknown == DENY_UNKNOWN) 
     281                fprintf(out_fp, "Deny unknown classes and permisions\n"); 
     282        else if (policydb->handle_unknown == REJECT_UNKNOWN) 
     283                fprintf(out_fp, "Reject unknown classes and permisions\n"); 
     284        return 0; 
     285} 
     286 
    276287int change_bool(char *name, int state, policydb_t * p, FILE * fp) 
    277288{ 
     
    299310        printf("7)  change a boolean value\n"); 
    300311        printf("\n"); 
     312        printf("u)  display unknown handling setting\n"); 
    301313        printf("f)  set output file\n"); 
    302314        printf("m)  display menu\n"); 
     
    409421                        change_bool(name, state, &policydb, out_fp); 
    410422                        free(name); 
     423                        break; 
     424                case 'u': 
     425                case 'U': 
     426                        display_handle_unknown(&policydb, out_fp); 
    411427                        break; 
    412428                case 'f': 
  • upstream/selinux/libselinux/ChangeLog

    r292 r335  
     12.0.35 2007-09-24 
     2        * Make netlink socket close-on-exec to avoid descriptor leakage from Dan Walsh. 
     3        * Pass CFLAGS when using gcc for linking from Dennis Gilmore.  
     4 
     52.0.34 2007-09-18 
     6        * Fix selabel option flag setting for 64-bit from Stephen Smalley. 
     7 
     82.0.33 2007-09-12 
     9        * Re-map a getxattr return value of 0 to a getfilecon return value of -1 with errno EOPNOTSUPP from Stephen Smalley. 
     10        * Fall back to the compat code for security_class_to_string and security_av_perm_to_string from Stephen Smalley. 
     11 
     122.0.32 2007-09-10 
     13        * Fix swig binding for rpm_execcon from James Athey. 
     14 
     152.0.31 2007-08-23 
     16        * Fix file_contexts.homedirs path from Todd Miller. 
     17 
     182.0.30 2007-08-06 
     19        * Fix segfault resulting from uninitialized print-callback pointer. 
     20 
     212.0.29 2007-08-02 
     22        * Added x_contexts path function patch from Eamon Walsh. 
     23 
     242.0.28 2007-08-01 
     25        * Fix build for EMBEDDED=y from Yuichi Nakamura. 
     26 
     272.0.27 2007-07-25 
     28        * Fix markup problems in selinux man pages from Dan Walsh. 
     29 
     302.0.26 2007-07-23 
     31        * Updated av_permissions.h and flask.h to include new nscd permissions from Dan Walsh. 
     32        * Added swigify to top-level Makefile from Dan Walsh. 
     33 
     342.0.25 2007-07-23 
     35        * Fix for string_to_security_class segfault on x86_64 from Stephen 
     36          Smalley. 
     37 
    1382.0.24 2007-09-07 
    239        * Fix for getfilecon() for zero-length contexts from Stephen Smalley. 
  • upstream/selinux/libselinux/Makefile

    r292 r335  
    88        override DISABLE_RPM=y 
    99        override DISABLE_BOOL=y 
     10endif 
     11ifeq ($(DISABLE_AVC),y) 
     12        EMFLAGS+= -DDISABLE_AVC 
    1013endif 
    1114ifeq ($(DISABLE_BOOL),y) 
     
    2023        $(MAKE) -C src  
    2124        $(MAKE) -C utils 
     25 
     26swigify: all 
     27        $(MAKE) -C src swigify 
    2228 
    2329pywrap:  
  • upstream/selinux/libselinux/VERSION

    r292 r335  
    1 2.0.24 
     12.0.35 
  • upstream/selinux/libselinux/include/selinux/av_permissions.h

    r141 r335  
    291291#define NODE__RAWIP_SEND                          0x00000020UL 
    292292#define NODE__ENFORCE_DEST                        0x00000040UL 
     293#define NODE__DCCP_RECV                           0x00000080UL 
     294#define NODE__DCCP_SEND                           0x00000100UL 
    293295#define NETIF__TCP_RECV                           0x00000001UL 
    294296#define NETIF__TCP_SEND                           0x00000002UL 
     
    297299#define NETIF__RAWIP_RECV                         0x00000010UL 
    298300#define NETIF__RAWIP_SEND                         0x00000020UL 
     301#define NETIF__DCCP_RECV                          0x00000040UL 
     302#define NETIF__DCCP_SEND                          0x00000080UL 
    299303#define NETLINK_SOCKET__IOCTL                     0x00000001UL 
    300304#define NETLINK_SOCKET__READ                      0x00000002UL 
     
    838842#define NSCD__SHMEMGRP                            0x00000040UL 
    839843#define NSCD__SHMEMHOST                           0x00000080UL 
     844#define NSCD__GETSERV                             0x00000100UL 
     845#define NSCD__SHMEMSERV                           0x00000200UL 
    840846#define ASSOCIATION__SENDTO                       0x00000001UL 
    841847#define ASSOCIATION__RECVFROM                     0x00000002UL 
     
    898904#define CONTEXT__TRANSLATE                        0x00000001UL 
    899905#define CONTEXT__CONTAINS                         0x00000002UL 
     906#define DCCP_SOCKET__IOCTL                        0x00000001UL 
     907#define DCCP_SOCKET__READ                         0x00000002UL 
     908#define DCCP_SOCKET__WRITE                        0x00000004UL 
     909#define DCCP_SOCKET__CREATE                       0x00000008UL 
     910#define DCCP_SOCKET__GETATTR                      0x00000010UL 
     911#define DCCP_SOCKET__SETATTR                      0x00000020UL 
     912#define DCCP_SOCKET__LOCK                         0x00000040UL 
     913#define DCCP_SOCKET__RELABELFROM                  0x00000080UL 
     914#define DCCP_SOCKET__RELABELTO                    0x00000100UL 
     915#define DCCP_SOCKET__APPEND                       0x00000200UL 
     916#define DCCP_SOCKET__BIND                         0x00000400UL 
     917#define DCCP_SOCKET__CONNECT                      0x00000800UL 
     918#define DCCP_SOCKET__LISTEN                       0x00001000UL 
     919#define DCCP_SOCKET__ACCEPT                       0x00002000UL 
     920#define DCCP_SOCKET__GETOPT                       0x00004000UL 
     921#define DCCP_SOCKET__SETOPT                       0x00008000UL 
     922#define DCCP_SOCKET__SHUTDOWN                     0x00010000UL 
     923#define DCCP_SOCKET__RECVFROM                     0x00020000UL 
     924#define DCCP_SOCKET__SENDTO                       0x00040000UL 
     925#define DCCP_SOCKET__RECV_MSG                     0x00080000UL 
     926#define DCCP_SOCKET__SEND_MSG                     0x00100000UL 
     927#define DCCP_SOCKET__NAME_BIND                    0x00200000UL 
     928#define DCCP_SOCKET__NODE_BIND                    0x00400000UL 
     929#define DCCP_SOCKET__NAME_CONNECT                 0x00800000UL 
     930#define MEMPROTECT__MMAP_ZERO                     0x00000001UL 
  • upstream/selinux/libselinux/include/selinux/flask.h

    r84 r335  
    6565#define SECCLASS_KEY                                     58 
    6666#define SECCLASS_CONTEXT                                 59 
     67#define SECCLASS_DCCP_SOCKET                             60 
     68#define SECCLASS_MEMPROTECT                              61 
    6769 
    6870/* 
  • upstream/selinux/libselinux/include/selinux/selinux.h

    r292 r335  
    455455extern const char *selinux_homedir_context_path(void); 
    456456extern const char *selinux_media_context_path(void); 
     457extern const char *selinux_x_context_path(void); 
    457458extern const char *selinux_contexts_path(void); 
    458459extern const char *selinux_securetty_types_path(void); 
  • upstream/selinux/libselinux/man/man3/avc_add_callback.3

    r292 r335  
    77.SH "SYNOPSIS" 
    88.B #include <selinux/selinux.h> 
    9 .br 
     9 
    1010.B #include <selinux/avc.h> 
    1111.sp 
     
    1313.in +\w'int avc_add_callback(int (*callback)('u 
    1414.BI "security_id_t " ssid , 
    15 .br 
     15 
    1616.BI "security_id_t " tsid , 
    17 .br 
     17 
    1818.BI "security_class_t " tclass , 
    19 .br 
     19 
    2020.BI "access_vector_t " perms , 
    21 .br 
     21 
    2222.BI "access_vector_t *" out_retained ")," 
    2323.in 
    2424.in +\w'int avc_add_callback('u 
    2525.BI "uint32_t " events ", security_id_t " ssid ,  
    26 .br 
     26 
    2727.BI "security_id_t " tsid ", security_class_t " tclass , 
    28 .br 
     28 
    2929.BI "access_vector_t " perms ");" 
    3030.in 
  • upstream/selinux/libselinux/man/man3/avc_cache_stats.3

    r292 r335  
    77.SH "SYNOPSIS" 
    88.B #include <selinux/selinux.h> 
    9 .br 
     9 
    1010.B #include <selinux/avc.h> 
    1111.sp 
  • upstream/selinux/libselinux/man/man3/avc_compute_create.3

    r292 r335  
    77.SH "SYNOPSIS" 
    88.B #include <selinux/selinux.h> 
    9 .br 
     9 
    1010.B #include <selinux/avc.h> 
    1111.sp 
  • upstream/selinux/libselinux/man/man3/avc_context_to_sid.3

    r292 r335  
    77.SH "SYNOPSIS" 
    88.B #include <selinux/selinux.h> 
    9 .br 
     9 
    1010.B #include <selinux/avc.h> 
    1111.sp 
  • upstream/selinux/libselinux/man/man3/avc_has_perm.3

    r292 r335  
    77.SH "SYNOPSIS" 
    88.B #include <selinux/selinux.h> 
    9 .br 
     9 
    1010.B #include <selinux/avc.h> 
    1111.sp 
     
    1515.in +\w'int avc_has_perm('u 
    1616.BI "security_class_t " tclass ", access_vector_t " requested , 
    17 .br 
     17 
    1818.BI "struct avc_entry_ref *" aeref ", void *" auditdata ");" 
    1919.in 
     
    2222.in +\w'int avc_has_perm('u 
    2323.BI "security_class_t " tclass ", access_vector_t " requested , 
    24 .br 
     24 
    2525.BI "struct avc_entry_ref *" aeref ", struct av_decision *" avd ");" 
    2626.in 
     
    2929.in +\w'void avc_audit('u 
    3030.BI "security_class_t " tclass ", access_vector_t " requested , 
    31 .br 
     31 
    3232.BI "struct av_decision *" avd ", int " result ", void *" auditdata ");" 
    3333.in 
  • upstream/selinux/libselinux/man/man3/avc_init.3

    r292 r335  
    77.SH "SYNOPSIS" 
    88.B #include <selinux/selinux.h> 
    9 .br 
     9 
    1010.B #include <selinux/avc.h> 
    1111.sp 
     
    1313.in +\w'int avc_init('u 
    1414.BI "const struct avc_memory_callback *" mem_callbacks , 
    15 .br 
     15 
    1616.BI "const struct avc_log_callback *" log_callbacks , 
    17 .br 
     17 
    1818.BI "const struct avc_thread_callback *" thread_callbacks , 
    19 .br 
     19 
    2020.BI "const struct avc_lock_callback *" lock_callbacks ");" 
    2121.in 
  • upstream/selinux/libselinux/man/man3/context_new.3

    r222 r335  
    55.SH "SYNOPSIS" 
    66.B #include <selinux/context.h> 
    7 .br  
     7 
    88.B "context_t context_new(const char *" context_str ); 
    9 .br  
     9 
    1010.B "const char * context_str(context_t " con ); 
    11 .br  
     11 
    1212.B "void context_free(context_t " con ); 
    13 .br  
     13 
    1414.B "const char * context_type_get(context_t " con ); 
    15 .br  
     15 
    1616.B "const char * context_range_get(context_t " con ); 
    17 .br  
     17 
    1818.B "const char * context_role_get(context_t " con ); 
    19 .br  
     19 
    2020.B "const char * context_user_get(context_t " con ); 
    21 .br  
     21 
    2222.B "const char * context_type_set(context_t " con ", const char* " type); 
    23 .br  
     23 
    2424.B "const char * context_range_set(context_t " con ", const char* " range); 
    25 .br  
     25 
    2626.B "const char * context_role_set(context_t " con ", const char* " role ); 
    27 .br  
     27 
    2828.B "const char * context_user_set(context_t " con ", const char* " user ); 
    2929 
  • upstream/selinux/libselinux/man/man3/freecon.3

    r292 r335  
    66.sp 
    77.BI "void freecon(security_context_t "con ); 
    8 .br  
     8 
    99.BI "void freeconary(security_context_t *" con ); 
    1010 
  • upstream/selinux/libselinux/man/man3/get_ordered_context_list.3

    r292 r335  
    55.SH "SYNOPSIS" 
    66.B #include <selinux/selinux.h> 
    7 .br 
     7 
    88.B #include <selinux/get_context_list.h> 
    99.sp 
  • upstream/selinux/libselinux/man/man3/getcon.3

    r292 r335  
    22.SH "NAME" 
    33getcon, getprevcon, getpidcon \- get SELinux security context of a process. 
    4 .br 
     4 
    55getpeercon - get security context of a peer socket. 
    6 .br 
     6 
    77setcon - set current security context of a process. 
    88.SH "SYNOPSIS" 
     
    1010.sp 
    1111.BI "int getcon(security_context_t *" context ); 
    12 .br  
     12 
    1313.BI "int getprevcon(security_context_t *" context ); 
    14 .br 
     14 
    1515.BI "int getpidcon(pid_t " pid ", security_context_t *" context ); 
    16 .br 
     16 
    1717.BI "int getpeercon(int " fd ", security_context_t *" context); 
    18 .br 
     18 
    1919.BI "int setcon(security_context_t " context); 
    2020 
  • upstream/selinux/libselinux/man/man3/getexeccon.3

    r292 r335  
    22.SH "NAME" 
    33getexeccon, setexeccon \- get or set the SELinux security context used for executing a new process. 
    4 .br 
     4 
    55rpm_execcon \- run a helper for rpm in an appropriate security context 
    66 
     
    99.sp 
    1010.BI "int getexeccon(security_context_t *" context ); 
    11 .br  
     11 
    1212.BI "int setexeccon(security_context_t "context ); 
    13