[all-commits] [llvm/llvm-project] 3a3d1b: [lldb][AArch64] Handle core file tag segments miss...

David Spickett via All-commits all-commits at lists.llvm.org
Wed Jun 25 02:32:01 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3a3d1bf4a39bbbe1cfdc56ab9eeeb13cb438348a
      https://github.com/llvm/llvm-project/commit/3a3d1bf4a39bbbe1cfdc56ab9eeeb13cb438348a
  Author: David Spickett <david.spickett at linaro.org>
  Date:   2025-06-25 (Wed, 25 Jun 2025)

  Changed paths:
    M lldb/include/lldb/Target/MemoryTagManager.h
    M lldb/source/Plugins/Process/Utility/MemoryTagManagerAArch64MTE.cpp
    M lldb/source/Plugins/Process/Utility/MemoryTagManagerAArch64MTE.h
    M lldb/test/API/linux/aarch64/mte_core_file/TestAArch64LinuxMTEMemoryTagCoreFile.py
    A lldb/test/API/linux/aarch64/mte_core_file/core.mte.notags
    M lldb/test/API/linux/aarch64/mte_core_file/main.c
    M lldb/unittests/Process/Utility/MemoryTagManagerAArch64MTETest.cpp

  Log Message:
  -----------
  [lldb][AArch64] Handle core file tag segments missing tag data (#145338)

In the same way that memory regions may be known from a core file but
not readable, tag segments can also have no content. For example:
```
$ readelf --segments core
<...>
Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
<...>
  LOAD           0x0000000000002000 0x0000ffff93899000 0x0000000000000000
                 0x0000000000000000 0x0000000000001000  RW     0x1000
<...>
  LOPROC+0x2     0x0000000000008000 0x0000ffff93899000 0x0000000000000000
                 0x0000000000000000 0x0000000000001000         0x0
```
This happens if you have a restricted coredump filter or size limit.

The area of virtual memory this segment covers is 0x1000, or 4096 bytes
aka one tagged page. It's FileSiz would normally be 0x80. Tags are
packed 2 per byte and granules are 16 bytes. 4096 / 16 / 2 = 128 or
0x80.

But here it has no data, and in theory a corrupt file might have some
data but not all. This triggered an assert in
UnpackTagsFromCoreFileSegment and crashed lldb.

To fix this I have made UnpackTagsFromCoreFileSegment return an expected
and returned an error in this case instead of asserting. This will be
seen by the user, as shown in the added API test.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list