All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] elf: Fix the arm64 MTE ELF segment name and value
@ 2022-04-25 15:18 ` Catalin Marinas
  0 siblings, 0 replies; 6+ messages in thread
From: Catalin Marinas @ 2022-04-25 15:18 UTC (permalink / raw)
  To: Will Deacon
  Cc: linux-arm-kernel, linux-kernel, Jonathan Corbet, Eric Biederman,
	Kees Cook, Luis Machado, Richard Earnshaw

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 <catalin.marinas@arm.com>
Fixes: 761b9b366cec ("elf: Introduce the ARM MTE ELF segment type")
Cc: Will Deacon <will@kernel.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Eric Biederman <ebiederm@xmission.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Luis Machado <luis.machado@arm.com>
Cc: Richard Earnshaw <Richard.Earnshaw@arm.com>
---

Luckily, the commit being fixed here only went in for 5.18-rc1, so there is no
ABI change in a mainline release.

FYI, the corresponding pull request for the AArch64 ELF ABI:

https://github.com/ARM-software/abi-aa/pull/148

I don't expect any further change to the segment name/value.

 Documentation/arm64/memory-tagging-extension.rst | 4 ++--
 arch/arm64/kernel/elfcore.c                      | 2 +-
 include/uapi/linux/elf.h                         | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Documentation/arm64/memory-tagging-extension.rst b/Documentation/arm64/memory-tagging-extension.rst
index dd27f78d7608..dbae47bba25e 100644
--- a/Documentation/arm64/memory-tagging-extension.rst
+++ b/Documentation/arm64/memory-tagging-extension.rst
@@ -228,10 +228,10 @@ Core dump support
 -----------------
 
 The allocation tags for user memory mapped with ``PROT_MTE`` are dumped
-in the core file as additional ``PT_ARM_MEMTAG_MTE`` segments. The
+in the core file as additional ``PT_AARCH64_MEMTAG_MTE`` segments. The
 program header for such segment is defined as:
 
-:``p_type``: ``PT_ARM_MEMTAG_MTE``
+:``p_type``: ``PT_AARCH64_MEMTAG_MTE``
 :``p_flags``: 0
 :``p_offset``: segment file offset
 :``p_vaddr``: segment virtual address, same as the corresponding
diff --git a/arch/arm64/kernel/elfcore.c b/arch/arm64/kernel/elfcore.c
index 2b3f3d0544b9..98d67444a5b6 100644
--- a/arch/arm64/kernel/elfcore.c
+++ b/arch/arm64/kernel/elfcore.c
@@ -95,7 +95,7 @@ int elf_core_write_extra_phdrs(struct coredump_params *cprm, loff_t offset)
 	for_each_mte_vma(current, vma) {
 		struct elf_phdr phdr;
 
-		phdr.p_type = PT_ARM_MEMTAG_MTE;
+		phdr.p_type = PT_AARCH64_MEMTAG_MTE;
 		phdr.p_offset = offset;
 		phdr.p_vaddr = vma->vm_start;
 		phdr.p_paddr = 0;
diff --git a/include/uapi/linux/elf.h b/include/uapi/linux/elf.h
index 787c657bfae8..7ce993e6786c 100644
--- a/include/uapi/linux/elf.h
+++ b/include/uapi/linux/elf.h
@@ -42,7 +42,7 @@ typedef __s64	Elf64_Sxword;
 
 
 /* ARM MTE memory tag segment type */
-#define PT_ARM_MEMTAG_MTE	(PT_LOPROC + 0x1)
+#define PT_AARCH64_MEMTAG_MTE	(PT_LOPROC + 0x2)
 
 /*
  * Extended Numbering

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] elf: Fix the arm64 MTE ELF segment name and value
@ 2022-04-25 15:18 ` Catalin Marinas
  0 siblings, 0 replies; 6+ messages in thread
From: Catalin Marinas @ 2022-04-25 15:18 UTC (permalink / raw)
  To: Will Deacon
  Cc: linux-arm-kernel, linux-kernel, Jonathan Corbet, Eric Biederman,
	Kees Cook, Luis Machado, Richard Earnshaw

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 <catalin.marinas@arm.com>
Fixes: 761b9b366cec ("elf: Introduce the ARM MTE ELF segment type")
Cc: Will Deacon <will@kernel.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Eric Biederman <ebiederm@xmission.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Luis Machado <luis.machado@arm.com>
Cc: Richard Earnshaw <Richard.Earnshaw@arm.com>
---

Luckily, the commit being fixed here only went in for 5.18-rc1, so there is no
ABI change in a mainline release.

FYI, the corresponding pull request for the AArch64 ELF ABI:

https://github.com/ARM-software/abi-aa/pull/148

I don't expect any further change to the segment name/value.

 Documentation/arm64/memory-tagging-extension.rst | 4 ++--
 arch/arm64/kernel/elfcore.c                      | 2 +-
 include/uapi/linux/elf.h                         | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Documentation/arm64/memory-tagging-extension.rst b/Documentation/arm64/memory-tagging-extension.rst
index dd27f78d7608..dbae47bba25e 100644
--- a/Documentation/arm64/memory-tagging-extension.rst
+++ b/Documentation/arm64/memory-tagging-extension.rst
@@ -228,10 +228,10 @@ Core dump support
 -----------------
 
 The allocation tags for user memory mapped with ``PROT_MTE`` are dumped
