[Lldb-commits] [lldb] 7e5a187 - CrashReason: Add MTE tag check faults to the list of crash reasons.

Peter Collingbourne via lldb-commits lldb-commits at lists.llvm.org
Tue Dec 29 14:37:37 PST 2020


Author: Peter Collingbourne
Date: 2020-12-29T14:36:50-08:00
New Revision: 7e5a187de31358741f9868cdee7b0c63c1343d8d

URL: https://github.com/llvm/llvm-project/commit/7e5a187de31358741f9868cdee7b0c63c1343d8d
DIFF: https://github.com/llvm/llvm-project/commit/7e5a187de31358741f9868cdee7b0c63c1343d8d.diff

LOG: 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

Added: 
    

Modified: 
    lldb/source/Plugins/Process/POSIX/CrashReason.cpp
    lldb/source/Plugins/Process/POSIX/CrashReason.h

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Process/POSIX/CrashReason.cpp b/lldb/source/Plugins/Process/POSIX/CrashReason.cpp
index 579077b45bf9..c6ede61cfe1b 100644
--- a/lldb/source/Plugins/Process/POSIX/CrashReason.cpp
+++ b/lldb/source/Plugins/Process/POSIX/CrashReason.cpp
@@ -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:

diff  --git a/lldb/source/Plugins/Process/POSIX/CrashReason.h b/lldb/source/Plugins/Process/POSIX/CrashReason.h
index 9b4784a1e68e..f5213891d976 100644
--- a/lldb/source/Plugins/Process/POSIX/CrashReason.h
+++ b/lldb/source/Plugins/Process/POSIX/CrashReason.h
@@ -22,6 +22,8 @@ enum class CrashReason {
   eInvalidAddress,
   ePrivilegedAddress,
   eBoundViolation,
+  eAsyncTagCheckFault,
+  eSyncTagCheckFault,
 
   // SIGILL crash reasons.
   eIllegalOpcode,


        


More information about the lldb-commits mailing list