CrashReason: Add MTE tag check faults to the list of crash reasons.

As of Linux 5.10, the kernel may report either of the two following
crash reasons:
- SEGV_MTEAERR: async MTE tag check fault
- SEGV_MTESERR: sync MTE tag check fault

Teach LLDB about them.

Differential Revision: https://reviews.llvm.org/D93495
This commit is contained in:
Peter Collingbourne 2020-12-17 15:34:49 -08:00
parent 5fd2b3a124
commit 7e5a187de3
2 changed files with 27 additions and 0 deletions

View File

@ -58,6 +58,18 @@ CrashReason GetCrashReasonForSIGSEGV(const siginfo_t &info) {
#endif
case SEGV_BNDERR:
return CrashReason::eBoundViolation;
#ifdef __linux__
#ifndef SEGV_MTEAERR
#define SEGV_MTEAERR 8
#endif
case SEGV_MTEAERR:
return CrashReason::eAsyncTagCheckFault;
#ifndef SEGV_MTESERR
#define SEGV_MTESERR 9
#endif
case SEGV_MTESERR:
return CrashReason::eSyncTagCheckFault;
#endif // __linux__
}
return CrashReason::eInvalidCrashReason;
@ -166,6 +178,13 @@ std::string GetCrashReasonString(CrashReason reason, lldb::addr_t fault_addr) {
case CrashReason::eBoundViolation:
str = "signal SIGSEGV: bound violation";
break;
case CrashReason::eAsyncTagCheckFault:
str = "signal SIGSEGV: async tag check fault";
break;
case CrashReason::eSyncTagCheckFault:
str = "signal SIGSEGV: sync tag check fault";
AppendFaultAddr(str, fault_addr);
break;
case CrashReason::eIllegalOpcode:
str = "signal SIGILL: illegal instruction";
break;
@ -246,6 +265,12 @@ const char *CrashReasonAsString(CrashReason reason) {
case CrashReason::eBoundViolation:
str = "eBoundViolation";
break;
case CrashReason::eAsyncTagCheckFault:
str = "eAsyncTagCheckFault";
break;
case CrashReason::eSyncTagCheckFault:
str = "eSyncTagCheckFault";
break;
// SIGILL crash reasons.
case CrashReason::eIllegalOpcode:

View File

@ -22,6 +22,8 @@ enum class CrashReason {
eInvalidAddress,
ePrivilegedAddress,
eBoundViolation,
eAsyncTagCheckFault,
eSyncTagCheckFault,
// SIGILL crash reasons.
eIllegalOpcode,