OSDN Git Service

arm64: mte: Dump the MTE tags in the core file
authorCatalin Marinas <catalin.marinas@arm.com>
Mon, 31 Jan 2022 16:54:55 +0000 (16:54 +0000)
committerWill Deacon <will@kernel.org>
Tue, 15 Feb 2022 22:53:29 +0000 (22:53 +0000)
commit6dd8b1a0b6cb3ed93d24110e02e67ff9d006610a
tree4bbc7dd14cbcdf8fc6b960814d796e2cea96c538
parentab1e435ca7913e384ed801210418633eee43a71b
arm64: mte: Dump the MTE tags in the core file

For each vma mapped with PROT_MTE (the VM_MTE flag set), generate a
PT_ARM_MEMTAG_MTE segment in the core file and dump the corresponding
tags. The in-file size for such segments is 128 bytes per page.

For pages in a VM_MTE vma which are not present in the user page tables
or don't have the PG_mte_tagged flag set (e.g. execute-only), just write
zeros in the core file.

An example of program headers for two vmas, one 2-page, the other 4-page
long:

  Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz   Flg Align
  ...
  LOAD           0x030000 0x0000ffff80034000 0x0000000000000000 0x000000 0x002000 RW  0x1000
  LOAD           0x030000 0x0000ffff80036000 0x0000000000000000 0x004000 0x004000 RW  0x1000
  ...
  LOPROC+0x1     0x05b000 0x0000ffff80034000 0x0000000000000000 0x000100 0x002000     0
  LOPROC+0x1     0x05b100 0x0000ffff80036000 0x0000000000000000 0x000200 0x004000     0

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Luis Machado <luis.machado@linaro.org>
Reviewed-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20220131165456.2160675-5-catalin.marinas@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/Kconfig
arch/arm64/kernel/Makefile
arch/arm64/kernel/elfcore.c [new file with mode: 0644]