Skip to content

Commit f88a389

Browse files
committed
Add ANDROID_SIGABRT_REGEX and ANDROID_SIGTRAP_REGEX to catch
`SIGABRT` and `SIGTRAP` crashes
1 parent f7c302b commit f88a389

2 files changed

Lines changed: 23 additions & 15 deletions

File tree

src/clusterfuzz/stacktraces/__init__.py

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -783,20 +783,6 @@ def parse(self, stacktrace: str) -> CrashInfo:
783783
mte_match = ANDROID_SEGV_REGEX.search(line)
784784
state.crash_type = f"Tag-mismatch{(mte_match.group(2) or '')}"
785785

786-
# If the line indicates an MTE Abort (SIGABRT), set the crash_type
787-
# to "Abort".
788-
if ('SIGABRT' in line and state.crash_type not in
789-
IGNORE_CRASH_TYPES_FOR_ABRT_BREAKPOINT_AND_ILLS):
790-
state.crash_type = 'Abort'
791-
792-
# If the line indicates an MTE Trap (SIGTRAP), extract and set the
793-
# crash_address using regex and set the crash_type to "Trap".
794-
if ('SIGTRAP' in line and state.crash_type not in
795-
IGNORE_CRASH_TYPES_FOR_ABRT_BREAKPOINT_AND_ILLS):
796-
mte_match = ANDROID_SEGV_REGEX.search(line)
797-
state.crash_type = 'Trap'
798-
state.crash_address = mte_match.group(1) or ''
799-
800786
# Set the crash address for SEGVs.
801787
if 'SIGSEGV' in line:
802788
state.crash_address = android_segv_match.group(1)
@@ -809,7 +795,26 @@ def parse(self, stacktrace: str) -> CrashInfo:
809795
if process_name_match:
810796
state.process_name = process_name_match.group(1).capitalize()
811797

812-
# Android SIGABRT handling.
798+
if (state.crash_type not in
799+
IGNORE_CRASH_TYPES_FOR_ABRT_BREAKPOINT_AND_ILLS):
800+
# Android SIBTRAP handling
801+
mte_match = ANDROID_SIGTRAP_REGEX.search(line)
802+
self.update_state_on_match(
803+
ANDROID_SIGTRAP_REGEX,
804+
line,
805+
state,
806+
new_type='Trap',
807+
new_address=(mte_match.group(1) if mte_match else ''))
808+
809+
# Android SIGABRT handling.
810+
self.update_state_on_match(
811+
ANDROID_SIGABRT_REGEX,
812+
line,
813+
state,
814+
new_type='Abort',
815+
new_address='')
816+
817+
#Android Abort handling
813818
android_abort_match = self.update_state_on_match(
814819
ANDROID_ABORT_REGEX,
815820
line,

src/clusterfuzz/stacktraces/constants.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@
4444
# Parentheses are optional.
4545
ANDROID_PROCESS_NAME_REGEX = re.compile(r'.*[(](.*)[)]$')
4646
ANDROID_SEGV_REGEX = re.compile(r'.*signal.*\(SIG.*fault addr ([^ ]*)(.*)')
47+
ANDROID_SIGABRT_REGEX = re.compile(r'.*signal.*\(SIGABRT.*fault addr --------')
48+
ANDROID_SIGTRAP_REGEX = re.compile(
49+
r'.*signal.*\(SIGTRAP.*fault addr ([^ ]*)(.*)')
4750
ASAN_INVALID_FREE_REGEX = re.compile(
4851
r'.*AddressSanitizer: '
4952
r'attempting free on address which was not malloc\(\)-ed: '

0 commit comments

Comments
 (0)