llvm-project/llvm
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
..
benchmarks
bindings [IR] Remove support for float binop constant expressions 2022-07-12 09:40:49 +02:00
cmake [llvm][cmake] Make `install_symlink` workflow work with absolute install dirs 2022-07-26 03:14:46 +00:00
docs [lldb][AArch64] Add support for memory tags in core files 2022-07-26 08:46:36 +01:00
examples [Kaleidoscope] Remove unused function argument 2022-06-30 20:47:01 +00:00
include [lldb][AArch64] Add support for memory tags in core files 2022-07-26 08:46:36 +01:00
lib [ARM] Add Tag_CPU_arch missing value descriptions in attribute parser 2022-07-26 08:32:40 +01:00
projects
resources
runtimes
test [ARM] Add Tag_CPU_arch missing value descriptions in attribute parser 2022-07-26 08:32:40 +01:00
tools Use isa instead of dyn_cast (NFC) 2022-07-25 23:00:58 -07:00
unittests [ADT] Deprecate Optional::getValueOr (NFC) 2022-07-25 23:01:02 -07:00
utils [gn build] tweak how symbol_exports map files look on linux, for 94c00c10e 2022-07-26 01:52:00 -04:00
.clang-format
.clang-tidy
.gitattributes
.gitignore
CMakeLists.txt [llvm] add zstd to `llvm::compression` namespace 2022-07-19 10:54:36 -07:00
CODE_OWNERS.TXT
CREDITS.TXT
LICENSE.TXT
README.txt
RELEASE_TESTERS.TXT
configure
llvm.spec.in

README.txt

The LLVM Compiler Infrastructure
================================

This directory and its subdirectories contain source code for LLVM,
a toolkit for the construction of highly optimized compilers,
optimizers, and runtime environments.

LLVM is open source software. You may freely distribute it under the terms of
the license agreement found in LICENSE.txt.

Please see the documentation provided in docs/ for further
assistance with LLVM, and in particular docs/GettingStarted.rst for getting
started with LLVM and docs/README.txt for an overview of LLVM's
documentation setup.

If you are writing a package for LLVM, see docs/Packaging.rst for our
suggestions.