You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(24) |
Sep
(38) |
Oct
(29) |
Nov
(40) |
Dec
(4) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(88) |
Feb
(66) |
Mar
(44) |
Apr
(104) |
May
(35) |
Jun
(34) |
Jul
(12) |
Aug
(42) |
Sep
(84) |
Oct
(34) |
Nov
(30) |
Dec
(22) |
2008 |
Jan
(60) |
Feb
(54) |
Mar
(32) |
Apr
(14) |
May
(16) |
Jun
(26) |
Jul
(22) |
Aug
(12) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <ssm...@us...> - 2008-06-10 13:05:23
|
Revision: 2900 http://selinux.svn.sourceforge.net/selinux/?rev=2900&view=rev Author: ssmalley Date: 2008-06-10 06:05:20 -0700 (Tue, 10 Jun 2008) Log Message: ----------- applied r2885:2886 from trunk Modified Paths: -------------- branches/stable/1_0/checkpolicy/policy_parse.y branches/stable/1_0/libsepol/include/sepol/policydb/expand.h branches/stable/1_0/libsepol/src/expand.c branches/stable/1_0/libsepol/src/policydb.c branches/stable/1_0/libsepol/src/users.c Modified: branches/stable/1_0/checkpolicy/policy_parse.y =================================================================== --- branches/stable/1_0/checkpolicy/policy_parse.y 2008-06-06 14:43:16 UTC (rev 2899) +++ branches/stable/1_0/checkpolicy/policy_parse.y 2008-06-10 13:05:20 UTC (rev 2900) @@ -2729,7 +2729,7 @@ } /* This ebitmap business is just to ensure that there are not conflicting role_trans rules */ - if (role_set_expand(&roles, &e_roles, policydbp)) + if (role_set_expand(&roles, &e_roles, policydbp, NULL)) goto bad; if (type_set_expand(&types, &e_types, policydbp, 1)) Modified: branches/stable/1_0/libsepol/include/sepol/policydb/expand.h =================================================================== --- branches/stable/1_0/libsepol/include/sepol/policydb/expand.h 2008-06-06 14:43:16 UTC (rev 2899) +++ branches/stable/1_0/libsepol/include/sepol/policydb/expand.h 2008-06-10 13:05:20 UTC (rev 2900) @@ -43,6 +43,7 @@ */ extern int expand_module_avrules(sepol_handle_t * handle, policydb_t * base, policydb_t * out, uint32_t * typemap, uint32_t * boolmap, + uint32_t * rolemap, uint32_t * usermap, int verbose, int expand_neverallow); /* * Expand all parts of a module. Neverallow rules are not expanded (only @@ -59,7 +60,7 @@ unsigned char alwaysexpand); extern int type_set_expand(type_set_t * set, ebitmap_t * t, policydb_t * p, unsigned char alwaysexpand); -extern int role_set_expand(role_set_t * x, ebitmap_t * r, policydb_t * p); +extern int role_set_expand(role_set_t * x, ebitmap_t * r, policydb_t * p, uint32_t * rolemap); extern int mls_semantic_level_expand(mls_semantic_level_t *sl, mls_level_t *l, policydb_t *p, sepol_handle_t *h); extern int mls_semantic_range_expand(mls_semantic_range_t *sr, mls_range_t *r, Modified: branches/stable/1_0/libsepol/src/expand.c =================================================================== --- branches/stable/1_0/libsepol/src/expand.c 2008-06-06 14:43:16 UTC (rev 2899) +++ branches/stable/1_0/libsepol/src/expand.c 2008-06-10 13:05:20 UTC (rev 2900) @@ -40,6 +40,8 @@ int verbose; uint32_t *typemap; uint32_t *boolmap; + uint32_t *rolemap; + uint32_t *usermap; policydb_t *base; policydb_t *out; sepol_handle_t *handle; @@ -51,6 +53,23 @@ memset(state, 0, sizeof(expand_state_t)); } +static int map_ebitmap(ebitmap_t * src, ebitmap_t * dst, uint32_t * map) +{ + unsigned int i; + ebitmap_node_t *tnode; + ebitmap_init(dst); + + ebitmap_for_each_bit(src, tnode, i) { + if (!ebitmap_node_get_bit(tnode, i)) + continue; + if (!map[i]) + continue; + if (ebitmap_set_bit(dst, map[i] - 1, 1)) + return -1; + } + return 0; +} + static int type_copy_callback(hashtab_key_t key, hashtab_datum_t datum, void *data) { @@ -142,7 +161,7 @@ ERR(state->handle, "attribute %s vanished!", id); return -1; } - if (convert_type_ebitmap(&type->types, &tmp_union, state->typemap)) { + if (map_ebitmap(&type->types, &tmp_union, state->typemap)) { ERR(state->handle, "out of memory"); return -1; } @@ -289,6 +308,14 @@ names, 1)) { goto out_of_mem; } + } else if (new_expr->attr & CEXPR_ROLE) { + if (map_ebitmap(&expr->names, &new_expr->names, state->rolemap)) { + goto out_of_mem; + } + } else if (new_expr->attr & CEXPR_USER) { + if (map_ebitmap(&expr->names, &new_expr->names, state->usermap)) { + goto out_of_mem; + } } else { /* Other kinds of sets do not. */ if (ebitmap_cpy(&new_expr->names, @@ -494,6 +521,28 @@ return 0; } +static int role_remap_dominates(hashtab_key_t key __attribute__ ((unused)), hashtab_datum_t datum, void *data) +{ + ebitmap_t mapped_roles; + role_datum_t *role = (role_datum_t *) datum; + expand_state_t *state = (expand_state_t *) data; + + if (!(&role->dominates.node)) + return 0; + + if (map_ebitmap(&role->dominates, &mapped_roles, state->rolemap)) + return -1; + + ebitmap_destroy(&role->dominates); + + if (ebitmap_cpy(&role->dominates, &mapped_roles)) + return -1; + + ebitmap_destroy(&mapped_roles); + + return 0; +} + static int role_copy_callback(hashtab_key_t key, hashtab_datum_t datum, void *data) { @@ -508,8 +557,11 @@ role = (role_datum_t *) datum; state = (expand_state_t *) data; - if (strcmp(id, OBJECT_R) == 0) + if (strcmp(id, OBJECT_R) == 0) { + /* object_r is always value 1 */ + state->rolemap[role->s.value - 1] = 1; return 0; + } if (!is_id_enabled(id, state->base, SYM_ROLES)) { /* identifier's scope is not enabled */ @@ -535,8 +587,9 @@ return -1; } - new_role->s.value = role->s.value; state->out->p_roles.nprim++; + new_role->s.value = state->out->p_roles.nprim; + state->rolemap[role->s.value - 1] = new_role->s.value; ret = hashtab_insert(state->out->p_roles.table, (hashtab_key_t) new_id, (hashtab_datum_t) new_role); @@ -553,6 +606,10 @@ ebitmap_init(&new_role->dominates); } + + /* The dominates bitmap is going to be wrong for the moment, + * we'll come back later and remap them, after we are sure all + * the roles have been added */ if (ebitmap_union(&new_role->dominates, &role->dominates)) { ERR(state->handle, "Out of memory!"); return -1; @@ -675,8 +732,9 @@ } memset(new_user, 0, sizeof(user_datum_t)); - new_user->s.value = user->s.value; state->out->p_users.nprim++; + new_user->s.value = state->out->p_users.nprim; + state->usermap[user->s.value - 1] = new_user->s.value; new_id = strdup(id); if (!new_id) { @@ -739,7 +797,7 @@ ebitmap_init(&tmp_union); /* get global roles for this user */ - if (role_set_expand(&user->roles, &tmp_union, state->base)) { + if (role_set_expand(&user->roles, &tmp_union, state->base, state->rolemap)) { ERR(state->handle, "Out of memory!"); ebitmap_destroy(&tmp_union); return -1; @@ -921,14 +979,16 @@ ebitmap_init(&roles); ebitmap_init(&new_roles); - if (role_set_expand(&cur->roles, &roles, state->out)) { + if (role_set_expand(&cur->roles, &roles, state->out, state->rolemap)) { ERR(state->handle, "Out of memory!"); return -1; } - if (role_set_expand(&cur->new_roles, &new_roles, state->out)) { + + if (role_set_expand(&cur->new_roles, &new_roles, state->out, state->rolemap)) { ERR(state->handle, "Out of memory!"); return -1; } + ebitmap_for_each_bit(&roles, snode, i) { if (!ebitmap_node_get_bit(snode, i)) continue; @@ -988,7 +1048,7 @@ ebitmap_init(&roles); ebitmap_init(&types); - if (role_set_expand(&cur->roles, &roles, state->out)) { + if (role_set_expand(&cur->roles, &roles, state->out, state->rolemap)) { ERR(state->handle, "Out of memory!"); return -1; } @@ -1041,7 +1101,7 @@ memset(n, 0, sizeof(role_trans_t)); n->role = i + 1; n->type = j + 1; - n->new_role = cur->new_role; + n->new_role = state->rolemap[cur->new_role - 1]; if (l) { l->next = n; } else { @@ -1641,8 +1701,8 @@ static int context_copy(context_struct_t * dst, context_struct_t * src, expand_state_t * state) { - dst->user = src->user; - dst->role = src->role; + dst->user = state->usermap[src->user - 1]; + dst->role = state->rolemap[src->role - 1]; dst->type = state->typemap[src->type - 1]; return mls_context_cpy(dst, src); } @@ -1825,23 +1885,6 @@ return 0; } -int convert_type_ebitmap(ebitmap_t * src, ebitmap_t * dst, uint32_t * typemap) -{ - unsigned int i; - ebitmap_node_t *tnode; - ebitmap_init(dst); - - ebitmap_for_each_bit(src, tnode, i) { - if (!ebitmap_node_get_bit(tnode, i)) - continue; - if (!typemap[i]) - continue; - if (ebitmap_set_bit(dst, typemap[i] - 1, 1)) - return -1; - } - return 0; -} - /* converts typeset using typemap and expands into ebitmap_t types using the attributes in the passed in policy. * this should not be called until after all the blocks have been processed and the attributes in target policy * are complete. */ @@ -1853,10 +1896,10 @@ type_set_init(&tmpset); - if (convert_type_ebitmap(&set->types, &tmpset.types, typemap)) + if (map_ebitmap(&set->types, &tmpset.types, typemap)) return -1; - if (convert_type_ebitmap(&set->negset, &tmpset.negset, typemap)) + if (map_ebitmap(&set->negset, &tmpset.negset, typemap)) return -1; tmpset.flags = set->flags; @@ -1898,12 +1941,14 @@ return retval; } -int role_set_expand(role_set_t * x, ebitmap_t * r, policydb_t * p) +int role_set_expand(role_set_t * x, ebitmap_t * r, policydb_t * p, uint32_t * rolemap) { unsigned int i; ebitmap_node_t *rnode; + ebitmap_t mapped_roles; ebitmap_init(r); + ebitmap_init(&mapped_roles); if (x->flags & ROLE_STAR) { for (i = 0; i < p->p_roles.nprim++; i++) @@ -1912,13 +1957,23 @@ return 0; } - ebitmap_for_each_bit(&x->roles, rnode, i) { + if (rolemap) { + if (map_ebitmap(&x->roles, &mapped_roles, rolemap)) + return -1; + } else { + if (ebitmap_cpy(&mapped_roles, &x->roles)) + return -1; + } + + ebitmap_for_each_bit(&mapped_roles, rnode, i) { if (ebitmap_node_get_bit(rnode, i)) { if (ebitmap_set_bit(r, i, 1)) return -1; } } + ebitmap_destroy(&mapped_roles); + /* if role is to be complimented, invert the entire bitmap here */ if (x->flags & ROLE_COMP) { for (i = 0; i < ebitmap_length(r); i++) { @@ -2200,7 +2255,8 @@ */ int expand_module_avrules(sepol_handle_t * handle, policydb_t * base, policydb_t * out, uint32_t * typemap, - uint32_t * boolmap, int verbose, + uint32_t * boolmap, uint32_t * rolemap, + uint32_t * usermap, int verbose, int expand_neverallow) { expand_state_t state; @@ -2211,6 +2267,8 @@ state.out = out; state.typemap = typemap; state.boolmap = boolmap; + state.rolemap = rolemap; + state.usermap = usermap; state.handle = handle; state.verbose = verbose; state.expand_neverallow = expand_neverallow; @@ -2264,6 +2322,18 @@ goto cleanup; } + state.rolemap = (uint32_t *)calloc(state.base->p_roles.nprim, sizeof(uint32_t)); + if (!state.rolemap) { + ERR(handle, "Out of memory!"); + goto cleanup; + } + + state.usermap = (uint32_t *)calloc(state.base->p_users.nprim, sizeof(uint32_t)); + if (!state.usermap) { + ERR(handle, "Out of memory!"); + goto cleanup; + } + /* order is important - types must be first */ /* copy types */ @@ -2360,6 +2430,11 @@ } + /* remap role dominates bitmaps */ + if (hashtab_map(state.out->p_roles.table, role_remap_dominates, &state)) { + goto cleanup; + } + if (copy_and_expand_avrule_block(&state) < 0) { ERR(handle, "Error during expand"); goto cleanup; @@ -2419,6 +2494,8 @@ cleanup: free(state.typemap); free(state.boolmap); + free(state.rolemap); + free(state.usermap); return retval; } Modified: branches/stable/1_0/libsepol/src/policydb.c =================================================================== --- branches/stable/1_0/libsepol/src/policydb.c 2008-06-06 14:43:16 UTC (rev 2899) +++ branches/stable/1_0/libsepol/src/policydb.c 2008-06-10 13:05:20 UTC (rev 2900) @@ -521,7 +521,7 @@ p = (policydb_t *) arg; ebitmap_destroy(&user->cache); - if (role_set_expand(&user->roles, &user->cache, p)) { + if (role_set_expand(&user->roles, &user->cache, p, NULL)) { return -1; } Modified: branches/stable/1_0/libsepol/src/users.c =================================================================== --- branches/stable/1_0/libsepol/src/users.c 2008-06-06 14:43:16 UTC (rev 2899) +++ branches/stable/1_0/libsepol/src/users.c 2008-06-10 13:05:20 UTC (rev 2900) @@ -260,7 +260,7 @@ /* Expand roles */ if (role_set_expand - (&usrdatum->roles, &usrdatum->cache, policydb)) { + (&usrdatum->roles, &usrdatum->cache, policydb, NULL)) { ERR(handle, "unable to expand role set"); goto err; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ssm...@us...> - 2008-06-06 14:43:24
|
Revision: 2899 http://selinux.svn.sourceforge.net/selinux/?rev=2899&view=rev Author: ssmalley Date: 2008-06-06 07:43:16 -0700 (Fri, 06 Jun 2008) Log Message: ----------- updated checkpolicy to version 1.34.6 Modified Paths: -------------- branches/stable/1_0/checkpolicy/ChangeLog branches/stable/1_0/checkpolicy/VERSION Modified: branches/stable/1_0/checkpolicy/ChangeLog =================================================================== --- branches/stable/1_0/checkpolicy/ChangeLog 2008-06-06 14:41:13 UTC (rev 2898) +++ branches/stable/1_0/checkpolicy/ChangeLog 2008-06-06 14:43:16 UTC (rev 2899) @@ -1,3 +1,7 @@ +1.34.6 2008-06-06 + * Merged r2665 and r2878 from trunk: make ipv4 address parsing like ipv6 from James Carter. + In combination with the libsepol fix, this fixes network node address handling by checkpolicy on big endian platforms. + 1.34.5 2008-03-04 * Merged r2831 from trunk: fix uninitialized use of handle in struct policy_file from Todd Miller. Modified: branches/stable/1_0/checkpolicy/VERSION =================================================================== --- branches/stable/1_0/checkpolicy/VERSION 2008-06-06 14:41:13 UTC (rev 2898) +++ branches/stable/1_0/checkpolicy/VERSION 2008-06-06 14:43:16 UTC (rev 2899) @@ -1 +1 @@ -1.34.5 +1.34.6 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ssm...@us...> - 2008-06-06 14:41:27
|
Revision: 2898 http://selinux.svn.sourceforge.net/selinux/?rev=2898&view=rev Author: ssmalley Date: 2008-06-06 07:41:13 -0700 (Fri, 06 Jun 2008) Log Message: ----------- applied r2877:2878 from trunk Modified Paths: -------------- branches/stable/1_0/checkpolicy/policy_parse.y Modified: branches/stable/1_0/checkpolicy/policy_parse.y =================================================================== --- branches/stable/1_0/checkpolicy/policy_parse.y 2008-06-06 14:39:52 UTC (rev 2897) +++ branches/stable/1_0/checkpolicy/policy_parse.y 2008-06-06 14:41:13 UTC (rev 2898) @@ -777,6 +777,7 @@ ; version_identifier : VERSION_IDENTIFIER { if (insert_id(yytext,0)) return -1; } + | ipv4_addr_def /* version can look like ipv4 address */ ; avrules_block : avrule_decls avrule_user_defs ; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ssm...@us...> - 2008-06-06 14:39:54
|
Revision: 2897 http://selinux.svn.sourceforge.net/selinux/?rev=2897&view=rev Author: ssmalley Date: 2008-06-06 07:39:52 -0700 (Fri, 06 Jun 2008) Log Message: ----------- applied r2664:2665 from trunk Modified Paths: -------------- branches/stable/1_0/checkpolicy/policy_parse.y branches/stable/1_0/checkpolicy/policy_scan.l Modified: branches/stable/1_0/checkpolicy/policy_parse.y =================================================================== --- branches/stable/1_0/checkpolicy/policy_parse.y 2008-06-06 14:37:00 UTC (rev 2896) +++ branches/stable/1_0/checkpolicy/policy_parse.y 2008-06-06 14:39:52 UTC (rev 2897) @@ -121,7 +121,7 @@ static int define_fs_context(unsigned int major, unsigned int minor); static int define_port_context(unsigned int low, unsigned int high); static int define_netif_context(void); -static int define_ipv4_node_context(unsigned int addr, unsigned int mask); +static int define_ipv4_node_context(void); static int define_ipv6_node_context(void); typedef int (* require_func_t)(); @@ -194,6 +194,7 @@ %token NUMBER %token EQUALS %token NOTEQUAL +%token IPV4_ADDR %token IPV6_ADDR %token MODULE VERSION_IDENTIFIER REQUIRE OPTIONAL @@ -653,7 +654,7 @@ | node_contexts node_context_def ; node_context_def : NODECON ipv4_addr_def ipv4_addr_def security_context_def - {if (define_ipv4_node_context($2,$3)) return -1;} + {if (define_ipv4_node_context()) return -1;} | NODECON ipv6_addr ipv6_addr security_context_def {if (define_ipv6_node_context()) return -1;} ; @@ -683,18 +684,9 @@ | GENFSCON identifier path security_context_def {if (define_genfs_context(0)) return -1;} ; -ipv4_addr_def : number '.' number '.' number '.' number - { - unsigned int addr; - unsigned char *p = ((unsigned char *)&addr); - - p[0] = $1 & 0xff; - p[1] = $3 & 0xff; - p[2] = $5 & 0xff; - p[3] = $7 & 0xff; - $$ = addr; - } - ; +ipv4_addr_def : IPV4_ADDR + { if (insert_id(yytext,0)) return -1; } + ; security_context_def : identifier ':' identifier ':' identifier opt_mls_range_def ; opt_mls_range_def : ':' mls_range_def @@ -4183,27 +4175,63 @@ return 0; } -static int define_ipv4_node_context(unsigned int addr, unsigned int mask) -{ +static int define_ipv4_node_context() +{ + char *id; + int rc = 0; + struct in_addr addr, mask; ocontext_t *newc, *c, *l, *head; if (pass == 1) { + free(queue_remove(id_queue)); + free(queue_remove(id_queue)); parse_security_context(NULL); - if (mlspol) - free(queue_remove(id_queue)); - return 0; + goto out; } + id = queue_remove(id_queue); + if (!id) { + yyerror("failed to read ipv4 address"); + rc = -1; + goto out; + } + + rc = inet_pton(AF_INET, id, &addr); + free(id); + if (rc < 1) { + yyerror("failed to parse ipv4 address"); + if (rc == 0) + rc = -1; + goto out; + } + + id = queue_remove(id_queue); + if (!id) { + yyerror("failed to read ipv4 address"); + rc = -1; + goto out; + } + + rc = inet_pton(AF_INET, id, &mask); + free(id); + if (rc < 1) { + yyerror("failed to parse ipv4 mask"); + if (rc == 0) + rc = -1; + goto out; + } + newc = malloc(sizeof(ocontext_t)); if (!newc) { yyerror("out of memory"); - return -1; + rc = -1; + goto out; } + memset(newc, 0, sizeof(ocontext_t)); + newc->u.node.addr = addr.s_addr; + newc->u.node.mask = mask.s_addr; - newc->u.node.addr = addr; - newc->u.node.mask = mask; - if (parse_security_context(&newc->context[0])) { free(newc); return -1; @@ -4223,8 +4251,9 @@ l->next = newc; else policydbp->ocontexts[OCON_NODE] = newc; - - return 0; + rc = 0; +out: + return rc; } static int define_ipv6_node_context(void) Modified: branches/stable/1_0/checkpolicy/policy_scan.l =================================================================== --- branches/stable/1_0/checkpolicy/policy_scan.l 2008-06-06 14:37:00 UTC (rev 2896) +++ branches/stable/1_0/checkpolicy/policy_scan.l 2008-06-06 14:39:52 UTC (rev 2897) @@ -31,7 +31,6 @@ static char linebuf[2][255]; static unsigned int lno = 0; int yywarn(char *msg); -static int is_valid_identifier(char *id); char source_file[255]; unsigned long source_lineno = 1; @@ -46,8 +45,8 @@ %array letter [A-Za-z] digit [0-9] +alnum [a-zA-Z0-9] hexval [0-9A-Fa-f] -version [0-9]+(\.[A-Za-z0-9_.]*)? %% \n.* { strncpy(linebuf[lno], yytext+1, 255); @@ -199,17 +198,14 @@ H1 { return(H1); } h2 | H2 { return(H2); } -"/"({letter}|{digit}|_|"."|"-"|"/")* { return(PATH); } -{letter}({letter}|{digit}|_|"."|"-")* { if (is_valid_identifier(yytext)) - return(IDENTIFIER); - else - REJECT; - } -{digit}{digit}* { return(NUMBER); } -{hexval}{0,4}":"{hexval}{0,4}":"({hexval}|":"|".")* { return(IPV6_ADDR); } -{version}/([ \t\f]*;) { return(VERSION_IDENTIFIER); } +"/"({alnum}|[_.-/])* { return(PATH); } +{letter}({alnum}|[_-])*([.]?({alnum}|[_-]))* { return(IDENTIFIER); } +{digit}+ { return(NUMBER); } +{digit}{1,3}(\.{digit}{1,3}){3} { return(IPV4_ADDR); } +{hexval}{0,4}":"{hexval}{0,4}":"({hexval}|[:.])* { return(IPV6_ADDR); } +{digit}+(\.({alnum}|[_.])*)? { return(VERSION_IDENTIFIER); } #line[ ]1[ ]\"[^\n]*\" { source_lineno = 1; strncpy(source_file, yytext+9, 255); source_file[strlen(source_file)-1] = '\0'; } -#line[ ]{digit}{digit}* { source_lineno = atoi(yytext+6)-1; } +#line[ ]{digit}+ { source_lineno = atoi(yytext+6)-1; } #[^\n]* { /* delete comments */ } [ \t\f]+ { /* delete whitespace */ } "==" { return(EQUALS); } @@ -263,17 +259,3 @@ linebuf[0], linebuf[1]); return 0; } - -static int is_valid_identifier(char *id) { - if ((strrchr(id, '.')) != NULL) { - if (strstr(id, "..") != NULL) { - /* identifier has consecutive '.' */ - return 0; - } - if (id[strlen(id) - 1] == '.') { - /* identifier ends in '.' */ - return 0; - } - } - return 1; -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ssm...@us...> - 2008-06-06 14:37:02
|
Revision: 2896 http://selinux.svn.sourceforge.net/selinux/?rev=2896&view=rev Author: ssmalley Date: 2008-06-06 07:37:00 -0700 (Fri, 06 Jun 2008) Log Message: ----------- updated libsepol to version 1.16.13 Modified Paths: -------------- branches/stable/1_0/libsepol/ChangeLog branches/stable/1_0/libsepol/VERSION Modified: branches/stable/1_0/libsepol/ChangeLog =================================================================== --- branches/stable/1_0/libsepol/ChangeLog 2008-06-06 14:36:10 UTC (rev 2895) +++ branches/stable/1_0/libsepol/ChangeLog 2008-06-06 14:37:00 UTC (rev 2896) @@ -1,3 +1,8 @@ +1.16.13 2008-06-06 + * Fix endianness bug in the handling of network node addresses from Stephen Smalley. + Only affects big endian platforms. + Bug reported by John Weeks of Sun upon policy mismatch between x86 and sparc. + 1.16.12 2008-03-04 * Merge r2831 from trunk: fix uninitialized use of handle in struct policy_file from Todd Miller. Modified: branches/stable/1_0/libsepol/VERSION =================================================================== --- branches/stable/1_0/libsepol/VERSION 2008-06-06 14:36:10 UTC (rev 2895) +++ branches/stable/1_0/libsepol/VERSION 2008-06-06 14:37:00 UTC (rev 2896) @@ -1 +1 @@ -1.16.12 +1.16.13 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ssm...@us...> - 2008-06-06 14:36:13
|
Revision: 2895 http://selinux.svn.sourceforge.net/selinux/?rev=2895&view=rev Author: ssmalley Date: 2008-06-06 07:36:10 -0700 (Fri, 06 Jun 2008) Log Message: ----------- Author: Stephen Smalley Email: sd...@ty... Subject: libsepol: fix endianness bug in network node address handling Date: Thu, 05 Jun 2008 09:45:33 -0400 Fix an endianness bug in the handling of network node addresses by SELinux. This yields no change on little endian hardware but fixes the incorrect handling on big endian hardware. The network node addresses are stored in network order in memory by checkpolicy, not in cpu/host order, and thus should not have cpu_to_le32/le32_to_cpu conversions applied upon policy write/read unlike other data in the policy. Note that checkpolicy was also broken in its handling of ipv4 addresses on big endian hardware prior to checkpolicy 2.0.5 when the ipv4 address handling was changed to be more like the ipv6 address handling. Bug reported by John Weeks of Sun, who noticed that binary policy files built from the same policy source on x86 and sparc differed and tracked it down to the ipv4 address handling in checkpolicy. Signed-off-by: Stephen Smalley <sd...@ty...> Modified Paths: -------------- branches/stable/1_0/libsepol/include/sepol/policydb/policydb.h branches/stable/1_0/libsepol/src/policydb.c branches/stable/1_0/libsepol/src/write.c Modified: branches/stable/1_0/libsepol/include/sepol/policydb/policydb.h =================================================================== --- branches/stable/1_0/libsepol/include/sepol/policydb/policydb.h 2008-06-06 14:34:40 UTC (rev 2894) +++ branches/stable/1_0/libsepol/include/sepol/policydb/policydb.h 2008-06-06 14:36:10 UTC (rev 2895) @@ -255,12 +255,12 @@ uint16_t high_port; } port; /* TCP or UDP port information */ struct { - uint32_t addr; - uint32_t mask; + uint32_t addr; /* network order */ + uint32_t mask; /* network order */ } node; /* node information */ struct { - uint32_t addr[4]; - uint32_t mask[4]; + uint32_t addr[4]; /* network order */ + uint32_t mask[4]; /* network order */ } node6; /* IPv6 node information */ } u; union { Modified: branches/stable/1_0/libsepol/src/policydb.c =================================================================== --- branches/stable/1_0/libsepol/src/policydb.c 2008-06-06 14:34:40 UTC (rev 2894) +++ branches/stable/1_0/libsepol/src/policydb.c 2008-06-06 14:36:10 UTC (rev 2895) @@ -2065,8 +2065,8 @@ rc = next_entry(buf, fp, sizeof(uint32_t) * 2); if (rc < 0) return -1; - c->u.node.addr = le32_to_cpu(buf[0]); - c->u.node.mask = le32_to_cpu(buf[1]); + c->u.node.addr = buf[0]; /* network order */ + c->u.node.mask = buf[1]; /* network order */ if (context_read_and_validate (&c->context[0], p, fp)) return -1; @@ -2096,11 +2096,9 @@ if (rc < 0) return -1; for (k = 0; k < 4; k++) - c->u.node6.addr[k] = - le32_to_cpu(buf[k]); + c->u.node6.addr[k] = buf[k]; /* network order */ for (k = 0; k < 4; k++) - c->u.node6.mask[k] = - le32_to_cpu(buf[k + 4]); + c->u.node6.mask[k] = buf[k + 4]; /* network order */ if (context_read_and_validate (&c->context[0], p, fp)) return -1; Modified: branches/stable/1_0/libsepol/src/write.c =================================================================== --- branches/stable/1_0/libsepol/src/write.c 2008-06-06 14:34:40 UTC (rev 2894) +++ branches/stable/1_0/libsepol/src/write.c 2008-06-06 14:36:10 UTC (rev 2895) @@ -1090,8 +1090,8 @@ return POLICYDB_ERROR; break; case OCON_NODE: - buf[0] = cpu_to_le32(c->u.node.addr); - buf[1] = cpu_to_le32(c->u.node.mask); + buf[0] = c->u.node.addr; /* network order */ + buf[1] = c->u.node.mask; /* network order */ items = put_entry(buf, sizeof(uint32_t), 2, fp); if (items != 2) return POLICYDB_ERROR; @@ -1113,11 +1113,9 @@ break; case OCON_NODE6: for (j = 0; j < 4; j++) - buf[j] = - cpu_to_le32(c->u.node6.addr[j]); + buf[j] = c->u.node6.addr[j]; /* network order */ for (j = 0; j < 4; j++) - buf[j + 4] = - cpu_to_le32(c->u.node6.mask[j]); + buf[j + 4] = c->u.node6.mask[j]; /* network order */ items = put_entry(buf, sizeof(uint32_t), 8, fp); if (items != 8) return POLICYDB_ERROR; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ssm...@us...> - 2008-06-06 14:34:46
|
Revision: 2894 http://selinux.svn.sourceforge.net/selinux/?rev=2894&view=rev Author: ssmalley Date: 2008-06-06 07:34:40 -0700 (Fri, 06 Jun 2008) Log Message: ----------- updated policycoreutils to version 1.34.16 Modified Paths: -------------- branches/stable/1_0/policycoreutils/ChangeLog branches/stable/1_0/policycoreutils/VERSION Modified: branches/stable/1_0/policycoreutils/ChangeLog =================================================================== --- branches/stable/1_0/policycoreutils/ChangeLog 2008-06-06 14:33:06 UTC (rev 2893) +++ branches/stable/1_0/policycoreutils/ChangeLog 2008-06-06 14:34:40 UTC (rev 2894) @@ -1,3 +1,6 @@ +1.34.16 2008-06-06 + * Fix genhomedircon to not skip user_u entries from Chris PeBenito. + 1.34.15 2007-12-14 * Update Makefile to not build restorecond if /usr/include/sys/inotify.h is not present Modified: branches/stable/1_0/policycoreutils/VERSION =================================================================== --- branches/stable/1_0/policycoreutils/VERSION 2008-06-06 14:33:06 UTC (rev 2893) +++ branches/stable/1_0/policycoreutils/VERSION 2008-06-06 14:34:40 UTC (rev 2894) @@ -1 +1 @@ -1.34.15 +1.34.16 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ssm...@us...> - 2008-06-06 14:33:12
|
Revision: 2893 http://selinux.svn.sourceforge.net/selinux/?rev=2893&view=rev Author: ssmalley Date: 2008-06-06 07:33:06 -0700 (Fri, 06 Jun 2008) Log Message: ----------- Author: Chris PeBenito Email: peb...@ge... Subject: policycoreutils user_u seuser vs. genhomedircon Date: Wed, 28 May 2008 22:30:57 -0400 In the stable branch, genhomedircon will ignore making home dir contexts for linux users mapped to user_u. For a long time, this was fine since user_u was the default for strict and targeted. With a merged strict-targeted policy, a more targeted-like system will have unconfined_u as the default. If you then try to make a confined user_u user, a set of home directory contexts will not be created. This patch fixes the behavior. I made a cursory look through the trunk C genhomedircon, and did not see this behavior, but someone should probably doublecheck. Acked-by: Stephen Smalley <sd...@ty...> Modified Paths: -------------- branches/stable/1_0/policycoreutils/scripts/genhomedircon Modified: branches/stable/1_0/policycoreutils/scripts/genhomedircon =================================================================== --- branches/stable/1_0/policycoreutils/scripts/genhomedircon 2008-06-06 14:30:55 UTC (rev 2892) +++ branches/stable/1_0/policycoreutils/scripts/genhomedircon 2008-06-06 14:33:06 UTC (rev 2893) @@ -193,7 +193,7 @@ return prefix def adduser(self, udict, user, seuser, prefix): - if seuser == "user_u" or user == "__default__" or user == "system_u": + if user == "__default__" or user == "system_u": return # !!! chooses first prefix in the list to use in the file context !!! try: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ssm...@us...> - 2008-06-06 14:31:05
|
Revision: 2892 http://selinux.svn.sourceforge.net/selinux/?rev=2892&view=rev Author: ssmalley Date: 2008-06-06 07:30:55 -0700 (Fri, 06 Jun 2008) Log Message: ----------- updated libsepol to version 2.0.30 Modified Paths: -------------- trunk/libsepol/ChangeLog trunk/libsepol/VERSION Modified: trunk/libsepol/ChangeLog =================================================================== --- trunk/libsepol/ChangeLog 2008-06-06 14:29:09 UTC (rev 2891) +++ trunk/libsepol/ChangeLog 2008-06-06 14:30:55 UTC (rev 2892) @@ -1,3 +1,8 @@ +2.0.30 2008-06-06 + * Fix endianness bug in the handling of network node addresses from Stephen Smalley. + Only affects big endian platforms. + Bug reported by John Weeks of Sun upon policy mismatch between x86 and sparc. + 2.0.29 2008-05-27 * Merge user and role mapping support from Joshua Brindle. Modified: trunk/libsepol/VERSION =================================================================== --- trunk/libsepol/VERSION 2008-06-06 14:29:09 UTC (rev 2891) +++ trunk/libsepol/VERSION 2008-06-06 14:30:55 UTC (rev 2892) @@ -1 +1 @@ -2.0.29 +2.0.30 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ssm...@us...> - 2008-06-06 14:29:12
|
Revision: 2891 http://selinux.svn.sourceforge.net/selinux/?rev=2891&view=rev Author: ssmalley Date: 2008-06-06 07:29:09 -0700 (Fri, 06 Jun 2008) Log Message: ----------- Author: Stephen Smalley Email: sd...@ty... Subject: libsepol: fix endianness bug in network node address handling Date: Thu, 05 Jun 2008 09:45:33 -0400 Fix an endianness bug in the handling of network node addresses by SELinux. This yields no change on little endian hardware but fixes the incorrect handling on big endian hardware. The network node addresses are stored in network order in memory by checkpolicy, not in cpu/host order, and thus should not have cpu_to_le32/le32_to_cpu conversions applied upon policy write/read unlike other data in the policy. Note that checkpolicy was also broken in its handling of ipv4 addresses on big endian hardware prior to checkpolicy 2.0.5 when the ipv4 address handling was changed to be more like the ipv6 address handling. Bug reported by John Weeks of Sun, who noticed that binary policy files built from the same policy source on x86 and sparc differed and tracked it down to the ipv4 address handling in checkpolicy. Signed-off-by: Stephen Smalley <sd...@ty...> Modified Paths: -------------- trunk/libsepol/include/sepol/policydb/policydb.h trunk/libsepol/src/policydb.c trunk/libsepol/src/write.c Modified: trunk/libsepol/include/sepol/policydb/policydb.h =================================================================== --- trunk/libsepol/include/sepol/policydb/policydb.h 2008-05-27 20:15:09 UTC (rev 2890) +++ trunk/libsepol/include/sepol/policydb/policydb.h 2008-06-06 14:29:09 UTC (rev 2891) @@ -257,12 +257,12 @@ uint16_t high_port; } port; /* TCP or UDP port information */ struct { - uint32_t addr; - uint32_t mask; + uint32_t addr; /* network order */ + uint32_t mask; /* network order */ } node; /* node information */ struct { - uint32_t addr[4]; - uint32_t mask[4]; + uint32_t addr[4]; /* network order */ + uint32_t mask[4]; /* network order */ } node6; /* IPv6 node information */ } u; union { Modified: trunk/libsepol/src/policydb.c =================================================================== --- trunk/libsepol/src/policydb.c 2008-05-27 20:15:09 UTC (rev 2890) +++ trunk/libsepol/src/policydb.c 2008-06-06 14:29:09 UTC (rev 2891) @@ -2114,8 +2114,8 @@ rc = next_entry(buf, fp, sizeof(uint32_t) * 2); if (rc < 0) return -1; - c->u.node.addr = le32_to_cpu(buf[0]); - c->u.node.mask = le32_to_cpu(buf[1]); + c->u.node.addr = buf[0]; /* network order */ + c->u.node.mask = buf[1]; /* network order */ if (context_read_and_validate (&c->context[0], p, fp)) return -1; @@ -2145,11 +2145,9 @@ if (rc < 0) return -1; for (k = 0; k < 4; k++) - c->u.node6.addr[k] = - le32_to_cpu(buf[k]); + c->u.node6.addr[k] = buf[k]; /* network order */ for (k = 0; k < 4; k++) - c->u.node6.mask[k] = - le32_to_cpu(buf[k + 4]); + c->u.node6.mask[k] = buf[k + 4]; /* network order */ if (context_read_and_validate (&c->context[0], p, fp)) return -1; Modified: trunk/libsepol/src/write.c =================================================================== --- trunk/libsepol/src/write.c 2008-05-27 20:15:09 UTC (rev 2890) +++ trunk/libsepol/src/write.c 2008-06-06 14:29:09 UTC (rev 2891) @@ -1097,8 +1097,8 @@ return POLICYDB_ERROR; break; case OCON_NODE: - buf[0] = cpu_to_le32(c->u.node.addr); - buf[1] = cpu_to_le32(c->u.node.mask); + buf[0] = c->u.node.addr; /* network order */ + buf[1] = c->u.node.mask; /* network order */ items = put_entry(buf, sizeof(uint32_t), 2, fp); if (items != 2) return POLICYDB_ERROR; @@ -1120,11 +1120,9 @@ break; case OCON_NODE6: for (j = 0; j < 4; j++) - buf[j] = - cpu_to_le32(c->u.node6.addr[j]); + buf[j] = c->u.node6.addr[j]; /* network order */ for (j = 0; j < 4; j++) - buf[j + 4] = - cpu_to_le32(c->u.node6.mask[j]); + buf[j + 4] = c->u.node6.mask[j]; /* network order */ items = put_entry(buf, sizeof(uint32_t), 8, fp); if (items != 8) return POLICYDB_ERROR; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ssm...@us...> - 2008-05-27 20:15:14
|
Revision: 2890 http://selinux.svn.sourceforge.net/selinux/?rev=2890&view=rev Author: ssmalley Date: 2008-05-27 13:15:09 -0700 (Tue, 27 May 2008) Log Message: ----------- Make sure that error is only ever 0 or 1. Modified Paths: -------------- trunk/libselinux/utils/matchpathcon.c Modified: trunk/libselinux/utils/matchpathcon.c =================================================================== --- trunk/libselinux/utils/matchpathcon.c 2008-05-27 20:07:32 UTC (rev 2889) +++ trunk/libselinux/utils/matchpathcon.c 2008-05-27 20:15:09 UTC (rev 2890) @@ -116,7 +116,7 @@ } else { security_context_t con; int rc; - error++; + error = 1; if (notrans) rc = lgetfilecon_raw(argv[i], &con); else @@ -135,7 +135,7 @@ } } } else { - error += printmatchpathcon(argv[i], header, mode); + error |= printmatchpathcon(argv[i], header, mode); } } matchpathcon_fini(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ssm...@us...> - 2008-05-27 20:07:33
|
Revision: 2889 http://selinux.svn.sourceforge.net/selinux/?rev=2889&view=rev Author: ssmalley Date: 2008-05-27 13:07:32 -0700 (Tue, 27 May 2008) Log Message: ----------- updated checkpolicy to version 2.0.16 Modified Paths: -------------- trunk/checkpolicy/ChangeLog trunk/checkpolicy/VERSION Modified: trunk/checkpolicy/ChangeLog =================================================================== --- trunk/checkpolicy/ChangeLog 2008-05-27 20:06:51 UTC (rev 2888) +++ trunk/checkpolicy/ChangeLog 2008-05-27 20:07:32 UTC (rev 2889) @@ -1,3 +1,6 @@ +2.0.16 2008-05-27 + * Update checkpolicy for user and role mapping support from Joshua Brindle. + 2.0.15 2008-05-05 * Fix for policy module versions that look like IPv4 addresses from Jim Carter. Resolves bug 444451. Modified: trunk/checkpolicy/VERSION =================================================================== --- trunk/checkpolicy/VERSION 2008-05-27 20:06:51 UTC (rev 2888) +++ trunk/checkpolicy/VERSION 2008-05-27 20:07:32 UTC (rev 2889) @@ -1 +1 @@ -2.0.15 +2.0.16 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ssm...@us...> - 2008-05-27 20:06:53
|
Revision: 2888 http://selinux.svn.sourceforge.net/selinux/?rev=2888&view=rev Author: ssmalley Date: 2008-05-27 13:06:51 -0700 (Tue, 27 May 2008) Log Message: ----------- updated libsepol to version 2.0.29 Modified Paths: -------------- trunk/libsepol/ChangeLog trunk/libsepol/VERSION Modified: trunk/libsepol/ChangeLog =================================================================== --- trunk/libsepol/ChangeLog 2008-05-27 20:06:24 UTC (rev 2887) +++ trunk/libsepol/ChangeLog 2008-05-27 20:06:51 UTC (rev 2888) @@ -1,3 +1,6 @@ +2.0.29 2008-05-27 + * Merge user and role mapping support from Joshua Brindle. + 2.0.28 2008-05-05 * Fix mls_level_convert() to gracefully handle an empty user declaration/require from Stephen Smalley. Modified: trunk/libsepol/VERSION =================================================================== --- trunk/libsepol/VERSION 2008-05-27 20:06:24 UTC (rev 2887) +++ trunk/libsepol/VERSION 2008-05-27 20:06:51 UTC (rev 2888) @@ -1 +1 @@ -2.0.28 +2.0.29 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ssm...@us...> - 2008-05-27 20:06:26
|
Revision: 2887 http://selinux.svn.sourceforge.net/selinux/?rev=2887&view=rev Author: ssmalley Date: 2008-05-27 13:06:24 -0700 (Tue, 27 May 2008) Log Message: ----------- Remove nonsensical tests of !(&...\.node) - they are always false. Modified Paths: -------------- trunk/libsepol/src/expand.c Modified: trunk/libsepol/src/expand.c =================================================================== --- trunk/libsepol/src/expand.c 2008-05-27 20:03:37 UTC (rev 2886) +++ trunk/libsepol/src/expand.c 2008-05-27 20:06:24 UTC (rev 2887) @@ -544,9 +544,6 @@ role_datum_t *role = (role_datum_t *) datum; expand_state_t *state = (expand_state_t *) data; - if (!(&role->dominates.node)) - return 0; - if (map_ebitmap(&role->dominates, &mapped_roles, state->rolemap)) return -1; @@ -619,11 +616,6 @@ } } - if (!(&new_role->dominates.node)) { - ebitmap_init(&new_role->dominates); - } - - /* The dominates bitmap is going to be wrong for the moment, * we'll come back later and remap them, after we are sure all * the roles have been added */ @@ -642,10 +634,6 @@ return -1; } - if (!(&new_role->types.types.node)) { - ebitmap_init(&new_role->types.types); - } - if (ebitmap_union(&new_role->types.types, &tmp_union_types)) { ERR(state->handle, "Out of memory!"); ebitmap_destroy(&tmp_union_types); @@ -820,10 +808,6 @@ return -1; } - if (!(&new_user->roles.roles.node)) { - ebitmap_init(&new_user->roles.roles); - } - if (ebitmap_union(&new_user->roles.roles, &tmp_union)) { ERR(state->handle, "Out of memory!"); ebitmap_destroy(&tmp_union); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ssm...@us...> - 2008-05-27 20:03:41
|
Revision: 2886 http://selinux.svn.sourceforge.net/selinux/?rev=2886&view=rev Author: ssmalley Date: 2008-05-27 13:03:37 -0700 (Tue, 27 May 2008) Log Message: ----------- Author: Joshua Brindle Email: me...@ma... Subject: user and role remapping in expander (was Re: roles in base module) Date: Sat, 24 May 2008 22:24:27 -0400 Stephen Smalley wrote: > On Mon, 2008-05-19 at 17:59 -0400, Joshua Brindle wrote: >> Stephen Smalley wrote: >>> On Fri, 2008-05-16 at 19:50 -0400, Joshua Brindle wrote: >>>> Stephen Smalley wrote: >>>>> On Tue, 2008-05-06 at 23:21 +0100, Martin Orr wrote: >>>>>> Should I be able to build trunk refpolicy with the user roles included in >>>>>> the base module? I can build it with the roles as modules, but if I try >>>>>> building them into base I get >>>>>> /usr/bin/checkmodule -M base.conf -o tmp/base.mod >>>>>> /usr/bin/checkmodule: loading policy configuration from base.conf >>>>>> libsepol.expand_module: Error while indexing out symbols >>>>>> /usr/bin/checkmodule: expand module failed >>>>>> >>>>>> I have refpolicy revision 2669, libsepol 2.0.25, checkpolicy 2.0.12. I have >>>>>> attached the modules.conf I am using, which seems to be the minimum number >>>>>> of things I need to build in to be able to build in roles. >>>>> Reproduced here as well, and naturally one should be able to build roles >>>>> into base. >>>>> >>>>> We've seen this error condition in the past - it indicates that there is >>>>> a hole in the symbol table, and requires mapping support in the expand >>>>> code for roles to correctly handle it. So that represents a >>>>> bug/limitation of the current policy compiler. >>>>> >>>>> Walking through it I see that it is omitting the auditadm_r and secadm_r >>>>> roles during the expand, and this is leaving the holes in the symbol >>>>> table. >>>>> >>>>> Fixing the compiler requires adding mapping support for the roles >>>>> similar to what Karl did for booleans in r2308. >>>>> >>>>> Hopefully though Chris can work around it in the policy in the interim. >>>>> >>>> Patch below should fix both user and role mapping issues. >>> Why is it that we don't need a usermap too? >>> >> Updated patch includes usermap and mapping in constraint_node_clone, completely untested. > > Still fails in the same way as reported by Martin upon semodule -b of the base module. > libsepol.context_read_and_validate: invalid security context > libsepol.sepol_set_policydb_from_file: can't read binary policy: Success > Error reading policy /etc/selinux/test/policy/policy.23: Success > libsemanage.semanage_install_active: setfiles returned error code 1. > > Also fails upon just trying to semodule -B an existing valid policy > store using the patched libsepol. > Ok, the following patch should address everything, it was more intrusive than I originally thought. role->dominates will be incorrect when roles are copied and mapped from base into out policy, this is fixed after they've all been copied. There is a tiny hack concerning object_r, at some point I'd like to address all the object_r hardcoding (both in the kernel and toolchain) but that is pretty low on the list. expand_module_avrules() which is used by external apps (eg., setools) has changed so those users will need to be fixed. valgrind and sediff are clean ------ Revision Links: -------------- http://selinux.svn.sourceforge.net/selinux/?rev=2669&view=rev Modified Paths: -------------- trunk/checkpolicy/policy_define.c trunk/libsepol/include/sepol/policydb/expand.h trunk/libsepol/src/expand.c trunk/libsepol/src/policydb.c trunk/libsepol/src/users.c Modified: trunk/checkpolicy/policy_define.c =================================================================== --- trunk/checkpolicy/policy_define.c 2008-05-27 19:59:02 UTC (rev 2885) +++ trunk/checkpolicy/policy_define.c 2008-05-27 20:03:37 UTC (rev 2886) @@ -2006,7 +2006,7 @@ } /* This ebitmap business is just to ensure that there are not conflicting role_trans rules */ - if (role_set_expand(&roles, &e_roles, policydbp)) + if (role_set_expand(&roles, &e_roles, policydbp, NULL)) goto bad; if (type_set_expand(&types, &e_types, policydbp, 1)) Modified: trunk/libsepol/include/sepol/policydb/expand.h =================================================================== --- trunk/libsepol/include/sepol/policydb/expand.h 2008-05-27 19:59:02 UTC (rev 2885) +++ trunk/libsepol/include/sepol/policydb/expand.h 2008-05-27 20:03:37 UTC (rev 2886) @@ -43,6 +43,7 @@ */ extern int expand_module_avrules(sepol_handle_t * handle, policydb_t * base, policydb_t * out, uint32_t * typemap, uint32_t * boolmap, + uint32_t * rolemap, uint32_t * usermap, int verbose, int expand_neverallow); /* * Expand all parts of a module. Neverallow rules are not expanded (only @@ -59,7 +60,7 @@ unsigned char alwaysexpand); extern int type_set_expand(type_set_t * set, ebitmap_t * t, policydb_t * p, unsigned char alwaysexpand); -extern int role_set_expand(role_set_t * x, ebitmap_t * r, policydb_t * p); +extern int role_set_expand(role_set_t * x, ebitmap_t * r, policydb_t * p, uint32_t * rolemap); extern int mls_semantic_level_expand(mls_semantic_level_t *sl, mls_level_t *l, policydb_t *p, sepol_handle_t *h); extern int mls_semantic_range_expand(mls_semantic_range_t *sr, mls_range_t *r, Modified: trunk/libsepol/src/expand.c =================================================================== --- trunk/libsepol/src/expand.c 2008-05-27 19:59:02 UTC (rev 2885) +++ trunk/libsepol/src/expand.c 2008-05-27 20:03:37 UTC (rev 2886) @@ -41,6 +41,8 @@ int verbose; uint32_t *typemap; uint32_t *boolmap; + uint32_t *rolemap; + uint32_t *usermap; policydb_t *base; policydb_t *out; sepol_handle_t *handle; @@ -52,6 +54,23 @@ memset(state, 0, sizeof(expand_state_t)); } +static int map_ebitmap(ebitmap_t * src, ebitmap_t * dst, uint32_t * map) +{ + unsigned int i; + ebitmap_node_t *tnode; + ebitmap_init(dst); + + ebitmap_for_each_bit(src, tnode, i) { + if (!ebitmap_node_get_bit(tnode, i)) + continue; + if (!map[i]) + continue; + if (ebitmap_set_bit(dst, map[i] - 1, 1)) + return -1; + } + return 0; +} + static int type_copy_callback(hashtab_key_t key, hashtab_datum_t datum, void *data) { @@ -150,7 +169,7 @@ ERR(state->handle, "attribute %s vanished!", id); return -1; } - if (convert_type_ebitmap(&type->types, &tmp_union, state->typemap)) { + if (map_ebitmap(&type->types, &tmp_union, state->typemap)) { ERR(state->handle, "out of memory"); return -1; } @@ -297,6 +316,14 @@ names, 1)) { goto out_of_mem; } + } else if (new_expr->attr & CEXPR_ROLE) { + if (map_ebitmap(&expr->names, &new_expr->names, state->rolemap)) { + goto out_of_mem; + } + } else if (new_expr->attr & CEXPR_USER) { + if (map_ebitmap(&expr->names, &new_expr->names, state->usermap)) { + goto out_of_mem; + } } else { /* Other kinds of sets do not. */ if (ebitmap_cpy(&new_expr->names, @@ -511,6 +538,28 @@ return 0; } +static int role_remap_dominates(hashtab_key_t key __attribute__ ((unused)), hashtab_datum_t datum, void *data) +{ + ebitmap_t mapped_roles; + role_datum_t *role = (role_datum_t *) datum; + expand_state_t *state = (expand_state_t *) data; + + if (!(&role->dominates.node)) + return 0; + + if (map_ebitmap(&role->dominates, &mapped_roles, state->rolemap)) + return -1; + + ebitmap_destroy(&role->dominates); + + if (ebitmap_cpy(&role->dominates, &mapped_roles)) + return -1; + + ebitmap_destroy(&mapped_roles); + + return 0; +} + static int role_copy_callback(hashtab_key_t key, hashtab_datum_t datum, void *data) { @@ -525,8 +574,11 @@ role = (role_datum_t *) datum; state = (expand_state_t *) data; - if (strcmp(id, OBJECT_R) == 0) + if (strcmp(id, OBJECT_R) == 0) { + /* object_r is always value 1 */ + state->rolemap[role->s.value - 1] = 1; return 0; + } if (!is_id_enabled(id, state->base, SYM_ROLES)) { /* identifier's scope is not enabled */ @@ -552,8 +604,9 @@ return -1; } - new_role->s.value = role->s.value; state->out->p_roles.nprim++; + new_role->s.value = state->out->p_roles.nprim; + state->rolemap[role->s.value - 1] = new_role->s.value; ret = hashtab_insert(state->out->p_roles.table, (hashtab_key_t) new_id, (hashtab_datum_t) new_role); @@ -570,6 +623,10 @@ ebitmap_init(&new_role->dominates); } + + /* The dominates bitmap is going to be wrong for the moment, + * we'll come back later and remap them, after we are sure all + * the roles have been added */ if (ebitmap_union(&new_role->dominates, &role->dominates)) { ERR(state->handle, "Out of memory!"); return -1; @@ -692,8 +749,9 @@ } memset(new_user, 0, sizeof(user_datum_t)); - new_user->s.value = user->s.value; state->out->p_users.nprim++; + new_user->s.value = state->out->p_users.nprim; + state->usermap[user->s.value - 1] = new_user->s.value; new_id = strdup(id); if (!new_id) { @@ -756,7 +814,7 @@ ebitmap_init(&tmp_union); /* get global roles for this user */ - if (role_set_expand(&user->roles, &tmp_union, state->base)) { + if (role_set_expand(&user->roles, &tmp_union, state->base, state->rolemap)) { ERR(state->handle, "Out of memory!"); ebitmap_destroy(&tmp_union); return -1; @@ -938,14 +996,16 @@ ebitmap_init(&roles); ebitmap_init(&new_roles); - if (role_set_expand(&cur->roles, &roles, state->out)) { + if (role_set_expand(&cur->roles, &roles, state->out, state->rolemap)) { ERR(state->handle, "Out of memory!"); return -1; } - if (role_set_expand(&cur->new_roles, &new_roles, state->out)) { + + if (role_set_expand(&cur->new_roles, &new_roles, state->out, state->rolemap)) { ERR(state->handle, "Out of memory!"); return -1; } + ebitmap_for_each_bit(&roles, snode, i) { if (!ebitmap_node_get_bit(snode, i)) continue; @@ -1005,7 +1065,7 @@ ebitmap_init(&roles); ebitmap_init(&types); - if (role_set_expand(&cur->roles, &roles, state->out)) { + if (role_set_expand(&cur->roles, &roles, state->out, state->rolemap)) { ERR(state->handle, "Out of memory!"); return -1; } @@ -1058,7 +1118,7 @@ memset(n, 0, sizeof(role_trans_t)); n->role = i + 1; n->type = j + 1; - n->new_role = cur->new_role; + n->new_role = state->rolemap[cur->new_role - 1]; if (l) { l->next = n; } else { @@ -1658,8 +1718,8 @@ static int context_copy(context_struct_t * dst, context_struct_t * src, expand_state_t * state) { - dst->user = src->user; - dst->role = src->role; + dst->user = state->usermap[src->user - 1]; + dst->role = state->rolemap[src->role - 1]; dst->type = state->typemap[src->type - 1]; return mls_context_cpy(dst, src); } @@ -1842,23 +1902,6 @@ return 0; } -int convert_type_ebitmap(ebitmap_t * src, ebitmap_t * dst, uint32_t * typemap) -{ - unsigned int i; - ebitmap_node_t *tnode; - ebitmap_init(dst); - - ebitmap_for_each_bit(src, tnode, i) { - if (!ebitmap_node_get_bit(tnode, i)) - continue; - if (!typemap[i]) - continue; - if (ebitmap_set_bit(dst, typemap[i] - 1, 1)) - return -1; - } - return 0; -} - /* converts typeset using typemap and expands into ebitmap_t types using the attributes in the passed in policy. * this should not be called until after all the blocks have been processed and the attributes in target policy * are complete. */ @@ -1870,10 +1913,10 @@ type_set_init(&tmpset); - if (convert_type_ebitmap(&set->types, &tmpset.types, typemap)) + if (map_ebitmap(&set->types, &tmpset.types, typemap)) return -1; - if (convert_type_ebitmap(&set->negset, &tmpset.negset, typemap)) + if (map_ebitmap(&set->negset, &tmpset.negset, typemap)) return -1; tmpset.flags = set->flags; @@ -1915,12 +1958,14 @@ return retval; } -int role_set_expand(role_set_t * x, ebitmap_t * r, policydb_t * p) +int role_set_expand(role_set_t * x, ebitmap_t * r, policydb_t * p, uint32_t * rolemap) { unsigned int i; ebitmap_node_t *rnode; + ebitmap_t mapped_roles; ebitmap_init(r); + ebitmap_init(&mapped_roles); if (x->flags & ROLE_STAR) { for (i = 0; i < p->p_roles.nprim++; i++) @@ -1929,13 +1974,23 @@ return 0; } - ebitmap_for_each_bit(&x->roles, rnode, i) { + if (rolemap) { + if (map_ebitmap(&x->roles, &mapped_roles, rolemap)) + return -1; + } else { + if (ebitmap_cpy(&mapped_roles, &x->roles)) + return -1; + } + + ebitmap_for_each_bit(&mapped_roles, rnode, i) { if (ebitmap_node_get_bit(rnode, i)) { if (ebitmap_set_bit(r, i, 1)) return -1; } } + ebitmap_destroy(&mapped_roles); + /* if role is to be complimented, invert the entire bitmap here */ if (x->flags & ROLE_COMP) { for (i = 0; i < ebitmap_length(r); i++) { @@ -2239,7 +2294,8 @@ */ int expand_module_avrules(sepol_handle_t * handle, policydb_t * base, policydb_t * out, uint32_t * typemap, - uint32_t * boolmap, int verbose, + uint32_t * boolmap, uint32_t * rolemap, + uint32_t * usermap, int verbose, int expand_neverallow) { expand_state_t state; @@ -2250,6 +2306,8 @@ state.out = out; state.typemap = typemap; state.boolmap = boolmap; + state.rolemap = rolemap; + state.usermap = usermap; state.handle = handle; state.verbose = verbose; state.expand_neverallow = expand_neverallow; @@ -2309,6 +2367,18 @@ goto cleanup; } + state.rolemap = (uint32_t *)calloc(state.base->p_roles.nprim, sizeof(uint32_t)); + if (!state.rolemap) { + ERR(handle, "Out of memory!"); + goto cleanup; + } + + state.usermap = (uint32_t *)calloc(state.base->p_users.nprim, sizeof(uint32_t)); + if (!state.usermap) { + ERR(handle, "Out of memory!"); + goto cleanup; + } + /* order is important - types must be first */ /* copy types */ @@ -2405,6 +2475,11 @@ } + /* remap role dominates bitmaps */ + if (hashtab_map(state.out->p_roles.table, role_remap_dominates, &state)) { + goto cleanup; + } + if (copy_and_expand_avrule_block(&state) < 0) { ERR(handle, "Error during expand"); goto cleanup; @@ -2464,6 +2539,8 @@ cleanup: free(state.typemap); free(state.boolmap); + free(state.rolemap); + free(state.usermap); return retval; } Modified: trunk/libsepol/src/policydb.c =================================================================== --- trunk/libsepol/src/policydb.c 2008-05-27 19:59:02 UTC (rev 2885) +++ trunk/libsepol/src/policydb.c 2008-05-27 20:03:37 UTC (rev 2886) @@ -559,7 +559,7 @@ p = (policydb_t *) arg; ebitmap_destroy(&user->cache); - if (role_set_expand(&user->roles, &user->cache, p)) { + if (role_set_expand(&user->roles, &user->cache, p, NULL)) { return -1; } Modified: trunk/libsepol/src/users.c =================================================================== --- trunk/libsepol/src/users.c 2008-05-27 19:59:02 UTC (rev 2885) +++ trunk/libsepol/src/users.c 2008-05-27 20:03:37 UTC (rev 2886) @@ -260,7 +260,7 @@ /* Expand roles */ if (role_set_expand - (&usrdatum->roles, &usrdatum->cache, policydb)) { + (&usrdatum->roles, &usrdatum->cache, policydb, NULL)) { ERR(handle, "unable to expand role set"); goto err; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ssm...@us...> - 2008-05-27 19:59:04
|
Revision: 2885 http://selinux.svn.sourceforge.net/selinux/?rev=2885&view=rev Author: ssmalley Date: 2008-05-27 12:59:02 -0700 (Tue, 27 May 2008) Log Message: ----------- updated libselinux to version 2.0.65 Modified Paths: -------------- trunk/libselinux/ChangeLog trunk/libselinux/VERSION Modified: trunk/libselinux/ChangeLog =================================================================== --- trunk/libselinux/ChangeLog 2008-05-27 19:53:31 UTC (rev 2884) +++ trunk/libselinux/ChangeLog 2008-05-27 19:59:02 UTC (rev 2885) @@ -1,3 +1,7 @@ +2.0.65 2008-05-27 + * Fix selinux_file_context_verify() and selinux_lsetfilecon_default() to call matchpathcon_init_prefix if not already initialized. + * Add -q qualifier for -V option of matchpathcon and change it to indicate whether verification succeeded or failed via exit status. + 2.0.64 2008-04-21 * Fixed selinux_set_callback man page. Modified: trunk/libselinux/VERSION =================================================================== --- trunk/libselinux/VERSION 2008-05-27 19:53:31 UTC (rev 2884) +++ trunk/libselinux/VERSION 2008-05-27 19:59:02 UTC (rev 2885) @@ -1 +1 @@ -2.0.64 +2.0.65 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ssm...@us...> - 2008-05-27 19:53:33
|
Revision: 2884 http://selinux.svn.sourceforge.net/selinux/?rev=2884&view=rev Author: ssmalley Date: 2008-05-27 12:53:31 -0700 (Tue, 27 May 2008) Log Message: ----------- Author: Stephen Smalley Email: sd...@ty... Subject: Is there a command line tool that returns 1 if a file is in the wrong context? Date: Tue, 27 May 2008 11:28:38 -0400 On Sat, 2008-05-24 at 18:58 -0500, Joe Nall wrote: > Is there a command line tool that returns 1 if a file is in the wrong > context?. I want to add a %verifyscript to our rpms to validate the > installed file context when rpm -V is invoked. I was going to suggest matchpathcon -V, except when trying it, I found that there is a bug in the current libselinux that makes it seg fault and it also doesn't return the status but rather displays it. So how about the patch below to fix the bug and make the exit status usable? After this patch, you can run '/usr/sbin/matchpathcon -Vq path1 [path2...]' and check the exit status; 0 will mean that all verified; non-zero will be the count of failures. Modified Paths: -------------- trunk/libselinux/src/matchpathcon.c trunk/libselinux/utils/matchpathcon.c Modified: trunk/libselinux/src/matchpathcon.c =================================================================== --- trunk/libselinux/src/matchpathcon.c 2008-05-16 13:29:32 UTC (rev 2883) +++ trunk/libselinux/src/matchpathcon.c 2008-05-27 19:53:31 UTC (rev 2884) @@ -372,6 +372,9 @@ else return 0; } + + if (!hnd && (matchpathcon_init_prefix(NULL, NULL) < 0)) + return -1; if (selabel_lookup_raw(hnd, &fcontext, path, mode) != 0) { if (errno != ENOENT) @@ -394,6 +397,9 @@ if (lstat(path, &st) != 0) return rc; + if (!hnd && (matchpathcon_init_prefix(NULL, NULL) < 0)) + return -1; + /* If there's an error determining the context, or it has none, return to allow default context */ if (selabel_lookup_raw(hnd, &scontext, path, st.st_mode)) { Modified: trunk/libselinux/utils/matchpathcon.c =================================================================== --- trunk/libselinux/utils/matchpathcon.c 2008-05-16 13:29:32 UTC (rev 2883) +++ trunk/libselinux/utils/matchpathcon.c 2008-05-27 19:53:31 UTC (rev 2884) @@ -12,7 +12,7 @@ void usage(const char *progname) { fprintf(stderr, - "usage: %s [-N] [-n] [-f file_contexts] [-p prefix] [-V] path...\n", + "usage: %s [-N] [-n] [-f file_contexts] [-p prefix] [-Vq] path...\n", progname); exit(1); } @@ -42,11 +42,12 @@ int verify = 0; int notrans = 0; int error = 0; + int quiet = 0; if (argc < 2) usage(argv[0]); - while ((opt = getopt(argc, argv, "Nnf:p:V")) > 0) { + while ((opt = getopt(argc, argv, "Nnf:p:Vq")) > 0) { switch (opt) { case 'n': header = 0; @@ -90,6 +91,9 @@ exit(1); } break; + case 'q': + quiet = 1; + break; default: usage(argv[0]); } @@ -101,11 +105,18 @@ mode = buf.st_mode; if (verify) { + if (quiet) { + if (selinux_file_context_verify(argv[i], 0)) + continue; + else + exit(1); + } if (selinux_file_context_verify(argv[i], 0)) { printf("%s verified.\n", argv[i]); } else { security_context_t con; int rc; + error++; if (notrans) rc = lgetfilecon_raw(argv[i], &con); else @@ -114,15 +125,13 @@ if (rc >= 0) { printf("%s has context %s, should be ", argv[i], con); - error += - printmatchpathcon(argv[i], 0, mode); + printmatchpathcon(argv[i], 0, mode); freecon(con); } else { printf ("actual context unknown: %s, should be ", strerror(errno)); - error += - printmatchpathcon(argv[i], 0, mode); + printmatchpathcon(argv[i], 0, mode); } } } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ssm...@us...> - 2008-05-16 13:29:51
|
Revision: 2883 http://selinux.svn.sourceforge.net/selinux/?rev=2883&view=rev Author: ssmalley Date: 2008-05-16 06:29:32 -0700 (Fri, 16 May 2008) Log Message: ----------- updated policycoreutils to version 2.0.49 Modified Paths: -------------- trunk/policycoreutils/ChangeLog trunk/policycoreutils/VERSION Modified: trunk/policycoreutils/ChangeLog =================================================================== --- trunk/policycoreutils/ChangeLog 2008-05-16 13:28:17 UTC (rev 2882) +++ trunk/policycoreutils/ChangeLog 2008-05-16 13:29:32 UTC (rev 2883) @@ -1,3 +1,6 @@ +2.0.49 2008-05-16 + * Remove security_check_context calls for prefix validation from semanage. + 2.0.48 2008-05-16 * Change setfiles and restorecon to not relabel if the file already has the correct context value even if -F/force is specified. Modified: trunk/policycoreutils/VERSION =================================================================== --- trunk/policycoreutils/VERSION 2008-05-16 13:28:17 UTC (rev 2882) +++ trunk/policycoreutils/VERSION 2008-05-16 13:29:32 UTC (rev 2883) @@ -1 +1 @@ -2.0.48 +2.0.49 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ssm...@us...> - 2008-05-16 13:28:18
|
Revision: 2882 http://selinux.svn.sourceforge.net/selinux/?rev=2882&view=rev Author: ssmalley Date: 2008-05-16 06:28:17 -0700 (Fri, 16 May 2008) Log Message: ----------- Remove the security_check_context() calls to validate prefixes from seobject.py. They were incorrectly checking against the host policy rather than the target policy, and hardcoding policy knowledge. Modified Paths: -------------- trunk/policycoreutils/semanage/seobject.py Modified: trunk/policycoreutils/semanage/seobject.py =================================================================== --- trunk/policycoreutils/semanage/seobject.py 2008-05-16 13:07:58 UTC (rev 2881) +++ trunk/policycoreutils/semanage/seobject.py 2008-05-16 13:28:17 UTC (rev 2882) @@ -509,8 +509,6 @@ rc = semanage_user_set_mlslevel(self.sh, u, selevel) if rc < 0: raise ValueError(_("Could not set MLS level for %s") % name) - if selinux.security_check_context("system_u:object_r:%s_home_t:s0" % prefix) != 0: - raise ValueError(_("Invalid prefix %s") % prefix) rc = semanage_user_set_prefix(self.sh, u, prefix) if rc < 0: raise ValueError(_("Could not add prefix %s for %s") % (r, prefix)) @@ -576,8 +574,6 @@ semanage_user_set_mlslevel(self.sh, u, untranslate(selevel)) if prefix != "": - if selinux.security_check_context("system_u:object_r:%s_home_t" % prefix) != 0: - raise ValueError(_("Invalid prefix %s") % prefix) semanage_user_set_prefix(self.sh, u, prefix) if len(roles) != 0: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ssm...@us...> - 2008-05-16 13:08:08
|
Revision: 2881 http://selinux.svn.sourceforge.net/selinux/?rev=2881&view=rev Author: ssmalley Date: 2008-05-16 06:07:58 -0700 (Fri, 16 May 2008) Log Message: ----------- updated policycoreutils to version 2.0.48 Modified Paths: -------------- trunk/policycoreutils/ChangeLog trunk/policycoreutils/VERSION Modified: trunk/policycoreutils/ChangeLog =================================================================== --- trunk/policycoreutils/ChangeLog 2008-05-16 13:06:26 UTC (rev 2880) +++ trunk/policycoreutils/ChangeLog 2008-05-16 13:07:58 UTC (rev 2881) @@ -1,3 +1,6 @@ +2.0.48 2008-05-16 + * Change setfiles and restorecon to not relabel if the file already has the correct context value even if -F/force is specified. + 2.0.47 2008-04-18 * Update semanage man page for booleans from Dan Walsh. * Add further error checking to seobject.py for setting booleans. Modified: trunk/policycoreutils/VERSION =================================================================== --- trunk/policycoreutils/VERSION 2008-05-16 13:06:26 UTC (rev 2880) +++ trunk/policycoreutils/VERSION 2008-05-16 13:07:58 UTC (rev 2881) @@ -1 +1 @@ -2.0.47 +2.0.48 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ssm...@us...> - 2008-05-16 13:06:33
|
Revision: 2880 http://selinux.svn.sourceforge.net/selinux/?rev=2880&view=rev Author: ssmalley Date: 2008-05-16 06:06:26 -0700 (Fri, 16 May 2008) Log Message: ----------- Author: Stephen Smalley Email: sd...@ty... Subject: livecd-creator + selinux Date: Fri, 16 May 2008 07:57:38 -0400 On Thu, 2008-05-15 at 17:20 -0400, Eric Paris wrote: > On Thu, 2008-05-15 at 16:47 -0400, Stephen Smalley wrote: > > On Thu, 2008-05-15 at 16:33 -0400, Eric Paris wrote: > > > #4 At the end of the rpm transaction when everything is installed it > > > calls restorecon and I get one for (I assume) every file almost all of > > > which look like: > > > > > > /sbin/restorecon reset /srv context system_u:object_r:var_t:s0->system_u:object_r:var_t:s0 > > > > > > Notice nothing changed? Again I assume its my hack of a /selinux which > > > causes it and I'll try to run down why, but maybe someone else sees that > > > quickly. > > > > That suggests it is being called with the -f (force) flag from > > e.g. /sbin/fixfiles. selinux-policy.spec does a > > fixfiles -C file_contexts.pre restore > > > > fixfiles -C does a diff between the old and new file contexts > > configurations and applies restorecon to the result. There is some > > serious magic in there, and it is all Dan's fault ;) > > ok, in the livecd-creator kickstart.py I see > > if os.path.exists(self.path("/sbin/restorecon")): > self.call(["/sbin/restorecon", "-l", "-v", "-r", "-F", "-e", "/proc", "-e", "/sys", "-e", "/dev", "-e", "/selinux", "/"]) > > So there is our -F. Is there a way to get it to fix "user" without > getting it to fix "things that aren't wrong" I think we should change setfiles/restorecon to just not do that even with -F. IIRC, changing it to always invoke setfilecon even if the contexts were the same was motivated by the problem we used to have where the in-core label and the on-disk xattr could get out of sync. Patch below. Note that restorecon is just a link to setfiles that presents a different default user interface and behaviors (ever since I coalesced them). Modified Paths: -------------- trunk/policycoreutils/setfiles/setfiles.c Modified: trunk/policycoreutils/setfiles/setfiles.c =================================================================== --- trunk/policycoreutils/setfiles/setfiles.c 2008-05-05 15:23:37 UTC (rev 2879) +++ trunk/policycoreutils/setfiles/setfiles.c 2008-05-16 13:06:26 UTC (rev 2880) @@ -495,7 +495,7 @@ * specification. */ if ((strcmp(newcon, "<<none>>") == 0) || - (context && (strcmp(context, newcon) == 0) && !force)) { + (context && (strcmp(context, newcon) == 0))) { freecon(context); goto out; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ssm...@us...> - 2008-05-05 15:23:43
|
Revision: 2879 http://selinux.svn.sourceforge.net/selinux/?rev=2879&view=rev Author: ssmalley Date: 2008-05-05 08:23:37 -0700 (Mon, 05 May 2008) Log Message: ----------- updated checkpolicy to version 2.0.15 Modified Paths: -------------- trunk/checkpolicy/ChangeLog trunk/checkpolicy/VERSION Modified: trunk/checkpolicy/ChangeLog =================================================================== --- trunk/checkpolicy/ChangeLog 2008-05-05 15:12:17 UTC (rev 2878) +++ trunk/checkpolicy/ChangeLog 2008-05-05 15:23:37 UTC (rev 2879) @@ -1,3 +1,7 @@ +2.0.15 2008-05-05 + * Fix for policy module versions that look like IPv4 addresses from Jim Carter. + Resolves bug 444451. + 2.0.14 2008-03-24 * Add permissive domain support from Eric Paris. Modified: trunk/checkpolicy/VERSION =================================================================== --- trunk/checkpolicy/VERSION 2008-05-05 15:12:17 UTC (rev 2878) +++ trunk/checkpolicy/VERSION 2008-05-05 15:23:37 UTC (rev 2879) @@ -1 +1 @@ -2.0.14 +2.0.15 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jwc...@us...> - 2008-05-05 15:12:30
|
Revision: 2878 http://selinux.svn.sourceforge.net/selinux/?rev=2878&view=rev Author: jwcarter Date: 2008-05-05 08:12:17 -0700 (Mon, 05 May 2008) Log Message: ----------- Fixes a regression in the policy compilier from when ipv4 parsing was added. This patch expresses the fact that a valid version number can look like an IPv4 address. Modified Paths: -------------- trunk/checkpolicy/policy_parse.y Modified: trunk/checkpolicy/policy_parse.y =================================================================== --- trunk/checkpolicy/policy_parse.y 2008-05-05 14:45:13 UTC (rev 2877) +++ trunk/checkpolicy/policy_parse.y 2008-05-05 15:12:17 UTC (rev 2878) @@ -723,6 +723,7 @@ ; version_identifier : VERSION_IDENTIFIER { if (insert_id(yytext,0)) return -1; } + | ipv4_addr_def /* version can look like ipv4 address */ ; avrules_block : avrule_decls avrule_user_defs ; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ssm...@us...> - 2008-05-05 15:08:44
|
Revision: 2877 http://selinux.svn.sourceforge.net/selinux/?rev=2877&view=rev Author: ssmalley Date: 2008-05-05 07:45:13 -0700 (Mon, 05 May 2008) Log Message: ----------- updated libsepol to version 2.0.28 Modified Paths: -------------- trunk/libsepol/ChangeLog trunk/libsepol/VERSION Modified: trunk/libsepol/ChangeLog =================================================================== --- trunk/libsepol/ChangeLog 2008-05-05 14:44:10 UTC (rev 2876) +++ trunk/libsepol/ChangeLog 2008-05-05 14:45:13 UTC (rev 2877) @@ -1,3 +1,6 @@ +2.0.28 2008-05-05 + * Fix mls_level_convert() to gracefully handle an empty user declaration/require from Stephen Smalley. + 2.0.27 2008-04-18 * Belatedly merge test for policy downgrade from Todd Miller. Modified: trunk/libsepol/VERSION =================================================================== --- trunk/libsepol/VERSION 2008-05-05 14:44:10 UTC (rev 2876) +++ trunk/libsepol/VERSION 2008-05-05 14:45:13 UTC (rev 2877) @@ -1 +1 @@ -2.0.27 +2.0.28 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ssm...@us...> - 2008-05-05 14:44:13
|
Revision: 2876 http://selinux.svn.sourceforge.net/selinux/?rev=2876&view=rev Author: ssmalley Date: 2008-05-05 07:44:10 -0700 (Mon, 05 May 2008) Log Message: ----------- Author: Stephen Smalley Email: sd...@ty... Subject: segfault using dismod when linking modules Date: Fri, 02 May 2008 09:45:12 -0400 On Thu, 2008-05-01 at 16:04 -0400, Eric Paris wrote: > Maybe someone else will know this pretty quickly. I'm attaching a > tiny little base.conf and base.mod and a tiny test.te and test.mod > that I built. When I try to link them together I get a segfault > somewhere through user_fix_callback() -> mls_level_convert() > > Anyway, maybe I'll get to looking at it tomorrow, but if anyone else > who actually understands all of this has a chance to look let me > know.... Looks like mls_level_convert() falls over dead if passed an "empty" user declaration, which appears to happen when you specify a require on it but not a declaration for it in your module, which is what you do in test.te. Patch below will at least fix the symptom - not sure whether it will yield the expected end result though. Modified Paths: -------------- trunk/libsepol/src/link.c Modified: trunk/libsepol/src/link.c =================================================================== --- trunk/libsepol/src/link.c 2008-05-05 14:42:01 UTC (rev 2875) +++ trunk/libsepol/src/link.c 2008-05-05 14:44:10 UTC (rev 2876) @@ -864,6 +864,10 @@ if (!mod->policy->mls) return 0; + /* Required not declared. */ + if (!src->sens) + return 0; + assert(mod->map[SYM_LEVELS][src->sens - 1]); dst->sens = mod->map[SYM_LEVELS][src->sens - 1]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |