llvm-project/lldb
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
..
bindings [trace] Add an option to save a compact trace bundle 2022-07-13 11:43:28 -07:00
cmake [lldb] Disable modules in Apple-lldb-base 2022-05-24 17:17:14 -07:00
docs Update docs to note lzfse open source implementation 2022-07-19 01:40:40 -07:00
examples [lldb/crashlog] Show help when the command is called without any argument 2022-06-10 13:44:43 -07:00
include/lldb [lldb][AArch64] Add support for memory tags in core files 2022-07-26 08:46:36 +01:00
packages/Python/lldbsuite [lldb] [llgs] Send process output asynchronously in non-stop mode 2022-07-15 17:20:39 +02:00
resources
scripts
source [lldb][AArch64] Add support for memory tags in core files 2022-07-26 08:46:36 +01:00
test [lldb][AArch64] Add support for memory tags in core files 2022-07-26 08:46:36 +01:00
third_party/Python/module [lldb][NFC] Inclusive language: replace master/slave names for ptys 2021-11-12 10:54:18 -06:00
tools Revert "[NFC] Improve FileSpec internal APIs and usage in preparation for adding caching of resolved/absolute." and follow-ups 2022-07-23 12:35:48 -04:00
unittests [lldb][AArch64] Add UnpackTagsFromCoreFileSegment to MemoryTagManager 2022-07-25 15:51:36 +01:00
utils [lldb] Refactor command option enum values (NFC) 2022-07-14 21:18:07 -07:00
.clang-format
.clang-tidy [LLDB] Applying clang-tidy modernize-use-override over LLDB 2022-04-22 13:29:47 -07:00
.gitignore
CMakeLists.txt [cmake] Make include(GNUInstallDirs) always below project(..) 2022-01-20 18:59:17 +00:00
CODE_OWNERS.txt [CODE OWNERS] Add wallace as code owner 2022-01-12 12:36:30 -08:00
LICENSE.TXT
use_lldb_suite_root.py