libsepol+mls compile failure
Subsystems (2)
I was going to try out MLS, but I get the following compile failure in libsepol:
mls.c: In function `mls_compute_av':
mls.c:36: error: `policydb' undeclared (first use in this function) mls.c:36: error: (Each undeclared identifier is reported only once mls.c:36: error: for each function it appears in.)mls.c: In function `mls_compute_context_len':
mls.c:84: error: policydb' undeclared (first use in this function) mls.c: In function mls_sid_to_context':
mls.c:114: error: policydb' undeclared (first use in this function) mls.c: In function mls_context_to_sid':
mls.c:230: error: `policydb' undeclared (first use in this function)
Signature · 8 lines
Chris PeBenito <[email protected]> Developer, Hardened Gentoo Linux Embedded Gentoo Linux Public Key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xE6AF9243 Key fingerprint = B0E6 877A 883F A57A 8E6A CB00 BC8E E42D E6AF 9243
Quoted 13 lines · Chris PeBenito
I was going to try out MLS, but I get the following compile failure in libsepol:
mls.c: In function `mls_compute_av':
mls.c:36: error: `policydb' undeclared (first use in this function) mls.c:36: error: (Each undeclared identifier is reported only once mls.c:36: error: for each function it appears in.)mls.c: In function `mls_compute_context_len':
mls.c:84: error:policydb' undeclared (first use in this function) mls.c: In functionmls_sid_to_context':
mls.c:114: error:policydb' undeclared (first use in this function) mls.c: In functionmls_context_to_sid':
mls.c:230: error: `policydb' undeclared (first use in this function)
Compile-tested only.
Index: libsepol/include/sepol/mls.h
===================================================================
RCS file: /nfshome/pal/CVS/selinux-usr/libsepol/include/sepol/mls.h,v retrieving revision 1.1
include/sepol/mls.h +17 -12
@@ -15,19 +15,23 @@#ifdef CONFIG_SECURITY_SELINUX_MLS -void mls_compute_av (context_struct_t * scontext, +void mls_compute_av (policydb_t *policydb, +context_struct_t * scontext,context_struct_t * tcontext,class_datum_t * tclass,access_vector_t * allowed); -int mls_compute_context_len (context_struct_t * context); +int mls_compute_context_len (policydb_t *policydb, +context_struct_t * context); -int mls_sid_to_context (context_struct_t * context, +int mls_sid_to_context (policydb_t *policydb, +context_struct_t * context,char **scontext);int mls_context_isvalid (policydb_t *p,context_struct_t * c); -int mls_context_to_sid (char oldc, +int mls_context_to_sid (policydb_t *policydb, +char oldc,char **scontext,context_struct_t * context);
@@ -35,7 +39,8 @@ policydb_t * newp, context_struct_t * context); -int mls_compute_sid(context_struct_t *scontext, +int mls_compute_sid(policydb_t *policydb, + context_struct_t *scontext, context_struct_t *tcontext, security_class_t tclass, uint32_t specified,
@@ -45,8 +50,8 @@int cat_index (hashtab_key_t key,hashtab_datum_t datum,void *datap);int sens_destroy (hashtab_key_t key,hashtab_datum_t datum,void *p);int cat_destroy (hashtab_key_t key,hashtab_datum_t datum,void *p); -int sens_read (policydb_t * p,hashtab_t h,void * fp); -int cat_read (policydb_t * p,hashtab_t h,void * fp); +int sens_read (policydb_t * p,hashtab_t h,struct policy_file *fp); +int cat_read (policydb_t * p,hashtab_t h,struct policy_file *fp);#define mls_for_user_ranges (user, usercon) { \ mls_range_list_t *__ranges; \
@@ -75,13 +80,13 @@#else -#define mls_compute_av (scontext, tcontext, tclass_datum, allowed) -#define mls_compute_context_len (context) 0 -#define mls_sid_to_context (context, scontextpp) +#define mls_compute_av (policydb, scontext, tcontext, tclass_datum, allowed) +#define mls_compute_context_len (policydb, context) 0 +#define mls_sid_to_context (policydb, context, scontextpp)#define mls_context_isvalid (p, c) 1 -#define mls_context_to_sid (oldc, context_str, context) 0 +#define mls_context_to_sid (policydb, oldc, context_str, context) 0#define mls_convert_context (oldp, newp, c) 0 -#define mls_compute_sid (scontext, tcontext, tclass, specified, newcontextp) 0 +#define mls_compute_sid (policydb, scontext, tcontext, tclass, specified, newcontextp) 0#define mls_for_user_ranges (user, usercon) #define mls_end_user_ranges#define mls_symtab_names
Index: libsepol/src/mls.c
===================================================================
RCS file: /nfshome/pal/CVS/selinux-usr/libsepol/src/mls.c,v retrieving revision 1.2
src/mls.c +30 -24
161 lines not on this page · raw message
Index: libsepol/src/services.c
===================================================================
RCS file: /nfshome/pal/CVS/selinux-usr/libsepol/src/services.c,v retrieving revision 1.6
src/services.c +5 -5
@@ -260,7 +260,7 @@/* * Remove any permissions prohibited by the MLS policy. */ -mls_compute_av (scontext, tcontext, tclass_datum, &avd->allowed); +mls_compute_av (policydb, scontext, tcontext, tclass_datum, &avd->allowed);/* * Remove any permissions prohibited by a constraint.
@@ -345,7 +345,7 @@ *scontext_len +=strlen (policydb->p_user_val_to_name[context->user -1 ]) +1 ; *scontext_len +=strlen (policydb->p_role_val_to_name[context->role -1 ]) +1 ; *scontext_len +=strlen (policydb->p_type_val_to_name[context->type -1 ]) +1 ; - *scontext_len +=mls_compute_context_len (context); + *scontext_len +=mls_compute_context_len (policydb, context);/* Allocate space for the context; caller must free this space. */ scontextp =malloc (*scontext_len+1 );
@@ -363,7 +363,7 @@ policydb->p_type_val_to_name[context->type - 1]); scontextp +=strlen (policydb->p_user_val_to_name[context->user -1 ]) +1 +strlen (policydb->p_role_val_to_name[context->role -1 ]) +1 +strlen (policydb->p_type_val_to_name[context->type -1 ]) +1 ; -mls_sid_to_context (context, &scontextp); +mls_sid_to_context (policydb, context, &scontextp); scontextp--; *scontextp =0 ;
@@ -484,7 +484,7 @@ context.type = typdatum->value; - rc =mls_context_to_sid (oldc, &p, &context); + rc =mls_context_to_sid (policydb, oldc, &p, &context);if (rc) goto out;
@@ -664,7 +664,7 @@/* Set the MLS attributes. This is done last because it may allocate memory. */ - rc =mls_compute_sid (scontext, tcontext, tclass, specified, &newcontext); + rc =mls_compute_sid (policydb, scontext, tcontext, tclass, specified, &newcontext);if (rc) goto out;
Signature · 8 lines
Stephen Smalley <[email protected]> National Security Agency -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 4 lines · Stephen Smalley
Quoted 3 lines · Chris PeBenito
I was going to try out MLS, but I get the following compile failure in libsepol:
Quoted 10 lines
Quoted 10 lines
mls.c: In function `mls_compute_av':
mls.c:36: error: `policydb' undeclared (first use in this function) mls.c:36: error: (Each undeclared identifier is reported only once mls.c:36: error: for each function it appears in.)mls.c: In function `mls_compute_context_len':
mls.c:84: error:policydb' undeclared (first use in this function) mls.c: In functionmls_sid_to_context':
mls.c:114: error:policydb' undeclared (first use in this function) mls.c: In functionmls_context_to_sid':
mls.c:230: error: `policydb' undeclared (first use in this function)
And trivial patch for checkpolicy Makefile, also only compile-tested.
Index: checkpolicy/Makefile
===================================================================
RCS file: /nfshome/pal/CVS/selinux-usr/checkpolicy/Makefile,v retrieving revision 1.24
Makefile +0 -2
@@ -12,10 +12,8 @@ ifeq ($(MLS),y) OPTIONS = -DCONFIG_SECURITY_SELINUX_MLS -OBJS = mls.o else OPTIONS = -OBJS = endif CFLAGS = -g $(OPTIONS) -Wall -O2 -pipe
Signature · 8 lines
Stephen Smalley <[email protected]> National Security Agency -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.