From 2f9ab8ca8dec93f2a0a91e7d9ff650157ed1f58d Mon Sep 17 00:00:00 2001 From: Christopher Dombroski Date: Wed, 10 Mar 2021 14:41:18 -0800 Subject: Crash Parser ignore CANNOT LINK EXECUTABLE Bug: 182316829 Test: test/suite_harness/common/util/tests/run_tests.sh Change-Id: Iecc93039a3935029191a4f7a2b7eb7e7a53da728 Merged-In: Iecc93039a3935029191a4f7a2b7eb7e7a53da728 --- .../compatibility/common/util/CrashUtils.java | 2 +- .../compatibility/common/util/CrashUtilsTest.java | 24 ++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/common/util/src/com/android/compatibility/common/util/CrashUtils.java b/common/util/src/com/android/compatibility/common/util/CrashUtils.java index c902145d..9bd1c610 100644 --- a/common/util/src/com/android/compatibility/common/util/CrashUtils.java +++ b/common/util/src/com/android/compatibility/common/util/CrashUtils.java @@ -243,7 +243,7 @@ public class CrashUtils { minCrashAddress = MIN_CRASH_ADDR; setSignals(SIGSEGV, SIGBUS); abortMessageIncludes = new ArrayList<>(); - setAbortMessageExcludes("CHECK_"); + setAbortMessageExcludes("CHECK_", "CANNOT LINK EXECUTABLE"); processPatterns = new ArrayList(); } 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 7ae31365..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 @@ -192,4 +192,28 @@ public class CrashUtilsTest { .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")))); + + } } -- cgit v1.2.3 From fc47d6757bc0a47c5eb89bc00c2a9c1481fe902f Mon Sep 17 00:00:00 2001 From: Christopher Dombroski Date: Wed, 28 Oct 2020 14:28:10 -0700 Subject: Update Crash Parser with abort messages Bug: 132699414 Test: attempt to repro the failure in b/132699414 Test: atest CrashUtilsTest Change-Id: I23cbce5663e4234a2160d4016999ff3a0a80dc0a --- common/util/tests/assets/logcat.txt | 1 - .../compatibility/common/util/CrashUtilsTest.java | 68 ++++++++++++++++++---- 2 files changed, 56 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..7ae31365 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,41 @@ 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")))); + } } -- cgit v1.2.3 From 13de07bbbb67681e59402cf6f4b0b1a53a2d50c2 Mon Sep 17 00:00:00 2001 From: Christopher Dombroski Date: Wed, 10 Mar 2021 14:41:18 -0800 Subject: Crash Parser ignore CANNOT LINK EXECUTABLE Bug: 182316829 Test: atest CrashUtilsTest also see same change-id in platform/platform_testing Change-Id: Iecc93039a3935029191a4f7a2b7eb7e7a53da728 --- .../compatibility/common/util/CrashUtilsTest.java | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) 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 7ae31365..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 @@ -192,4 +192,28 @@ public class CrashUtilsTest { .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")))); + + } } -- cgit v1.2.3