diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2021-04-05 16:33:18 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2021-04-05 16:33:18 +0000 |
commit | 5df67e6da17070d06909c1f685c0d1a920212a0e (patch) | |
tree | f3a80278800d3789183c8dbd6e9b26a3c49285b0 | |
parent | b92a12d0af0f2874fe57d04be2e3af941eef84d9 (diff) | |
parent | d784e0f93ef65c95611133e1ba6dc18562395c81 (diff) | |
download | suite_harness-android11-mainline-media-swcodec-release.tar.gz |
Snap for 7259092 from d784e0f93ef65c95611133e1ba6dc18562395c81 to mainline-media-swcodec-releaseandroid-mainline-11.0.0_r40android11-mainline-media-swcodec-release
Change-Id: I5d87d742b7f6adb5b2ddf68f4cc39bc4aed2ff52
-rw-r--r-- | common/util/tests/assets/logcat.txt | 1 | ||||
-rw-r--r-- | common/util/tests/src/com/android/compatibility/common/util/CrashUtilsTest.java | 92 |
2 files changed, 80 insertions, 13 deletions
diff --git a/common/util/tests/assets/logcat.txt b/common/util/tests/assets/logcat.txt index b9d10d05..ffb28ad5 100644 --- a/common/util/tests/assets/logcat.txt +++ b/common/util/tests/assets/logcat.txt @@ -229,7 +229,6 @@ 05-04 21:59:23.743 9363 9363 F DEBUG : #22 pc 00000000001a1f94 /system/lib64/hw/bluetooth.default.so (run_thread(void*)+184) 05-04 21:59:23.743 9363 9363 F DEBUG : #23 pc 0000000000067d80 /system/lib64/libc.so (__pthread_start(void*)+36) 05-04 21:59:23.743 9363 9363 F DEBUG : #24 pc 000000000001ec18 /system/lib64/libc.so (__start_thread+68) -1-25 19:47:35.417 8080 11665 F MPEG4Extractor: frameworks/av/media/libstagefright/MPEG4Extractor.cpp:6853 CHECK_EQ( (unsigned)ptr[0],1u) failed: 129 vs. 1 11-25 19:47:35.417 8080 11665 F libc : Fatal signal 6 (SIGABRT), code -6 in tid 11665 (generic) 11-25 19:47:35.487 940 940 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 11-25 19:47:35.487 940 940 F DEBUG : Build fingerprint: 'samsung/hero2qltezc/hero2qltechn:6.0.1/MMB29M/G9350ZCU2APJ6:user/release-keys' diff --git a/common/util/tests/src/com/android/compatibility/common/util/CrashUtilsTest.java b/common/util/tests/src/com/android/compatibility/common/util/CrashUtilsTest.java index 071733f8..2d80509c 100644 --- a/common/util/tests/src/com/android/compatibility/common/util/CrashUtilsTest.java +++ b/common/util/tests/src/com/android/compatibility/common/util/CrashUtilsTest.java @@ -54,29 +54,40 @@ public class CrashUtilsTest { public void testGetAllCrashes() throws Exception { JSONArray expectedResults = new JSONArray(); expectedResults.put(createCrashJson( - 11071, 11189, "AudioOut_D", "/system/bin/audioserver", "e9380000", "SIGSEGV")); + 11071, 11189, "AudioOut_D", "/system/bin/audioserver", "e9380000", "SIGSEGV", null)); expectedResults.put(createCrashJson( - 12736, 12761, "Binder:12736_2", "/system/bin/audioserver", "0", "SIGSEGV")); + 12736, 12761, "Binder:12736_2", "/system/bin/audioserver", "0", "SIGSEGV", null)); expectedResults.put(createCrashJson( - 26201, 26227, "Binder:26201_3", "/system/bin/audioserver", "0", "SIGSEGV")); + 26201, 26227, "Binder:26201_3", "/system/bin/audioserver", "0", "SIGSEGV", null)); expectedResults.put(createCrashJson( - 26246, 26282, "Binder:26246_5", "/system/bin/audioserver", "0", "SIGSEGV")); + 26246, 26282, "Binder:26246_5", "/system/bin/audioserver", "0", "SIGSEGV", null)); expectedResults.put(createCrashJson( - 245, 245, "installd", "/system/bin/installd", null, "SIGABRT")); + 245, 245, "installd", "/system/bin/installd", null, "SIGABRT", + "'utils.cpp:67] Check failed: is_valid_package_name(package_name) == 0 '")); expectedResults.put(createCrashJson( - 6371, 8072, "media.codec", "omx@1.0-service", "ed000000", "SIGSEGV")); + 6371, 8072, "media.codec", "omx@1.0-service", "ed000000", "SIGSEGV", null)); expectedResults.put(createCrashJson( - 8373, 8414, "loo", "com.android.bluetooth", null, "SIGABRT")); + 8373, 8414, "loo", "com.android.bluetooth", null, "SIGABRT", + "'[FATAL:allocation_tracker.cc(143)] Check failed: map_entry != allocations.end().")); expectedResults.put(createCrashJson( - 11071, 11189, "synthetic_thread", "synthetic_process_0", "e9380000", "SIGSEGV")); + 8080, 11665, "generic", "/system/bin/mediaserver", null, "SIGABRT", + "'frameworks/av/media/libstagefright/MPEG4Extractor.cpp:6853 CHECK_EQ( (unsigned)ptr[0],1u) failed: 129 vs. 1'")); expectedResults.put(createCrashJson( - 12736, 12761, "synthetic_thread", "synthetic_process_1", "0", "SIGSEGV")); + 11071, 11189, "synthetic_thread", "synthetic_process_0", "e9380000", "SIGSEGV", null)); + expectedResults.put(createCrashJson( + 12736, 12761, "synthetic_thread", "synthetic_process_1", "0", "SIGSEGV", null)); - Assert.assertEquals(mCrashes.toString(), expectedResults.toString()); + Assert.assertEquals(expectedResults.toString() + "\n" + mCrashes.toString() + "\n", expectedResults.toString(), mCrashes.toString()); } public JSONObject createCrashJson( - int pid, int tid, String name, String process, String faultaddress, String signal) { + int pid, + int tid, + String name, + String process, + String faultaddress, + String signal, + String abortMessage) { JSONObject json = new JSONObject(); try { json.put(CrashUtils.PID, pid); @@ -85,6 +96,7 @@ public class CrashUtilsTest { json.put(CrashUtils.PROCESS, process); json.put(CrashUtils.FAULT_ADDRESS, faultaddress); json.put(CrashUtils.SIGNAL, signal); + json.put(CrashUtils.ABORT_MESSAGE, abortMessage); } catch (JSONException e) {} return json; } @@ -143,9 +155,65 @@ public class CrashUtilsTest { @Test public void testNullFaultAddress() throws Exception { JSONArray crashes = new JSONArray(); - crashes.put(createCrashJson(8373, 8414, "loo", "com.android.bluetooth", null, "SIGSEGV")); + crashes.put(createCrashJson(8373, 8414, "loo", "com.android.bluetooth", null, "SIGSEGV", "")); Assert.assertTrue(CrashUtils.securityCrashDetected(crashes, new CrashUtils.Config() .checkMinAddress(true) .setProcessPatterns(Pattern.compile("com\\.android\\.bluetooth")))); } + + @Test + public void testAbortMessageInclude() throws Exception { + JSONArray crashes = new JSONArray(); + crashes.put(createCrashJson(8373, 8414, "loo", "com.android.bluetooth", null, "SIGABRT", + "'[FATAL:allocation_tracker.cc(143)] Check failed: map_entry != allocations.end().")); + Assert.assertTrue(CrashUtils.securityCrashDetected(crashes, new CrashUtils.Config() + .appendSignals(CrashUtils.SIGABRT) + .appendAbortMessageIncludes("Check failed:") + .setProcessPatterns(Pattern.compile("com\\.android\\.bluetooth")))); + + Assert.assertFalse(CrashUtils.securityCrashDetected(crashes, new CrashUtils.Config() + .appendSignals(CrashUtils.SIGABRT) + .appendAbortMessageIncludes("include not matches") + .setProcessPatterns(Pattern.compile("com\\.android\\.bluetooth")))); + } + + @Test + public void testAbortMessageExclude() throws Exception { + JSONArray crashes = new JSONArray(); + crashes.put(createCrashJson(8373, 8414, "loo", "com.android.bluetooth", null, "SIGABRT", + "'[FATAL:allocation_tracker.cc(143)] Check failed: map_entry != allocations.end().")); + Assert.assertFalse(CrashUtils.securityCrashDetected(crashes, new CrashUtils.Config() + .appendSignals(CrashUtils.SIGABRT) + .appendAbortMessageExcludes("Check failed:") + .setProcessPatterns(Pattern.compile("com\\.android\\.bluetooth")))); + + Assert.assertTrue(CrashUtils.securityCrashDetected(crashes, new CrashUtils.Config() + .appendSignals(CrashUtils.SIGABRT) + .appendAbortMessageExcludes("exclude not matches") + .setProcessPatterns(Pattern.compile("com\\.android\\.bluetooth")))); + } + + @Test + public void testAbortMessageExcludeCannotLink() throws Exception { + JSONArray crashes = new JSONArray(); + crashes.put(createCrashJson( + 18959, 18959, "CVE-2020-0073", "/data/local/tmp/CVE-2020-0073", null, "SIGABRT", + "'CANNOT LINK EXECUTABLE \"/data/local/tmp/CVE-2020-0073\": library " + + "\"libnfc-nci.so\" (\"(default)\", \"/data/local/tmp/CVE-2020-0073\", \"\") " + + "not found'")); + Assert.assertFalse(CrashUtils.securityCrashDetected(crashes, new CrashUtils.Config() + .appendSignals(CrashUtils.SIGABRT) + .setProcessPatterns(Pattern.compile("CVE-2020-0073")))); + + crashes.put(createCrashJson( + 5105, 5105, "CVE-2015-6616-2", "/data/local/tmp/CVE-2015-6616-2", null, "SIGABRT", + "'CANNOT LINK EXECUTABLE \"/data/local/tmp/CVE-2015-6616-2\": " + + "cannot locate symbol \"" + + "_ZN7android14MediaExtractor17CreateFromServiceERKNS_2spINS_10DataSourceEEEPKc" + + "\" referenced by \"/data/local/tmp/CVE-2015-6616-2\"...'")); + Assert.assertFalse(CrashUtils.securityCrashDetected(crashes, new CrashUtils.Config() + .appendSignals(CrashUtils.SIGABRT) + .setProcessPatterns(Pattern.compile("CVE-2015-6616-2")))); + + } } |