Skip to content

Commit c35fe2a

Browse files
ctmarinaswilldeacon
authored andcommitted
elf: Fix the arm64 MTE ELF segment name and value
Unfortunately, the name/value choice for the MTE ELF segment type (PT_ARM_MEMTAG_MTE) was pretty poor: LOPROC+1 is already in use by PT_AARCH64_UNWIND, as defined in the AArch64 ELF ABI (https://github.com/ARM-software/abi-aa/blob/main/aaelf64/aaelf64.rst). Update the ELF segment type value to LOPROC+2 and also change the define to PT_AARCH64_MEMTAG_MTE to match the AArch64 ELF ABI namespace. The AArch64 ELF ABI document is updating accordingly (segment type not previously mentioned in the document). Signed-off-by: Catalin Marinas <[email protected]> Fixes: 761b9b3 ("elf: Introduce the ARM MTE ELF segment type") Cc: Will Deacon <[email protected]> Cc: Jonathan Corbet <[email protected]> Cc: Eric Biederman <[email protected]> Cc: Kees Cook <[email protected]> Cc: Luis Machado <[email protected]> Cc: Richard Earnshaw <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 23bc8f6 commit c35fe2a

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

Documentation/arm64/memory-tagging-extension.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,10 @@ Core dump support
228228
-----------------
229229

230230
The allocation tags for user memory mapped with ``PROT_MTE`` are dumped
231-
in the core file as additional ``PT_ARM_MEMTAG_MTE`` segments. The
231+
in the core file as additional ``PT_AARCH64_MEMTAG_MTE`` segments. The
232232
program header for such segment is defined as:
233233

234-
:``p_type``: ``PT_ARM_MEMTAG_MTE``
234+
:``p_type``: ``PT_AARCH64_MEMTAG_MTE``
235235
:``p_flags``: 0
236236
:``p_offset``: segment file offset
237237
:``p_vaddr``: segment virtual address, same as the corresponding

arch/arm64/kernel/elfcore.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ int elf_core_write_extra_phdrs(struct coredump_params *cprm, loff_t offset)
9595
for_each_mte_vma(current, vma) {
9696
struct elf_phdr phdr;
9797

98-
phdr.p_type = PT_ARM_MEMTAG_MTE;
98+
phdr.p_type = PT_AARCH64_MEMTAG_MTE;
9999
phdr.p_offset = offset;
100100
phdr.p_vaddr = vma->vm_start;
101101
phdr.p_paddr = 0;

include/uapi/linux/elf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ typedef __s64 Elf64_Sxword;
4242

4343

4444
/* ARM MTE memory tag segment type */
45-
#define PT_ARM_MEMTAG_MTE (PT_LOPROC + 0x1)
45+
#define PT_AARCH64_MEMTAG_MTE (PT_LOPROC + 0x2)
4646

4747
/*
4848
* Extended Numbering

0 commit comments

Comments
 (0)