Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64: mte: Fix PTRACE_{PEEK,POKE}MTETAGS error documentation
@ 2026-09-07 11:30 Catalin Marinas
  2026-09-11 13:44 ` Will Deacon
  0 siblings, 1 reply; 2+ messages in thread
From: Catalin Marinas @ 2026-09-07 11:30 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: Yury Khrustalev, Will Deacon, Mark Rutland

PTRACE_{PEEK,POKE}MTETAGS return -EIO rather than -EOPNOTSUPP (as
documented) when no tags are copied from/to a mapping without PROT_MTE.
This has been the behaviour since the interface was introduced, though
the original intent was to distinguish between address not being
accessible and mapped as untagged.

Update the documentation to match the implementation (de-facto ABI).
Since -EOPNOTSUPP was never returned, change the error assignment to
-EIO as well to avoid confusion.

Fixes: df9d7a22dd21 ("arm64: mte: Add Memory Tagging Extension documentation")
Fixes: 18ddbaa02b7a ("arm64: mte: ptrace: Add PTRACE_{PEEK,POKE}MTETAGS support")
Reported-by: Yury Khrustalev <yury.khrustalev@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
---

The alternative is to fix the returned error but given that the bug has
been around for 6 years, we can say it's ABI irrespective of what the
documentation says.

 Documentation/arch/arm64/memory-tagging-extension.rst | 5 ++---
 arch/arm64/kernel/mte.c                               | 2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/Documentation/arch/arm64/memory-tagging-extension.rst b/Documentation/arch/arm64/memory-tagging-extension.rst
index e6fe428f0e2a..1d32fc5df183 100644
--- a/Documentation/arch/arm64/memory-tagging-extension.rst
+++ b/Documentation/arch/arm64/memory-tagging-extension.rst
@@ -208,11 +208,10 @@ will use the corresponding aligned address.
   tracer's space cannot be accessed or does not have valid tags.
 - ``-EPERM`` - the specified process cannot be traced.
 - ``-EIO`` - the tracee's address range cannot be accessed (e.g. invalid
-  address) and no tags copied. ``iov_len`` not updated.
+  address) or does not have valid tags (not mapped with the ``PROT_MTE``
+  flag) and no tags copied. ``iov_len`` not updated.
 - ``-EFAULT`` - fault on accessing the tracer's memory (``struct iovec``
   or ``iov_base`` buffer) and no tags copied. ``iov_len`` not updated.
-- ``-EOPNOTSUPP`` - the tracee's address does not have valid tags (never
-  mapped with the ``PROT_MTE`` flag). ``iov_len`` not updated.
 
 **Note**: There are no transient errors for the requests above, so user
 programs should not retry in case of a non-zero system call return.
diff --git a/arch/arm64/kernel/mte.c b/arch/arm64/kernel/mte.c
index 1a9aad6ef22a..31f5c6b0510e 100644
--- a/arch/arm64/kernel/mte.c
+++ b/arch/arm64/kernel/mte.c
@@ -476,7 +476,7 @@ static int __access_remote_tags(struct mm_struct *mm, unsigned long addr,
 		 * was never mapped with PROT_MTE.
 		 */
 		if (!(vma->vm_flags & VM_MTE)) {
-			err = -EOPNOTSUPP;
+			err = -EIO;
 			put_page(page);
 			break;
 		}


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

* Re: [PATCH] arm64: mte: Fix PTRACE_{PEEK,POKE}MTETAGS error documentation
  2026-09-07 11:30 [PATCH] arm64: mte: Fix PTRACE_{PEEK,POKE}MTETAGS error documentation Catalin Marinas
@ 2026-09-11 13:44 ` Will Deacon
  0 siblings, 0 replies; 2+ messages in thread
From: Will Deacon @ 2026-09-11 13:44 UTC (permalink / raw)
  To: linux-arm-kernel, Catalin Marinas
  Cc: mark.rutland, kernel-team, Will Deacon, Yury Khrustalev

On Mon, 07 Sep 2026 12:30:25 +0100, Catalin Marinas wrote:
> PTRACE_{PEEK,POKE}MTETAGS return -EIO rather than -EOPNOTSUPP (as
> documented) when no tags are copied from/to a mapping without PROT_MTE.
> This has been the behaviour since the interface was introduced, though
> the original intent was to distinguish between address not being
> accessible and mapped as untagged.
> 
> Update the documentation to match the implementation (de-facto ABI).
> Since -EOPNOTSUPP was never returned, change the error assignment to
> -EIO as well to avoid confusion.
> 
> [...]

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

[1/1] arm64: mte: Fix PTRACE_{PEEK,POKE}MTETAGS error documentation
      https://git.kernel.org/arm64/c/fdb9ebc7fb77

Cheers,
-- 
Will

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


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

end of thread, other threads:[~2026-09-11 13:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-07 11:30 [PATCH] arm64: mte: Fix PTRACE_{PEEK,POKE}MTETAGS error documentation Catalin Marinas
2026-09-11 13:44 ` Will Deacon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox