git: 3d0addcd3519 - main - linux(4): Make ptrace_pokeusr machine dependent
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 18 May 2023 17:02:53 UTC
The branch main has been updated by dchagin:
URL: https://cgit.FreeBSD.org/src/commit/?id=3d0addcd35193461e927db6cfe4b6d9b579eed6b
commit 3d0addcd35193461e927db6cfe4b6d9b579eed6b
Author: Dmitry Chagin <dchagin@FreeBSD.org>
AuthorDate: 2023-05-18 17:01:12 +0000
Commit: Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2023-05-18 17:01:12 +0000
linux(4): Make ptrace_pokeusr machine dependent
Differential Revision: https://reviews.freebsd.org/D40096
MFC after: 1 week
---
sys/amd64/linux/linux.h | 2 ++
sys/amd64/linux/linux_machdep.c | 8 ++++++++
sys/amd64/linux32/linux.h | 2 ++
sys/amd64/linux32/linux32_machdep.c | 9 +++++++++
sys/arm64/linux/linux.h | 2 ++
sys/arm64/linux/linux_machdep.c | 9 +++++++++
sys/compat/linux/linux_ptrace.c | 8 --------
7 files changed, 32 insertions(+), 8 deletions(-)
diff --git a/sys/amd64/linux/linux.h b/sys/amd64/linux/linux.h
index 698c560154ec..e1d5480100f9 100644
--- a/sys/amd64/linux/linux.h
+++ b/sys/amd64/linux/linux.h
@@ -279,6 +279,8 @@ int linux_ptrace_getregs_machdep(struct thread *td, pid_t pid,
struct linux_pt_regset *l_regset);
int linux_ptrace_peekuser(struct thread *td, pid_t pid,
void *addr, void *data);
+int linux_ptrace_pokeuser(struct thread *td, pid_t pid,
+ void *addr, void *data);
#endif /* _KERNEL */
#endif /* !_AMD64_LINUX_H_ */
diff --git a/sys/amd64/linux/linux_machdep.c b/sys/amd64/linux/linux_machdep.c
index 233d66a40899..ddb291169a03 100644
--- a/sys/amd64/linux/linux_machdep.c
+++ b/sys/amd64/linux/linux_machdep.c
@@ -397,4 +397,12 @@ linux_ptrace_peekuser(struct thread *td, pid_t pid, void *addr, void *data)
return (copyout(&val, data, sizeof(val)));
}
+int
+linux_ptrace_pokeuser(struct thread *td, pid_t pid, void *addr, void *data)
+{
+
+ LINUX_RATELIMIT_MSG_OPT1("PTRACE_POKEUSER offset %ld "
+ "not implemented; returning EINVAL", (uintptr_t)addr);
+ return (EINVAL);
+}
#undef LINUX_URO
diff --git a/sys/amd64/linux32/linux.h b/sys/amd64/linux32/linux.h
index 23cba6aa2e2c..218f7923f59d 100644
--- a/sys/amd64/linux32/linux.h
+++ b/sys/amd64/linux32/linux.h
@@ -433,6 +433,8 @@ void bsd_to_linux_regset32(const struct reg32 *b_reg,
struct linux_pt_regset32 *l_regset);
int linux_ptrace_peekuser(struct thread *td, pid_t pid,
void *addr, void *data);
+int linux_ptrace_pokeuser(struct thread *td, pid_t pid,
+ void *addr, void *data);
extern bool linux32_emulate_i386;
#endif /* _KERNEL */
diff --git a/sys/amd64/linux32/linux32_machdep.c b/sys/amd64/linux32/linux32_machdep.c
index afc60fb7e822..23d8f8767282 100644
--- a/sys/amd64/linux32/linux32_machdep.c
+++ b/sys/amd64/linux32/linux32_machdep.c
@@ -751,3 +751,12 @@ linux_ptrace_peekuser(struct thread *td, pid_t pid, void *addr, void *data)
"returning EINVAL", (uintptr_t)addr);
return (EINVAL);
}
+
+int
+linux_ptrace_pokeuser(struct thread *td, pid_t pid, void *addr, void *data)
+{
+
+ LINUX_RATELIMIT_MSG_OPT1("PTRACE_POKEUSER offset %ld "
+ "not implemented; returning EINVAL", (uintptr_t)addr);
+ return (EINVAL);
+}
diff --git a/sys/arm64/linux/linux.h b/sys/arm64/linux/linux.h
index 9ef50bce42a5..177579178705 100644
--- a/sys/arm64/linux/linux.h
+++ b/sys/arm64/linux/linux.h
@@ -206,6 +206,8 @@ int linux_ptrace_getregs_machdep(struct thread *td, pid_t pid,
struct linux_pt_regset *l_regset);
int linux_ptrace_peekuser(struct thread *td, pid_t pid,
void *addr, void *data);
+int linux_ptrace_pokeuser(struct thread *td, pid_t pid,
+ void *addr, void *data);
#endif /* _KERNEL */
#endif /* _ARM64_LINUX_H_ */
diff --git a/sys/arm64/linux/linux_machdep.c b/sys/arm64/linux/linux_machdep.c
index 2c0445bbed5d..8a7593ba94ba 100644
--- a/sys/arm64/linux/linux_machdep.c
+++ b/sys/arm64/linux/linux_machdep.c
@@ -160,3 +160,12 @@ linux_ptrace_peekuser(struct thread *td, pid_t pid, void *addr, void *data)
"returning EINVAL", (uintptr_t)addr);
return (EINVAL);
}
+
+int
+linux_ptrace_pokeuser(struct thread *td, pid_t pid, void *addr, void *data)
+{
+
+ LINUX_RATELIMIT_MSG_OPT1("PTRACE_POKEUSER offset %ld "
+ "not implemented; returning EINVAL", (uintptr_t)addr);
+ return (EINVAL);
+}
diff --git a/sys/compat/linux/linux_ptrace.c b/sys/compat/linux/linux_ptrace.c
index bc595ce106dc..fc93881bb32a 100644
--- a/sys/compat/linux/linux_ptrace.c
+++ b/sys/compat/linux/linux_ptrace.c
@@ -174,14 +174,6 @@ linux_ptrace_peek(struct thread *td, pid_t pid, void *addr, void *data)
return (error);
}
-static int
-linux_ptrace_pokeuser(struct thread *td, pid_t pid, void *addr, void *data)
-{
-
- linux_msg(td, "PTRACE_POKEUSER not implemented; returning EINVAL");
- return (EINVAL);
-}
-
static int
linux_ptrace_setoptions(struct thread *td, pid_t pid, l_ulong data)
{