From d8404a1cc9d0e0e2e38aa1569328ea6873908695 Mon Sep 17 00:00:00 2001 From: Daniel Thorn Date: Mon, 21 Oct 2024 09:55:03 -0700 Subject: [PATCH 1/2] bug-1918240: Add crash_inconsistencies field from rust-minidump --- socorro/external/es/super_search_fields.py | 3 +++ .../external/legacy_es/super_search_fields.py | 3 +++ socorro/mozilla_rulesets.py | 2 ++ socorro/processor/rules/breakpad.py | 20 +++++++++++++++++++ socorro/schemas/processed_crash.schema.yaml | 18 +++++++++++++++++ .../schemas/test_socorro_data_schemas.py | 3 +++ .../jinja2/crashstats/report_index.html | 9 +++++++++ 7 files changed, 58 insertions(+) diff --git a/socorro/external/es/super_search_fields.py b/socorro/external/es/super_search_fields.py index df44a25767..3339ad80e8 100644 --- a/socorro/external/es/super_search_fields.py +++ b/socorro/external/es/super_search_fields.py @@ -1053,6 +1053,9 @@ def apply_schema_properties(fields, schema): "query_type": "enum", "storage_mapping": {"type": "string"}, }, + "crash_inconsistencies": keyword_field( + "crash_inconsistencies", + ), "crashing_thread": integer_field(name="crashing_thread"), "crashing_thread_name": keyword_field( "crashing_thread_name", diff --git a/socorro/external/legacy_es/super_search_fields.py b/socorro/external/legacy_es/super_search_fields.py index c5999de886..a91a659dc5 100644 --- a/socorro/external/legacy_es/super_search_fields.py +++ b/socorro/external/legacy_es/super_search_fields.py @@ -1060,6 +1060,9 @@ def apply_schema_properties(fields, schema): "query_type": "enum", "storage_mapping": {"type": "string"}, }, + "crash_inconsistencies": keyword_field( + "crash_inconsistencies", + ), "crashing_thread": integer_field(name="crashing_thread"), "crashing_thread_name": keyword_field( "crashing_thread_name", diff --git a/socorro/mozilla_rulesets.py b/socorro/mozilla_rulesets.py index 4628e4b73b..2e990c910c 100644 --- a/socorro/mozilla_rulesets.py +++ b/socorro/mozilla_rulesets.py @@ -9,6 +9,7 @@ AndroidOSInfoRule, ) from socorro.processor.rules.breakpad import ( + CrashInconsistenciesRule, CrashingThreadInfoRule, HasGuardPageAccessRule, MinidumpSha256HashRule, @@ -88,6 +89,7 @@ CrashingThreadInfoRule(), TruncateStacksRule(), PossibleBitFlipsRule(), + CrashInconsistenciesRule(), HasGuardPageAccessRule(), MajorVersionRule(), PluginRule(), diff --git a/socorro/processor/rules/breakpad.py b/socorro/processor/rules/breakpad.py index 5c1fa576d6..2382c2fb53 100644 --- a/socorro/processor/rules/breakpad.py +++ b/socorro/processor/rules/breakpad.py @@ -78,6 +78,26 @@ def action(self, raw_crash, dumps, processed_crash, tmpdir, status): processed_crash["address"] = address +class CrashInconsistenciesRule(Rule): + """Copy crash_inconsistencies values if there are any + + Fills in: + + * crash_inconsistencies (list[str]): A list of inconsistencies detected by comparing + crash reason/crash address with crashing instruction and memory information + + """ + + def predicate(self, raw_crash, dumps, processed_crash, tmpdir, status): + return processed_crash.get("json_dump", None) is not None + + def action(self, raw_crash, dumps, processed_crash, tmpdir, status): + crash_info = glom.glom(processed_crash, "json_dump.crash_info", default={}) + + crash_inconsistencies = crash_info.get("crash_inconsistencies") + processed_crash["crash_inconsistencies"] = crash_inconsistencies + + class MinidumpSha256HashRule(Rule): """Copy sha256 hash of upload_file_minidump value if there is one diff --git a/socorro/schemas/processed_crash.schema.yaml b/socorro/schemas/processed_crash.schema.yaml index 2b66eea794..ade3b9864f 100644 --- a/socorro/schemas/processed_crash.schema.yaml +++ b/socorro/schemas/processed_crash.schema.yaml @@ -171,6 +171,15 @@ definitions: the crash). type: ["string", "null"] permissions: ["public"] + crash_inconsistencies: + description: > + A list of inconsistencies detected by comparing crash reason/crash + address with crashing instruction and memory information. + type: ["array", "null"] + items: + type: string + permissions: ["public"] + permissions: ["public"] crashing_thread: description: > The thread id of the thread that caused the crash or requested @@ -2457,6 +2466,15 @@ properties: description: Unique identifier of this crash report. type: string permissions: ["public"] + crash_inconsistencies: + description: > + A list of inconsistencies detected by comparing crash reason/crash + address with crashing instruction and memory information. + type: ["array", "null"] + items: + type: string + permissions: ["public"] + permissions: ["public"] crash_report_keys: description: > List of crash annotations and files in the submitted crash report. diff --git a/socorro/tests/schemas/test_socorro_data_schemas.py b/socorro/tests/schemas/test_socorro_data_schemas.py index 130ad2774c..10e4c0c89c 100644 --- a/socorro/tests/schemas/test_socorro_data_schemas.py +++ b/socorro/tests/schemas/test_socorro_data_schemas.py @@ -340,6 +340,7 @@ def test_validate_processed_crash_schema(): "cpu_info", "cpu_microcode_version", "crash_id", + "crash_inconsistencies.[]", "crash_report_keys.[]", "crash_time", "crashing_thread", @@ -383,6 +384,7 @@ def test_validate_processed_crash_schema(): "json_dump.crash_info", "json_dump.crash_info.address", "json_dump.crash_info.assertion", + "json_dump.crash_info.crash_inconsistencies.[]", "json_dump.crash_info.crashing_thread", "json_dump.crash_info.instruction", "json_dump.crash_info.memory_accesses.[]", @@ -779,6 +781,7 @@ def test_validate_processed_crash_schema(): "upload_file_minidump_browser.json_dump.crash_info", "upload_file_minidump_browser.json_dump.crash_info.address", "upload_file_minidump_browser.json_dump.crash_info.assertion", + "upload_file_minidump_browser.json_dump.crash_info.crash_inconsistencies.[]", "upload_file_minidump_browser.json_dump.crash_info.crashing_thread", "upload_file_minidump_browser.json_dump.crash_info.instruction", "upload_file_minidump_browser.json_dump.crash_info.memory_accesses.[]", diff --git a/webapp/crashstats/crashstats/jinja2/crashstats/report_index.html b/webapp/crashstats/crashstats/jinja2/crashstats/report_index.html index ed934aa0c7..1fa198ae50 100644 --- a/webapp/crashstats/crashstats/jinja2/crashstats/report_index.html +++ b/webapp/crashstats/crashstats/jinja2/crashstats/report_index.html @@ -347,6 +347,15 @@

{{ report.product }} {{ report.version }} Crash Report [@ {{ report.signatur {% endif %} + {% if report.crash_inconsistencies %} + + Crash Inconsistencies + +
{{ report.crash_inconsistencies }}
+ + + {% endif %} + Process Type From a9a8fe44a8a273ee00936cd9fd798a62b0194890 Mon Sep 17 00:00:00 2001 From: Daniel Thorn Date: Thu, 24 Oct 2024 09:46:28 -0700 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Sven Marnach --- socorro/external/es/super_search_fields.py | 2 +- socorro/external/legacy_es/super_search_fields.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/socorro/external/es/super_search_fields.py b/socorro/external/es/super_search_fields.py index 3339ad80e8..7516b99c26 100644 --- a/socorro/external/es/super_search_fields.py +++ b/socorro/external/es/super_search_fields.py @@ -1054,7 +1054,7 @@ def apply_schema_properties(fields, schema): "storage_mapping": {"type": "string"}, }, "crash_inconsistencies": keyword_field( - "crash_inconsistencies", + name="crash_inconsistencies", ), "crashing_thread": integer_field(name="crashing_thread"), "crashing_thread_name": keyword_field( diff --git a/socorro/external/legacy_es/super_search_fields.py b/socorro/external/legacy_es/super_search_fields.py index a91a659dc5..6ebe2c53c6 100644 --- a/socorro/external/legacy_es/super_search_fields.py +++ b/socorro/external/legacy_es/super_search_fields.py @@ -1061,7 +1061,7 @@ def apply_schema_properties(fields, schema): "storage_mapping": {"type": "string"}, }, "crash_inconsistencies": keyword_field( - "crash_inconsistencies", + name="crash_inconsistencies", ), "crashing_thread": integer_field(name="crashing_thread"), "crashing_thread_name": keyword_field(