[apparmor] [Patch][parser] if a cache load fails, attempt to rebuild and load it
John Johansen
john.johansen at canonical.com
Fri Sep 19 19:37:46 UTC 2014
fix: if the apparmor parser fails to load the cache try rebuilding
Signed-off-by: John Johansen <john.johansen at canonical.com>
---
apparmor/2.9-new/parser/parser_main.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
--- jj.orig/apparmor/2.9-new/parser/parser_main.c
+++ jj/apparmor/2.9-new/parser/parser_main.c
@@ -75,6 +75,7 @@
int preprocess_only = 0;
int skip_mode_force = 0;
int abort_on_error = 0; /* stop processing profiles if error */
+int skip_rebuild_bad_cache = 0;
struct timespec mru_tstamp;
#define FEATURES_STRING_SIZE 8192
@@ -125,6 +126,7 @@
{"Optimize", 1, 0, 'O'},
{"preprocess", 0, 0, 'p'},
{"abort-on-error", 0, 0, 132}, /* no short option */
+ {"skip-rebuild-cache", 0, 0, 133}, /* no short option */
{NULL, 0, 0, 0},
};
@@ -416,6 +418,9 @@
case 132:
abort_on_error = 1;
break;
+ case 133:
+ skip_rebuild_bad_cache = 1;
+ break;
case 'L':
cacheloc = strdup(optarg);
break;
@@ -938,7 +943,8 @@
if (show_cache)
PERROR("Cache hit: %s\n", cachename);
retval = process_binary(option, cachename);
- goto out;
+ if (retval && skip_rebuild_bad_cache)
+ goto out;
}
if (write_cache) {
/* Otherwise, set up to save a cached copy */
More information about the AppArmor
mailing list