All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix expand logic for policy versions older than 24.
@ 2014-11-24 15:06 Stephen Smalley
  2014-11-24 16:24 ` Steve Lawrence
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Smalley @ 2014-11-24 15:06 UTC (permalink / raw)
  To: selinux; +Cc: Stephen Smalley

This was broken for older policy versions when we updated to
version 24.

Broken by commit 787f2f00f5d8ed6f5f.

Change-Id: I4063334c5c0462ef5c3706611c7dff5c60c612aa
Reported-by: William Roberts <bill.c.roberts@gmail.com>
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
---
 libsepol/src/expand.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libsepol/src/expand.c b/libsepol/src/expand.c
index 23eb6ed..57293ae 100644
--- a/libsepol/src/expand.c
+++ b/libsepol/src/expand.c
@@ -3159,12 +3159,12 @@ static int expand_avtab_node(avtab_key_t * k, avtab_datum_t * d, void *args)
 	newkey.target_class = k->target_class;
 	newkey.specified = k->specified;
 
-	if (stype->flavor != TYPE_ATTRIB && ttype->flavor != TYPE_ATTRIB) {
+	if (stype && ttype && stype->flavor != TYPE_ATTRIB && ttype->flavor != TYPE_ATTRIB) {
 		/* Both are individual types, no expansion required. */
 		return expand_avtab_insert(expa, k, d);
 	}
 
-	if (stype->flavor != TYPE_ATTRIB) {
+	if (stype && stype->flavor != TYPE_ATTRIB) {
 		/* Source is an individual type, target is an attribute. */
 		newkey.source_type = k->source_type;
 		ebitmap_for_each_bit(tattr, tnode, j) {
@@ -3178,7 +3178,7 @@ static int expand_avtab_node(avtab_key_t * k, avtab_datum_t * d, void *args)
 		return 0;
 	}
 
-	if (ttype->flavor != TYPE_ATTRIB) {
+	if (ttype && ttype->flavor != TYPE_ATTRIB) {
 		/* Target is an individual type, source is an attribute. */
 		newkey.target_type = k->target_type;
 		ebitmap_for_each_bit(sattr, snode, i) {
@@ -3289,12 +3289,12 @@ int expand_cond_av_node(policydb_t * p,
 	newkey.target_class = k->target_class;
 	newkey.specified = k->specified;
 
-	if (stype->flavor != TYPE_ATTRIB && ttype->flavor != TYPE_ATTRIB) {
+	if (stype && ttype && stype->flavor != TYPE_ATTRIB && ttype->flavor != TYPE_ATTRIB) {
 		/* Both are individual types, no expansion required. */
 		return expand_cond_insert(newl, expa, k, d);
 	}
 
-	if (stype->flavor != TYPE_ATTRIB) {
+	if (stype && stype->flavor != TYPE_ATTRIB) {
 		/* Source is an individual type, target is an attribute. */
 		newkey.source_type = k->source_type;
 		ebitmap_for_each_bit(tattr, tnode, j) {
@@ -3308,7 +3308,7 @@ int expand_cond_av_node(policydb_t * p,
 		return 0;
 	}
 
-	if (ttype->flavor != TYPE_ATTRIB) {
+	if (ttype && ttype->flavor != TYPE_ATTRIB) {
 		/* Target is an individual type, source is an attribute. */
 		newkey.target_type = k->target_type;
 		ebitmap_for_each_bit(sattr, snode, i) {
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] Fix expand logic for policy versions older than 24.
  2014-11-24 15:06 [PATCH] Fix expand logic for policy versions older than 24 Stephen Smalley
@ 2014-11-24 16:24 ` Steve Lawrence
  2014-11-25 18:59   ` Stephen Smalley
  0 siblings, 1 reply; 5+ messages in thread
From: Steve Lawrence @ 2014-11-24 16:24 UTC (permalink / raw)
  To: Stephen Smalley, selinux

Acked-By: Steve Lawrence <slawrence@tresys.com>

On 11/24/2014 10:06 AM, Stephen Smalley wrote:
> This was broken for older policy versions when we updated to
> version 24.
> 
> Broken by commit 787f2f00f5d8ed6f5f.
> 
> Change-Id: I4063334c5c0462ef5c3706611c7dff5c60c612aa
> Reported-by: William Roberts <bill.c.roberts@gmail.com>
> Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
> ---
>  libsepol/src/expand.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/libsepol/src/expand.c b/libsepol/src/expand.c
> index 23eb6ed..57293ae 100644
> --- a/libsepol/src/expand.c
> +++ b/libsepol/src/expand.c
> @@ -3159,12 +3159,12 @@ static int expand_avtab_node(avtab_key_t * k, avtab_datum_t * d, void *args)
>  	newkey.target_class = k->target_class;
>  	newkey.specified = k->specified;
>  
> -	if (stype->flavor != TYPE_ATTRIB && ttype->flavor != TYPE_ATTRIB) {
> +	if (stype && ttype && stype->flavor != TYPE_ATTRIB && ttype->flavor != TYPE_ATTRIB) {
>  		/* Both are individual types, no expansion required. */
>  		return expand_avtab_insert(expa, k, d);
>  	}
>  
> -	if (stype->flavor != TYPE_ATTRIB) {
> +	if (stype && stype->flavor != TYPE_ATTRIB) {
>  		/* Source is an individual type, target is an attribute. */
>  		newkey.source_type = k->source_type;
>  		ebitmap_for_each_bit(tattr, tnode, j) {
> @@ -3178,7 +3178,7 @@ static int expand_avtab_node(avtab_key_t * k, avtab_datum_t * d, void *args)
>  		return 0;
>  	}
>  
> -	if (ttype->flavor != TYPE_ATTRIB) {
> +	if (ttype && ttype->flavor != TYPE_ATTRIB) {
>  		/* Target is an individual type, source is an attribute. */
>  		newkey.target_type = k->target_type;
>  		ebitmap_for_each_bit(sattr, snode, i) {
> @@ -3289,12 +3289,12 @@ int expand_cond_av_node(policydb_t * p,
>  	newkey.target_class = k->target_class;
>  	newkey.specified = k->specified;
>  
> -	if (stype->flavor != TYPE_ATTRIB && ttype->flavor != TYPE_ATTRIB) {
> +	if (stype && ttype && stype->flavor != TYPE_ATTRIB && ttype->flavor != TYPE_ATTRIB) {
>  		/* Both are individual types, no expansion required. */
>  		return expand_cond_insert(newl, expa, k, d);
>  	}
>  
> -	if (stype->flavor != TYPE_ATTRIB) {
> +	if (stype && stype->flavor != TYPE_ATTRIB) {
>  		/* Source is an individual type, target is an attribute. */
>  		newkey.source_type = k->source_type;
>  		ebitmap_for_each_bit(tattr, tnode, j) {
> @@ -3308,7 +3308,7 @@ int expand_cond_av_node(policydb_t * p,
>  		return 0;
>  	}
>  
> -	if (ttype->flavor != TYPE_ATTRIB) {
> +	if (ttype && ttype->flavor != TYPE_ATTRIB) {
>  		/* Target is an individual type, source is an attribute. */
>  		newkey.target_type = k->target_type;
>  		ebitmap_for_each_bit(sattr, snode, i) {
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Fix expand logic for policy versions older than 24.
  2014-11-24 16:24 ` Steve Lawrence
