logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

ptrace.h (5501B)


  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. #ifndef _LINUX_PTRACE_H
  3. #define _LINUX_PTRACE_H
  4. /* ptrace.h */
  5. /* structs and defines to help the user use the ptrace system call. */
  6. /* has the defines to get at the registers. */
  7. #include <linux/types.h>
  8. #define PTRACE_TRACEME 0
  9. #define PTRACE_PEEKTEXT 1
  10. #define PTRACE_PEEKDATA 2
  11. #define PTRACE_PEEKUSR 3
  12. #define PTRACE_POKETEXT 4
  13. #define PTRACE_POKEDATA 5
  14. #define PTRACE_POKEUSR 6
  15. #define PTRACE_CONT 7
  16. #define PTRACE_KILL 8
  17. #define PTRACE_SINGLESTEP 9
  18. #define PTRACE_ATTACH 16
  19. #define PTRACE_DETACH 17
  20. #define PTRACE_SYSCALL 24
  21. /* 0x4200-0x4300 are reserved for architecture-independent additions. */
  22. #define PTRACE_SETOPTIONS 0x4200
  23. #define PTRACE_GETEVENTMSG 0x4201
  24. #define PTRACE_GETSIGINFO 0x4202
  25. #define PTRACE_SETSIGINFO 0x4203
  26. /*
  27. * Generic ptrace interface that exports the architecture specific regsets
  28. * using the corresponding NT_* types (which are also used in the core dump).
  29. * Please note that the NT_PRSTATUS note type in a core dump contains a full
  30. * 'struct elf_prstatus'. But the user_regset for NT_PRSTATUS contains just the
  31. * elf_gregset_t that is the pr_reg field of 'struct elf_prstatus'. For all the
  32. * other user_regset flavors, the user_regset layout and the ELF core dump note
  33. * payload are exactly the same layout.
  34. *
  35. * This interface usage is as follows:
  36. * struct iovec iov = { buf, len};
  37. *
  38. * ret = ptrace(PTRACE_GETREGSET/PTRACE_SETREGSET, pid, NT_XXX_TYPE, &iov);
  39. *
  40. * On the successful completion, iov.len will be updated by the kernel,
  41. * specifying how much the kernel has written/read to/from the user's iov.buf.
  42. */
  43. #define PTRACE_GETREGSET 0x4204
  44. #define PTRACE_SETREGSET 0x4205
  45. #define PTRACE_SEIZE 0x4206
  46. #define PTRACE_INTERRUPT 0x4207
  47. #define PTRACE_LISTEN 0x4208
  48. #define PTRACE_PEEKSIGINFO 0x4209
  49. struct ptrace_peeksiginfo_args {
  50. __u64 off; /* from which siginfo to start */
  51. __u32 flags;
  52. __s32 nr; /* how may siginfos to take */
  53. };
  54. #define PTRACE_GETSIGMASK 0x420a
  55. #define PTRACE_SETSIGMASK 0x420b
  56. #define PTRACE_SECCOMP_GET_FILTER 0x420c
  57. #define PTRACE_SECCOMP_GET_METADATA 0x420d
  58. struct seccomp_metadata {
  59. __u64 filter_off; /* Input: which filter */
  60. __u64 flags; /* Output: filter's flags */
  61. };
  62. #define PTRACE_GET_SYSCALL_INFO 0x420e
  63. #define PTRACE_SYSCALL_INFO_NONE 0
  64. #define PTRACE_SYSCALL_INFO_ENTRY 1
  65. #define PTRACE_SYSCALL_INFO_EXIT 2
  66. #define PTRACE_SYSCALL_INFO_SECCOMP 3
  67. struct ptrace_syscall_info {
  68. __u8 op; /* PTRACE_SYSCALL_INFO_* */
  69. __u8 pad[3];
  70. __u32 arch;
  71. __u64 instruction_pointer;
  72. __u64 stack_pointer;
  73. union {
  74. struct {
  75. __u64 nr;
  76. __u64 args[6];
  77. } entry;
  78. struct {
  79. __s64 rval;
  80. __u8 is_error;
  81. } exit;
  82. struct {
  83. __u64 nr;
  84. __u64 args[6];
  85. __u32 ret_data;
  86. } seccomp;
  87. };
  88. };
  89. #define PTRACE_GET_RSEQ_CONFIGURATION 0x420f
  90. struct ptrace_rseq_configuration {
  91. __u64 rseq_abi_pointer;
  92. __u32 rseq_abi_size;
  93. __u32 signature;
  94. __u32 flags;
  95. __u32 pad;
  96. };
  97. #define PTRACE_SET_SYSCALL_USER_DISPATCH_CONFIG 0x4210
  98. #define PTRACE_GET_SYSCALL_USER_DISPATCH_CONFIG 0x4211
  99. /*
  100. * struct ptrace_sud_config - Per-task configuration for Syscall User Dispatch
  101. * @mode: One of PR_SYS_DISPATCH_ON or PR_SYS_DISPATCH_OFF
  102. * @selector: Tracees user virtual address of SUD selector
  103. * @offset: SUD exclusion area (virtual address)
  104. * @len: Length of SUD exclusion area
  105. *
  106. * Used to get/set the syscall user dispatch configuration for a tracee.
  107. * Selector is optional (may be NULL), and if invalid will produce
  108. * a SIGSEGV in the tracee upon first access.
  109. *
  110. * If mode is PR_SYS_DISPATCH_ON, syscall dispatch will be enabled. If
  111. * PR_SYS_DISPATCH_OFF, syscall dispatch will be disabled and all other
  112. * parameters must be 0. The value in *selector (if not null), also determines
  113. * whether syscall dispatch will occur.
  114. *
  115. * The Syscall User Dispatch Exclusion area described by offset/len is the
  116. * virtual address space from which syscalls will not produce a user
  117. * dispatch.
  118. */
  119. struct ptrace_sud_config {
  120. __u64 mode;
  121. __u64 selector;
  122. __u64 offset;
  123. __u64 len;
  124. };
  125. /*
  126. * These values are stored in task->ptrace_message
  127. * by ptrace_stop to describe the current syscall-stop.
  128. */
  129. #define PTRACE_EVENTMSG_SYSCALL_ENTRY 1
  130. #define PTRACE_EVENTMSG_SYSCALL_EXIT 2
  131. /* Read signals from a shared (process wide) queue */
  132. #define PTRACE_PEEKSIGINFO_SHARED (1 << 0)
  133. /* Wait extended result codes for the above trace options. */
  134. #define PTRACE_EVENT_FORK 1
  135. #define PTRACE_EVENT_VFORK 2
  136. #define PTRACE_EVENT_CLONE 3
  137. #define PTRACE_EVENT_EXEC 4
  138. #define PTRACE_EVENT_VFORK_DONE 5
  139. #define PTRACE_EVENT_EXIT 6
  140. #define PTRACE_EVENT_SECCOMP 7
  141. /* Extended result codes which enabled by means other than options. */
  142. #define PTRACE_EVENT_STOP 128
  143. /* Options set using PTRACE_SETOPTIONS or using PTRACE_SEIZE @data param */
  144. #define PTRACE_O_TRACESYSGOOD 1
  145. #define PTRACE_O_TRACEFORK (1 << PTRACE_EVENT_FORK)
  146. #define PTRACE_O_TRACEVFORK (1 << PTRACE_EVENT_VFORK)
  147. #define PTRACE_O_TRACECLONE (1 << PTRACE_EVENT_CLONE)
  148. #define PTRACE_O_TRACEEXEC (1 << PTRACE_EVENT_EXEC)
  149. #define PTRACE_O_TRACEVFORKDONE (1 << PTRACE_EVENT_VFORK_DONE)
  150. #define PTRACE_O_TRACEEXIT (1 << PTRACE_EVENT_EXIT)
  151. #define PTRACE_O_TRACESECCOMP (1 << PTRACE_EVENT_SECCOMP)
  152. /* eventless options */
  153. #define PTRACE_O_EXITKILL (1 << 20)
  154. #define PTRACE_O_SUSPEND_SECCOMP (1 << 21)
  155. #define PTRACE_O_MASK (\
  156. 0x000000ff | PTRACE_O_EXITKILL | PTRACE_O_SUSPEND_SECCOMP)
  157. #include <asm/ptrace.h>
  158. #endif /* _LINUX_PTRACE_H */