[apparmor] [PATCH 1/2] apparmor: add clearing the profile cache when inconsistent

Steve Beattie steve at nxnw.org
Mon Aug 13 23:21:01 UTC 2012


On Mon, Aug 13, 2012 at 02:06:12PM -0700, John Johansen wrote:
> Add the ability to clear out the binary profile cache. This removes the
> need to have a separate script to handle the logic of checking and
> removing the cache if it is out of date.
> 
> The parser already does all the checking to determine cache validity
> so it makes sense to allow the parser to clear out inconsistent cache
> when it has been instructed to update the cache.
>
> Signed-off-by: John Johansen <john.johansen at canonical.com>

Coming to this patch and the problem that drove it late, I both agree
with the concept and sensible default :) as well as the implementation.
I have one minor niggle (see below), but otherwise

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

(I don't need another round of review on this patch).

I particularly like the directory walking callback mechanism, and will
try to convert the other locations where we walk directories to use it
if someone else doesn't get to it first.

> ---
>  parser/parser_main.c  |  167 ++++++++++++++++++++++++++++++++++++++++++-------
>  parser/tst/caching.sh |   33 +++++++++-
>  2 files changed, 177 insertions(+), 23 deletions(-)
> 
> diff --git a/parser/parser_main.c b/parser/parser_main.c
> index f4b4640..474dc0a 100644
> --- a/parser/parser_main.c
> +++ b/parser/parser_main.c

[SNIP]

> @@ -1256,6 +1376,11 @@ int main(int argc, char *argv[])
>  		return retval;
>  	}
>  
> +	if (force_clear_cache) {
> +		clear_cache_files(basedir);
> +		exit(0);
> +	}
> +

clear_cache_files() returns a non-zero value if an error
occurred. Presumably we shouldn't be dropping it and should propagate
it in the exit() code.

Also, thanks for adding testcases! Much appreciated!

-- 
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/20120813/79b2f780/attachment-0001.pgp>


More information about the AppArmor mailing list