llvm-project/lldb/source/Plugins/Process/elf-core
David Spickett 2f9fa9ef53 [lldb][AArch64] Add support for memory tags in core files
This teaches ProcessElfCore to recognise the MTE tag segments.

https://www.kernel.org/doc/html/latest/arm64/memory-tagging-extension.html#core-dump-support

These segments contain all the tags for a matching memory segment
which will have the same size in virtual address terms. In real terms
it's 2 tags per byte so the data in the segment is much smaller.

Since MTE is the only tag type supported I have hardcoded some
things to those values. We could and should support more formats
as they appear but doing so now would leave code untested until that
happens.

A few things to note:
* /proc/pid/smaps is not in the core file, only the details you have
  in "maps". Meaning we mark a region tagged only if it has a tag segment.
* A core file supports memory tagging if it has at least 1 memory
  tag segment, there is no other flag we can check to tell if memory
  tagging was enabled. (unlike a live process that can support memory
  tagging even if there are currently no tagged memory regions)

Tests have been added at the commands level for a core file with
mte and without.

There is a lot of overlap between the "memory tag read" tests here and the unit tests for
MemoryTagManagerAArch64MTE::UnpackTagsFromCoreFileSegment, but I think it's
worth keeping to check ProcessElfCore doesn't cause an assert.

Depends on D129487

Reviewed By: omjavaid

Differential Revision: https://reviews.llvm.org/D129489
2022-07-26 08:46:36 +01:00
..
CMakeLists.txt
ProcessElfCore.cpp [lldb][AArch64] Add support for memory tags in core files 2022-07-26 08:46:36 +01:00
ProcessElfCore.h [lldb][AArch64] Add support for memory tags in core files 2022-07-26 08:46:36 +01:00
RegisterContextPOSIXCore_arm.cpp [lldb] Refactor DataBuffer so we can map files as read-only 2022-04-05 13:46:37 -07:00
RegisterContextPOSIXCore_arm.h [lldb] Refactor DataBuffer so we can map files as read-only 2022-04-05 13:46:37 -07:00
RegisterContextPOSIXCore_arm64.cpp [lldb] Refactor DataBuffer so we can map files as read-only 2022-04-05 13:46:37 -07:00
RegisterContextPOSIXCore_arm64.h [lldb] Refactor DataBuffer so we can map files as read-only 2022-04-05 13:46:37 -07:00
RegisterContextPOSIXCore_mips64.cpp [lldb] Refactor DataBuffer so we can map files as read-only 2022-04-05 13:46:37 -07:00
RegisterContextPOSIXCore_mips64.h [lldb] Refactor DataBuffer so we can map files as read-only 2022-04-05 13:46:37 -07:00
RegisterContextPOSIXCore_powerpc.cpp [lldb] Refactor DataBuffer so we can map files as read-only 2022-04-05 13:46:37 -07:00
RegisterContextPOSIXCore_powerpc.h [lldb] Refactor DataBuffer so we can map files as read-only 2022-04-05 13:46:37 -07:00
RegisterContextPOSIXCore_ppc64le.cpp
RegisterContextPOSIXCore_ppc64le.h
RegisterContextPOSIXCore_s390x.cpp [lldb] Refactor DataBuffer so we can map files as read-only 2022-04-05 13:46:37 -07:00
RegisterContextPOSIXCore_s390x.h [lldb] Refactor DataBuffer so we can map files as read-only 2022-04-05 13:46:37 -07:00
RegisterContextPOSIXCore_x86_64.cpp [lldb] Refactor DataBuffer so we can map files as read-only 2022-04-05 13:46:37 -07:00
RegisterContextPOSIXCore_x86_64.h [lldb] Refactor DataBuffer so we can map files as read-only 2022-04-05 13:46:37 -07:00
RegisterUtilities.cpp [nfc] [lldb] Prevent needless copies of DataExtractor 2021-08-04 20:35:53 +02:00
RegisterUtilities.h [lldb] [Process/elf-core] Fix reading NetBSD/i386 core dumps 2021-06-20 18:59:21 +02:00
ThreadElfCore.cpp [lldb] Rename Logging.h to LLDBLog.h and clean up includes 2022-02-03 14:47:01 +01:00
ThreadElfCore.h