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

John Johansen john.johansen at canonical.com
Fri Jun 5 22:24:22 UTC 2015


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>
---
 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 {
-- 
2.1.4




More information about the AppArmor mailing list