Skip to content

Commit

Permalink
[file_crash_bug ] Highlight PHC crashes (#2327)
Browse files Browse the repository at this point in the history
  • Loading branch information
suhaibmujahid committed Jan 22, 2024
1 parent b249190 commit bb0903b
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 9 deletions.
37 changes: 29 additions & 8 deletions bugbot/crash/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,29 @@ def is_near_allocator_related_crash(self) -> bool:
"""
return self.is_near_allocator_crash or self.is_potential_near_allocator_crash

@cached_property
def num_phc_crashes(self) -> int:
"""The number of crashes that are related to a potential Probabilistic
Heap Checker (PHC) bug.
"""
return sum(
crash["count"] for crash in self.signature["facets"]["phc_alloc_stack"]
)

@property
def is_potential_phc_crash(self) -> bool:
"""Whether the crash is related to a potential Probabilistic Heap
Checker (PHC) bug.
"""
return self.num_phc_crashes > 0

@property
def is_phc_crash(self) -> bool:
"""Whether the crash is related to a potential Probabilistic Heap
Checker (PHC) bug.
"""
return self.num_phc_crashes == self.num_crashes


class SignatureAnalyzer(SocorroDataAnalyzer, ClouseauDataAnalyzer):
"""Analyze the data related to a signature.
Expand Down Expand Up @@ -596,14 +619,11 @@ def fetch_representative_processed_crash(self) -> dict:

@cached_property
def is_potential_security_crash(self) -> bool:
"""Whether the crash is related to a potential security bug.
The value will be True if:
- the signature is related to near allocator poison value crashes, or
- one of the potential regressors is a security bug
"""
return self.is_near_allocator_related_crash or any(
bug.is_security for bug in self.regressed_by_potential_bugs
"""Whether the crash is related to a potential security bug."""
return (
self.is_near_allocator_related_crash
or self.is_potential_phc_crash
or any(bug.is_security for bug in self.regressed_by_potential_bugs)
)

def has_moz_crash_reason(self, reason: str) -> bool:
Expand Down Expand Up @@ -877,6 +897,7 @@ def fetch_socorro_info(self) -> tuple[list[dict], int]:
"cpu_arch",
"platform_pretty_version",
"_histogram.date",
"phc_alloc_stack",
# The following are needed for SignatureStats:
"platform",
"is_garbage_collecting",
Expand Down
5 changes: 4 additions & 1 deletion bugbot/rules/file_crash_bug.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def get_bugs(self, date):
# [ ] Estimated future crash volume

bug_data = {
"blocks": "bugbot-auto-crash",
"blocks": ["bugbot-auto-crash"],
"type": "defect",
"keywords": ["crash"],
"summary": title,
Expand Down Expand Up @@ -216,6 +216,9 @@ def get_bugs(self, date):
]
bug_data["cc"].append(signature.regressed_by_author["name"])

if signature.is_potential_phc_crash:
bug_data["blocks"].append("PHC")

if signature.is_potential_security_crash:
bug_data["groups"] = ["core-security"]

Expand Down
8 changes: 8 additions & 0 deletions templates/file_crash_bug_description.md.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ all crashes happened on or near an allocator poison value
{{ signature.num_near_allocator_crashes }} out of {{ signature.num_crashes }} crashes happened on or near an allocator poison value
{%- endif %}
{%- endif %}
{% if signature.is_potential_phc_crash -%}
- **Is PHC crash:** {{ "Yes - " if signature.is_potential_phc_crash else "No" }}
{%- if signature.is_phc_crash -%}
all crashes have PHC allocation stack trace
{%- elif signature.is_potential_phc_crash -%}
{{ signature.num_phc_crashes }} out of {{ signature.num_crashes }} crashes have PHC allocation stack trace
{%- endif %}
{%- endif %}



Expand Down

0 comments on commit bb0903b

Please sign in to comment.