[apparmor] [PATCH 1/2] Use mtime instead of ctime for cache file

Seth Arnold seth.arnold at canonical.com
Fri Jun 5 23:15:05 UTC 2015


On Fri, Jun 05, 2015 at 03:24:22PM -0700, John Johansen wrote:
> For cache file. For some inexplicable reason when we converted the
> cache to use mtime, the timestamp used from the cache file never
> got switched from ctime to mtime.
> 
> The means we are comparing the cache files ctime against the policy
> files mtime. Which can make the cache look newer than it really
> is.
> 
> Signed-off-by: John Johansen <john.johansen at canonical.com>

Acked-by: Seth Arnold <seth.arnold at canonical.com>

Thanks

> ---
>  parser/policy_cache.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/parser/policy_cache.c b/parser/policy_cache.c
> index fc4912e..65829a6 100644
> --- a/parser/policy_cache.c
> +++ b/parser/policy_cache.c
> @@ -109,7 +109,7 @@ void valid_read_cache(const char *cachename)
>  		if (stat(cachename, &stat_bin) == 0 &&
>  		    stat_bin.st_size > 0) {
>  			if (valid_cached_file_version(cachename))
> -				set_mru_tstamp(stat_bin.st_ctim);
> +				set_mru_tstamp(stat_bin.st_mtim);
>  			else if (!cond_clear_cache)
>  				write_cache = 0;
>  		} else {
> -- 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20150605/1e7b32fb/attachment.pgp>


More information about the AppArmor mailing list