-in the core file as additional ``PT_ARM_MEMTAG_MTE`` segments. The
+in the core file as additional ``PT_AARCH64_MEMTAG_MTE`` segments. The
 program header for such segment is defined as:
 
-:``p_type``: ``PT_ARM_MEMTAG_MTE``
+:``p_type``: ``PT_AARCH64_MEMTAG_MTE``
 :``p_flags``: 0
 :``p_offset``: segment file offset
 :``p_vaddr``: segment virtual address, same as the corresponding
diff --git a/arch/arm64/kernel/elfcore.c b/arch/arm64/kernel/elfcore.c
index 2b3f3d0544b9..98d67444a5b6 100644
--- a/arch/arm64/kernel/elfcore.c
+++ b/arch/arm64/kernel/elfcore.c
@@ -95,7 +95,7 @@ int elf_core_write_extra_phdrs(struct coredump_params *cprm, loff_t offset)
 	for_each_mte_vma(current, vma) {
 		struct elf_phdr phdr;
 
-		phdr.p_type = PT_ARM_MEMTAG_MTE;
+		phdr.p_type = PT_AARCH64_MEMTAG_MTE;
 		phdr.p_offset = offset;
 		phdr.p_vaddr = vma->vm_start;
 		phdr.p_paddr = 0;
diff --git a/include/uapi/linux/elf.h b/include/uapi/linux/elf.h
index 787c657bfae8..7ce993e6786c 100644
--- a/include/uapi/linux/elf.h
+++ b/include/uapi/linux/elf.h
@@ -42,7 +42,7 @@ typedef __s64	Elf64_Sxword;
 
 
 /* ARM MTE memory tag segment type */
-#define PT_ARM_MEMTAG_MTE	(PT_LOPROC + 0x1)
+#define PT_AARCH64_MEMTAG_MTE	(PT_LOPROC + 0x2)
 
 /*
  * Extended Numbering

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] elf: Fix the arm64 MTE ELF segment name and value
  2022-04-25 15:18 ` Catalin Marinas
@ 2022-04-28 13:50   ` Will Deacon
  -1 siblings, 0 replies; 6+ messages in thread
From: Will Deacon @ 2022-04-28 13:50 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: kernel-team, Will Deacon, Jonathan Corbet, Kees Cook,
	Luis Machado, linux-kernel, Richard Earnshaw, Eric Biederman,
	linux-arm-kernel

On Mon, 25 Apr 2022 16:18:33 +0100, Catalin Marinas wrote:
> 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).
> 
> [...]

Applied to arm64 (for-next/fixes), thanks!

[1/1] elf: Fix the arm64 MTE ELF segment name and value
      https://git.kernel.org/arm64/c/c35fe2a68f29

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] elf: Fix the arm64 MTE ELF segment name and value
@ 2022-04-28 13:50   ` Will Deacon
  0 siblings, 0 replies; 6+ messages in thread
From: Will Deacon @ 2022-04-28 13:50 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: kernel-team, Will Deacon, Jonathan Corbet, Kees Cook,
	Luis Machado, linux-kernel, Richard Earnshaw, Eric Biederman,
	linux-arm-kernel

On Mon, 25 Apr 2022 16:18:33 +0100, Catalin Marinas wrote:
> 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).
> 
> [...]

Applied to arm64 (for-next/fixes), thanks!

[1/1] elf: Fix the arm64 MTE ELF segment name and value
      https://git.kernel.org/arm64/c/c35fe2a68f29

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] elf: Fix the arm64 MTE ELF segment name and value
  2022-04-25 15:18 ` Catalin Marinas
@ 2022-04-28 17:09   ` Kees Cook
  -1 siblings, 0 replies; 6+ messages in thread
From: Kees Cook @ 2022-04-28 17:09 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: Will Deacon, linux-arm-kernel, linux-kernel, Jonathan Corbet,
	Eric Biederman, Luis Machado, Richard Earnshaw

On Mon, Apr 25, 2022 at 04:18:33PM +0100, Catalin Marinas wrote:
> 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 <catalin.marinas@arm.com>

Reviewed-by: Kees Cook <keescook@chromium.org>

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] elf: Fix the arm64 MTE ELF segment name and value
@ 2022-04-28 17:09   ` Kees Cook
  0 siblings, 0 replies; 6+ messages in thread
From: Kees Cook @ 2022-04-28 17:09 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: Will Deacon, linux-arm-kernel, linux-kernel, Jonathan Corbet,
	Eric Biederman, Luis Machado, Richard Earnshaw

On Mon, Apr 25, 2022 at 04:18:33PM +0100, Catalin Marinas wrote:
> 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 <catalin.marinas@arm.com>

Reviewed-by: Kees Cook <keescook@chromium.org>

-- 
Kees Cook

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-04-28 17:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-25 15:18 [PATCH] elf: Fix the arm64 MTE ELF segment name and value Catalin Marinas
2022-04-25 15:18 ` Catalin Marinas
2022-04-28 13:50 ` Will Deacon
2022-04-28 13:50   ` Will Deacon
2022-04-28 17:09 ` Kees Cook
2022-04-28 17:09   ` Kees Cook

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.