[apparmor] [PATCH 10/11] Fix caching when used with a newer kernel with the feature directory

Steve Beattie steve at nxnw.org
Thu Mar 8 19:15:12 UTC 2012


On Wed, Mar 07, 2012 at 06:17:29AM -0800, John Johansen wrote:
> On newer kernels the features directory causes the creation of a
> cache/.feature file that contains newline characters.  This causes the
> feature comparison to fail, because get_flags_string() uses fgets
> which stop reading in the feature file after the first newline.
> 
> This caches the features comparision to compare a single line of the
> file against the full kernel feature directory resulting in caching
> failure.
> 
> Worse this also means the cache won't get updated as the parser doesn't
> change what set gets caches after the .feature file gets created.
> 
> Signed-off-by: John Johansen <john.johansen at canonical.com>

Acked-By: Steve Beattie <sbeattie at ubuntu.com>

> ---
>  parser/parser_main.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/parser/parser_main.c b/parser/parser_main.c
> index ddbdf99..ea2e1ed 100644
> --- a/parser/parser_main.c
> +++ b/parser/parser_main.c
> @@ -857,7 +857,7 @@ static void get_flags_string(char **flags, char *flags_file) {
>  	if (!*flags)
>  		goto fail;
>  
> -	if (!fgets(*flags, FLAGS_STRING_SIZE, f))
> +	if (!fread(*flags, 1, FLAGS_STRING_SIZE, f))
>  		goto fail;
>  
>  	fclose(f);
> -- 
> 1.7.9
> 
> 
> -- 
> AppArmor mailing list
> AppArmor at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor

-- 
Steve Beattie
<sbeattie at ubuntu.com>
http://NxNW.org/~steve/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20120308/0086c2e5/attachment.pgp>


More information about the AppArmor mailing list