2022-10-06 02:04:08

by Palmer Dabbelt

[permalink] [raw]
Subject: [PATCH] ptrace: Mark PTRACE_{PEEK,POKE}USR as deprecated for new ports

From: Palmer Dabbelt <[email protected]>

Folks keep submitting implementations of these for RISC-V. As far as I
understand they're not meant to be implemented in new ports, this adds a
comment to make that more explicit.

Signed-off-by: Palmer Dabbelt <[email protected]>
---
include/uapi/linux/ptrace.h | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/include/uapi/linux/ptrace.h b/include/uapi/linux/ptrace.h
index 195ae64a8c87..38201ebec276 100644
--- a/include/uapi/linux/ptrace.h
+++ b/include/uapi/linux/ptrace.h
@@ -11,14 +11,19 @@
#define PTRACE_TRACEME 0
#define PTRACE_PEEKTEXT 1
#define PTRACE_PEEKDATA 2
-#define PTRACE_PEEKUSR 3
#define PTRACE_POKETEXT 4
#define PTRACE_POKEDATA 5
-#define PTRACE_POKEUSR 6
#define PTRACE_CONT 7
#define PTRACE_KILL 8
#define PTRACE_SINGLESTEP 9

+/*
+ * These are deprecated for new ports in favor of PTRACE_{GET,SET}REGSET, which
+ * support accessing multiple CPU registers in a single syscall.
+ */
+#define PTRACE_PEEKUSR 3
+#define PTRACE_POKEUSR 6
+
#define PTRACE_ATTACH 16
#define PTRACE_DETACH 17

--
2.34.1