[apparmor] [PATCH 06/11] Ensure that all cases that resolve to nonmatching state are hashed the same

Steve Beattie steve at nxnw.org
Tue Nov 9 00:28:52 GMT 2010


On Mon, Nov 08, 2010 at 04:20:55PM -0800, John Johansen wrote:
> nope, you are right I messed that test up
> >>  			return false;
> >>  		Partition *p1 = partition_map.find(s1->cases.otherwise)->second;
> >>  		Partition *p2 = partition_map.find(s2->cases.otherwise)->second;
> >>  		if (p1 != p2)
> >>  			return false;
> >> -	} else if (s2->cases.otherwise) {
> >> +	} else if (s2->cases.otherwise && s1->cases.otherwise != nonmatching) {
> I also messed up this one

Doh, I looked closely at the logic and totally missed the s1 !=
s2 bit.  :-)

> >>  		return false;
> >>  	}
> >>  
> > 
> the new diff
> 
> --- a/parser/libapparmor_re/regexp.y
> +++ b/parser/libapparmor_re/regexp.y
> @@ -1639,14 +1639,14 @@
>  bool DFA::same_mappings(map <State *, Partition *> &partition_map, State *s1,
>  			State *s2)
>  {
> -	if (s1->cases.otherwise) {
> -		if (!s2->cases.otherwise)
> +	if (s1->cases.otherwise && s1->cases.otherwise != nonmatching) {
> +		if (!s2->cases.otherwise || s2->cases.otherwise == nonmatching)
>  			return false;
>  		Partition *p1 = partition_map.find(s1->cases.otherwise)->second;
>  		Partition *p2 = partition_map.find(s2->cases.otherwise)->second;
>  		if (p1 != p2)
>  			return false;
> -	} else if (s2->cases.otherwise) {
> +	} else if (s2->cases.otherwise && s2->cases.otherwise != nonmatching) {
>  		return false;
>  	}

ACK. Thanks.

-- 
Steve Beattie
<sbeattie at ubuntu.com>
http://NxNW.org/~steve/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
Url : https://lists.ubuntu.com/archives/apparmor/attachments/20101108/65688921/attachment-0001.pgp 


More information about the AppArmor mailing list