Merge "Make AVC log parsing less strict"

This commit is contained in:
Alan Stokes
2023-04-06 13:01:09 +00:00
committed by Gerrit Code Review
2 changed files with 3 additions and 3 deletions

View File

@@ -61,7 +61,7 @@ public class DynamicCodeLoggingService extends JobService {
private static final String AVC_PREFIX = "type=" + AUDIT_AVC + " "; private static final String AVC_PREFIX = "type=" + AUDIT_AVC + " ";
private static final Pattern EXECUTE_NATIVE_AUDIT_PATTERN = private static final Pattern EXECUTE_NATIVE_AUDIT_PATTERN =
Pattern.compile(".*\\bavc: granted \\{ execute(?:_no_trans|) \\} .*" Pattern.compile(".*\\bavc: +granted +\\{ execute(?:_no_trans|) \\} .*"
+ "\\bpath=(?:\"([^\" ]*)\"|([0-9A-F]+)) .*" + "\\bpath=(?:\"([^\" ]*)\"|([0-9A-F]+)) .*"
+ "\\bscontext=u:r:untrusted_app(?:_25|_27)?:.*" + "\\bscontext=u:r:untrusted_app(?:_25|_27)?:.*"
+ "\\btcontext=u:object_r:app_data_file:.*" + "\\btcontext=u:object_r:app_data_file:.*"

View File

@@ -84,7 +84,7 @@ public final class DynamicCodeLoggerIntegrationTests {
// avoid flakiness we run these tests multiple times, allowing progressively longer between // avoid flakiness we run these tests multiple times, allowing progressively longer between
// code loading and checking the logs on each try.) // code loading and checking the logs on each try.)
private static final int AUDIT_LOG_RETRIES = 10; private static final int AUDIT_LOG_RETRIES = 10;
private static final int RETRY_DELAY_MS = 2_000; private static final int RETRY_DELAY_MS = 500;
private static Context sContext; private static Context sContext;
private static int sMyUid; private static int sMyUid;
@@ -245,7 +245,7 @@ public final class DynamicCodeLoggerIntegrationTests {
"/DynamicCodeLoggerNativeExecutable", privateCopyFile); "/DynamicCodeLoggerNativeExecutable", privateCopyFile);
EventLog.writeEvent(EventLog.getTagCode("auditd"), EventLog.writeEvent(EventLog.getTagCode("auditd"),
"type=1400 avc: granted { execute_no_trans } " "type=1400 avc: granted { execute_no_trans } "
+ "path=\"" + privateCopyFile + "\" " + "path=\"" + privateCopyFile + "\" "
+ "scontext=u:r:untrusted_app: " + "scontext=u:r:untrusted_app: "
+ "tcontext=u:object_r:app_data_file: " + "tcontext=u:object_r:app_data_file: "