@ 2014-11-25 18:59   ` Stephen Smalley
  2014-12-01 15:45     ` Steve Lawrence
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Smalley @ 2014-11-25 18:59 UTC (permalink / raw)
  To: Steve Lawrence, selinux

Will this be included in libsepol 2.4?  It is a bug fix.  Not clear on
current state of master versus next branches; master libsepol/VERSION is
2.4-rc6 but does not include this or my prior libsepol patch; next
libsepol/VERSION is only 2.4-rc4 but does include them.

On 11/24/2014 11:24 AM, Steve Lawrence wrote:
> Acked-By: Steve Lawrence <slawrence@tresys.com>
> 
> On 11/24/2014 10:06 AM, Stephen Smalley wrote:
>> This was broken for older policy versions when we updated to
>> version 24.
>>
>> Broken by commit 787f2f00f5d8ed6f5f.
>>
>> Change-Id: I4063334c5c0462ef5c3706611c7dff5c60c612aa
>> Reported-by: William Roberts <bill.c.roberts@gmail.com>
>> Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
>> ---
>>  libsepol/src/expand.c | 12 ++++++------
>>  1 file changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/libsepol/src/expand.c b/libsepol/src/expand.c
>> index 23eb6ed..57293ae 100644
>> --- a/libsepol/src/expand.c
>> +++ b/libsepol/src/expand.c
>> @@ -3159,12 +3159,12 @@ static int expand_avtab_node(avtab_key_t * k, avtab_datum_t * d, void *args)
>>  	newkey.target_class = k->target_class;
>>  	newkey.specified = k->specified;
>>  
>> -	if (stype->flavor != TYPE_ATTRIB && ttype->flavor != TYPE_ATTRIB) {
>> +	if (stype && ttype && stype->flavor != TYPE_ATTRIB && ttype->flavor != TYPE_ATTRIB) {
>>  		/* Both are individual types, no expansion required. */
>>  		return expand_avtab_insert(expa, k, d);
>>  	}
>>  
>> -	if (stype->flavor != TYPE_ATTRIB) {
>> +	if (stype && stype->flavor != TYPE_ATTRIB) {
>>  		/* Source is an individual type, target is an attribute. */
>>  		newkey.source_type = k->source_type;
>>  		ebitmap_for_each_bit(tattr, tnode, j) {
>> @@ -3178,7 +3178,7 @@ static int expand_avtab_node(avtab_key_t * k, avtab_datum_t * d, void *args)
>>  		return 0;
>>  	}
>>  
>> -	if (ttype->flavor != TYPE_ATTRIB) {
>> +	if (ttype && ttype->flavor != TYPE_ATTRIB) {
>>  		/* Target is an individual type, source is an attribute. */
>>  		newkey.target_type = k->target_type;
>>  		ebitmap_for_each_bit(sattr, snode, i) {
>> @@ -3289,12 +3289,12 @@ int expand_cond_av_node(policydb_t * p,
>>  	newkey.target_class = k->target_class;
>>  	newkey.specified = k->specified;
>>  
>> -	if (stype->flavor != TYPE_ATTRIB && ttype->flavor != TYPE_ATTRIB) {
>> +	if (stype && ttype && stype->flavor != TYPE_ATTRIB && ttype->flavor != TYPE_ATTRIB) {
>>  		/* Both are individual types, no expansion required. */
>>  		return expand_cond_insert(newl, expa, k, d);
>>  	}
>>  
>> -	if (stype->flavor != TYPE_ATTRIB) {
>> +	if (stype && stype->flavor != TYPE_ATTRIB) {
>>  		/* Source is an individual type, target is an attribute. */
>>  		newkey.source_type = k->source_type;
>>  		ebitmap_for_each_bit(tattr, tnode, j) {
>> @@ -3308,7 +3308,7 @@ int expand_cond_av_node(policydb_t * p,
>>  		return 0;
>>  	}
>>  
>> -	if (ttype->flavor != TYPE_ATTRIB) {
>> +	if (ttype && ttype->flavor != TYPE_ATTRIB) {
>>  		/* Target is an individual type, source is an attribute. */
>>  		newkey.target_type = k->target_type;
>>  		ebitmap_for_each_bit(sattr, snode, i) {
>>
> 
> _______________________________________________
> Selinux mailing list
> Selinux@tycho.nsa.gov
> To unsubscribe, send email to Selinux-leave@tycho.nsa.gov.
> To get help, send an email containing "help" to Selinux-request@tycho.nsa.gov.
> 
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Fix expand logic for policy versions older than 24.
  2014-11-25 18:59   ` Stephen Smalley
@ 2014-12-01 15:45     ` Steve Lawrence
  2014-12-03 14:50       ` Stephen Smalley
  0 siblings, 1 reply; 5+ messages in thread
From: Steve Lawrence @ 2014-12-01 15:45 UTC (permalink / raw)
  To: Stephen Smalley, selinux

I'm fine including it in 2.4.

I'm unclear on next versus master as well. Not sure what the original
intention was. I feel like there are not really that many incoming
patches (aside from the recent CIL changes) to really necessitate a
next/master branch split. And there's only one small patch on #next,
which I don't have a problem including in 2.4 as well--there's going to
be at least one more release candidate.

- Steve

On 11/25/2014 01:59 PM, Stephen Smalley wrote:
> Will this be included in libsepol 2.4?  It is a bug fix.  Not clear on
> current state of master versus next branches; master libsepol/VERSION is
> 2.4-rc6 but does not include this or my prior libsepol patch; next
> libsepol/VERSION is only 2.4-rc4 but does include them.
> 
> On 11/24/2014 11:24 AM, Steve Lawrence wrote:
>> Acked-By: Steve Lawrence <slawrence@tresys.com>
>>
>> On 11/24/2014 10:06 AM, Stephen Smalley wrote:
>>> This was broken for older policy versions when we updated to
>>> version 24.
>>>
>>> Broken by commit 787f2f00f5d8ed6f5f.
>>>
>>> Change-Id: I4063334c5c0462ef5c3706611c7dff5c60c612aa
>>> Reported-by: William Roberts <bill.c.roberts@gmail.com>
>>> Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
>>> ---
>>>  libsepol/src/expand.c | 12 ++++++------
>>>  1 file changed, 6 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/libsepol/src/expand.c b/libsepol/src/expand.c
>>> index 23eb6ed..57293ae 100644
>>> --- a/libsepol/src/expand.c
>>> +++ b/libsepol/src/expand.c
>>> @@ -3159,12 +3159,12 @@ static int expand_avtab_node(avtab_key_t * k, avtab_datum_t * d, void *args)
>>>  	newkey.target_class = k->target_class;
>>>  	newkey.specified = k->specified;
>>>  
>>> -	if (stype->flavor != TYPE_ATTRIB && ttype->flavor != TYPE_ATTRIB) {
>>> +	if (stype && ttype && stype->flavor != TYPE_ATTRIB && ttype->flavor != TYPE_ATTRIB) {
>>>  		/* Both are individual types, no expansion required. */
>>>  		return expand_avtab_insert(expa, k, d);
>>>  	}
>>>  
>>> -	if (stype->flavor != TYPE_ATTRIB) {
>>> +	if (stype && stype->flavor != TYPE_ATTRIB) {
>>>  		/* Source is an individual type, target is an attribute. */
>>>  		newkey.source_type = k->source_type;
>>>  		ebitmap_for_each_bit(tattr, tnode, j) {
>>> @@ -3178,7 +3178,7 @@ static int expand_avtab_node(avtab_key_t * k, avtab_datum_t * d, void *args)
>>>  		return 0;
>>>  	}
>>>  
>>> -	if (ttype->flavor != TYPE_ATTRIB) {
>>> +	if (ttype && ttype->flavor != TYPE_ATTRIB) {
>>>  		/* Target is an individual type, source is an attribute. */
>>>  		newkey.target_type = k->target_type;
>>>  		ebitmap_for_each_bit(sattr, snode, i) {
>>> @@ -3289,12 +3289,12 @@ int expand_cond_av_node(policydb_t * p,
>>>  	newkey.target_class = k->target_class;
>>>  	newkey.specified = k->specified;
>>>  
>>> -	if (stype->flavor != TYPE_ATTRIB && ttype->flavor != TYPE_ATTRIB) {
>>> +	if (stype && ttype && stype->flavor != TYPE_ATTRIB && ttype->flavor != TYPE_ATTRIB) {
>>>  		/* Both are individual types, no expansion required. */
>>>  		return expand_cond_insert(newl, expa, k, d);
>>>  	}
>>>  
>>> -	if (stype->flavor != TYPE_ATTRIB) {
>>> +	if (stype && stype->flavor != TYPE_ATTRIB) {
>>>  		/* Source is an individual type, target is an attribute. */
>>>  		newkey.source_type = k->source_type;
>>>  		ebitmap_for_each_bit(tattr, tnode, j) {
>>> @@ -3308,7 +3308,7 @@ int expand_cond_av_node(policydb_t * p,
>>>  		return 0;
>>>  	}
>>>  
>>> -	if (ttype->flavor != TYPE_ATTRIB) {
>>> +	if (ttype && ttype->flavor != TYPE_ATTRIB) {
>>>  		/* Target is an individual type, source is an attribute. */
>>>  		newkey.target_type = k->target_type;
>>>  		ebitmap_for_each_bit(sattr, snode, i) {
>>>
>>
>> _______________________________________________
>> Selinux mailing list
>> Selinux@tycho.nsa.gov
>> To unsubscribe, send email to Selinux-leave@tycho.nsa.gov.
>> To get help, send an email containing "help" to Selinux-request@tycho.nsa.gov.
>>
>>
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Fix expand logic for policy versions older than 24.
  2014-12-01 15:45     ` Steve Lawrence
@ 2014-12-03 14:50       ` Stephen Smalley
  0 siblings, 0 replies; 5+ messages in thread
From: Stephen Smalley @ 2014-12-03 14:50 UTC (permalink / raw)
  To: Steve Lawrence, selinux

On 12/01/2014 10:45 AM, Steve Lawrence wrote:
> I'm fine including it in 2.4.
> 
> I'm unclear on next versus master as well. Not sure what the original
> intention was. I feel like there are not really that many incoming
> patches (aside from the recent CIL changes) to really necessitate a
> next/master branch split. And there's only one small patch on #next,
> which I don't have a problem including in 2.4 as well--there's going to
> be at least one more release candidate.

Ok, both changes cherry-picked onto master; next deleted.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-12-03 14:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-24 15:06 [PATCH] Fix expand logic for policy versions older than 24 Stephen Smalley
2014-11-24 16:24 ` Steve Lawrence
2014-11-25 18:59   ` Stephen Smalley
2014-12-01 15:45     ` Steve Lawrence
2014-12-03 14:50       ` Stephen Smalley

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.