about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/bits/ptrace-shared.h
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2019-10-14 23:43:52 +0000
committerJoseph Myers <joseph@codesourcery.com>2019-10-14 23:43:52 +0000
commitd1e411e5c786ce3028d98b4e6fc02c2fcf66ae37 (patch)
tree0a86a0ed2758892ef02f78f2207c38b92bbe3221 /sysdeps/unix/sysv/linux/bits/ptrace-shared.h
parent2e4e75727eb05eef4c10470d865bd42962d5fae7 (diff)
downloadglibc-d1e411e5c786ce3028d98b4e6fc02c2fcf66ae37.tar.gz
glibc-d1e411e5c786ce3028d98b4e6fc02c2fcf66ae37.tar.xz
glibc-d1e411e5c786ce3028d98b4e6fc02c2fcf66ae37.zip
Add PTRACE_GET_SYSCALL_INFO from Linux 5.3 to sys/ptrace.h.
Linux 5.3 adds a PTRACE_GET_SYSCALL_INFO constant, with an associated
structure and PTRACE_SYSCALL_INFO_* constants.

This patch adds these to sys/ptrace.h in glibc
(PTRACE_GET_SYSCALL_INFO in each architecture version, the rest in
bits/ptrace-shared.h).  As with previous such constants and associated
structures, the glibc version of the structure is named struct
__ptrace_syscall_info.

Tested for x86_64, and with build-many-glibcs.py.
Diffstat (limited to 'sysdeps/unix/sysv/linux/bits/ptrace-shared.h')
-rw-r--r--sysdeps/unix/sysv/linux/bits/ptrace-shared.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/linux/bits/ptrace-shared.h b/sysdeps/unix/sysv/linux/bits/ptrace-shared.h
index 1dc1ec79b1..f351d2f45b 100644
--- a/sysdeps/unix/sysv/linux/bits/ptrace-shared.h
+++ b/sysdeps/unix/sysv/linux/bits/ptrace-shared.h
@@ -52,6 +52,15 @@ enum __ptrace_eventcodes
   PTRACE_EVENT_STOP	= 128
 };
 
+/* Type of stop for PTRACE_GET_SYSCALL_INFO.  */
+enum __ptrace_get_syscall_info_op
+{
+  PTRACE_SYSCALL_INFO_NONE = 0,
+  PTRACE_SYSCALL_INFO_ENTRY = 1,
+  PTRACE_SYSCALL_INFO_EXIT = 2,
+  PTRACE_SYSCALL_INFO_SECCOMP = 3
+};
+
 /* Arguments for PTRACE_PEEKSIGINFO.  */
 struct __ptrace_peeksiginfo_args
 {
@@ -73,6 +82,44 @@ struct __ptrace_seccomp_metadata
   __uint64_t flags;		/* Output: filter's flags.  */
 };
 
+/* Results of PTRACE_GET_SYSCALL_INFO.  */
+struct __ptrace_syscall_info
+{
+  __uint8_t op;			/* One of the enum
+				   __ptrace_get_syscall_info_op
+				   values.  */
+  __uint32_t arch __attribute__ ((__aligned__ (4))); /* AUDIT_ARCH_*
+							value.  */
+  __uint64_t instruction_pointer; /* Instruction pointer.  */
+  __uint64_t stack_pointer;	/* Stack pointer.  */
+  union
+  {
+    /* System call number and arguments, for
+       PTRACE_SYSCALL_INFO_ENTRY.  */
+    struct
+    {
+      __uint64_t nr;
+      __uint64_t args[6];
+    } entry;
+    /* System call return value and error flag, for
+       PTRACE_SYSCALL_INFO_EXIT.  */
+    struct
+    {
+      __int64_t rval;
+      __uint8_t is_error;
+    } exit;
+    /* System call number, arguments and SECCOMP_RET_DATA portion of
+       SECCOMP_RET_TRACE return value, for
+       PTRACE_SYSCALL_INFO_SECCOMP.  */
+    struct
+    {
+      __uint64_t nr;
+      __uint64_t args[6];
+      __uint32_t ret_data;
+    } seccomp;
+  };
+};
+
 /* Perform process tracing functions.  REQUEST is one of the values
    above, and determines the action to be taken.
    For all requests except PTRACE_TRACEME, PID specifies the process to be