about summary refs log tree commit diff
path: root/include
diff options
context:
space:
mode:
authorSzabolcs Nagy <nsz@port70.net>2019-11-03 22:45:05 +0000
committerRich Felker <dalias@aerifal.cx>2019-12-30 18:12:49 -0500
commitf291c09ec90e2514c954020e9b9bdb30e2adfc7f (patch)
tree92e2a75e05a9121b9a76f22c2e17d4c82b36fac3 /include
parent06636c55428fe220ec4bdeecca723a95a75839ce (diff)
downloadmusl-f291c09ec90e2514c954020e9b9bdb30e2adfc7f.tar.gz
musl-f291c09ec90e2514c954020e9b9bdb30e2adfc7f.tar.xz
musl-f291c09ec90e2514c954020e9b9bdb30e2adfc7f.zip
sys/ptrace.h: add PTRACE_GET_SYSCALL_INFO from linux v5.3
ptrace API to get details of the syscall the tracee is blocked in, see

  linux commit 201766a20e30f982ccfe36bebfad9602c3ff574a
  ptrace: add PTRACE_GET_SYSCALL_INFO request

the align attribute was used to keep the layout the same across targets
e.g. on m68k uint32_t is 2 byte aligned, this helps with compat ptrace.
Diffstat (limited to 'include')
-rw-r--r--include/sys/ptrace.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/include/sys/ptrace.h b/include/sys/ptrace.h
index 229e1f3d..2a868093 100644
--- a/include/sys/ptrace.h
+++ b/include/sys/ptrace.h
@@ -41,6 +41,7 @@ extern "C" {
 #define PTRACE_SETSIGMASK 0x420b
 #define PTRACE_SECCOMP_GET_FILTER 0x420c
 #define PTRACE_SECCOMP_GET_METADATA 0x420d
+#define PTRACE_GET_SYSCALL_INFO 0x420e
 
 #define PT_READ_I PTRACE_PEEKTEXT
 #define PT_READ_D PTRACE_PEEKDATA
@@ -88,6 +89,11 @@ extern "C" {
 
 #define PTRACE_PEEKSIGINFO_SHARED 1
 
+#define PTRACE_SYSCALL_INFO_NONE 0
+#define PTRACE_SYSCALL_INFO_ENTRY 1
+#define PTRACE_SYSCALL_INFO_EXIT 2
+#define PTRACE_SYSCALL_INFO_SECCOMP 3
+
 #include <bits/ptrace.h>
 
 struct __ptrace_peeksiginfo_args {
@@ -101,6 +107,28 @@ struct __ptrace_seccomp_metadata {
 	uint64_t flags;
 };
 
+struct __ptrace_syscall_info {
+	uint8_t op;
+	uint32_t arch __attribute__((__aligned__(4)));
+	uint64_t instruction_pointer;
+	uint64_t stack_pointer;
+	union {
+		struct {
+			uint64_t nr;
+			uint64_t args[6];
+		} entry;
+		struct {
+			int64_t rval;
+			uint8_t is_error;
+		} exit;
+		struct {
+			uint64_t nr;
+			uint64_t args[6];
+			uint32_t ret_data;
+		} seccomp;
+	};
+};
+
 long ptrace(int, ...);
 
 #ifdef __cplusplus