diff options
Diffstat (limited to 'include/linux/ptrace.h')
| -rw-r--r-- | include/linux/ptrace.h | 94 |
1 files changed, 9 insertions, 85 deletions
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h index 597e4fdb97fe..e0ff4689d35a 100644 --- a/include/linux/ptrace.h +++ b/include/linux/ptrace.h | |||
| @@ -1,83 +1,13 @@ | |||
| 1 | #ifndef _LINUX_PTRACE_H | 1 | #ifndef _LINUX_PTRACE_H |
| 2 | #define _LINUX_PTRACE_H | 2 | #define _LINUX_PTRACE_H |
| 3 | /* ptrace.h */ | ||
| 4 | /* structs and defines to help the user use the ptrace system call. */ | ||
| 5 | 3 | ||
| 6 | /* has the defines to get at the registers. */ | 4 | #include <linux/compiler.h> /* For unlikely. */ |
| 7 | 5 | #include <linux/sched.h> /* For struct task_struct. */ | |
| 8 | #define PTRACE_TRACEME 0 | 6 | #include <linux/err.h> /* for IS_ERR_VALUE */ |
| 9 | #define PTRACE_PEEKTEXT 1 | 7 | #include <linux/bug.h> /* For BUG_ON. */ |
| 10 | #define PTRACE_PEEKDATA 2 | 8 | #include <uapi/linux/ptrace.h> |
| 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 | |||
| 19 | #define PTRACE_ATTACH 16 | ||
| 20 | #define PTRACE_DETACH 17 | ||
| 21 | |||
| 22 | #define PTRACE_SYSCALL 24 | ||
| 23 | |||
| 24 | /* 0x4200-0x4300 are reserved for architecture-independent additions. */ | ||
| 25 | #define PTRACE_SETOPTIONS 0x4200 | ||
| 26 | #define PTRACE_GETEVENTMSG 0x4201 | ||
| 27 | #define PTRACE_GETSIGINFO 0x4202 | ||
| 28 | #define PTRACE_SETSIGINFO 0x4203 | ||
| 29 | 9 | ||
| 30 | /* | 10 | /* |
| 31 | * Generic ptrace interface that exports the architecture specific regsets | ||
| 32 | * using the corresponding NT_* types (which are also used in the core dump). | ||
| 33 | * Please note that the NT_PRSTATUS note type in a core dump contains a full | ||
| 34 | * 'struct elf_prstatus'. But the user_regset for NT_PRSTATUS contains just the | ||
| 35 | * elf_gregset_t that is the pr_reg field of 'struct elf_prstatus'. For all the | ||
| 36 | * other user_regset flavors, the user_regset layout and the ELF core dump note | ||
| 37 | * payload are exactly the same layout. | ||
| 38 | * | ||
| 39 | * This interface usage is as follows: | ||
| 40 | * struct iovec iov = { buf, len}; | ||
| 41 | * | ||
| 42 | * ret = ptrace(PTRACE_GETREGSET/PTRACE_SETREGSET, pid, NT_XXX_TYPE, &iov); | ||
| 43 | * | ||
| 44 | * On the successful completion, iov.len will be updated by the kernel, | ||
| 45 | * specifying how much the kernel has written/read to/from the user's iov.buf. | ||
| 46 | */ | ||
| 47 | #define PTRACE_GETREGSET 0x4204 | ||
| 48 | #define PTRACE_SETREGSET 0x4205 | ||
| 49 | |||
| 50 | #define PTRACE_SEIZE 0x4206 | ||
| 51 | #define PTRACE_INTERRUPT 0x4207 | ||
| 52 | #define PTRACE_LISTEN 0x4208 | ||
| 53 | |||
| 54 | /* Wait extended result codes for the above trace options. */ | ||
| 55 | #define PTRACE_EVENT_FORK 1 | ||
| 56 | #define PTRACE_EVENT_VFORK 2 | ||
| 57 | #define PTRACE_EVENT_CLONE 3 | ||
| 58 | #define PTRACE_EVENT_EXEC 4 | ||
| 59 | #define PTRACE_EVENT_VFORK_DONE 5 | ||
| 60 | #define PTRACE_EVENT_EXIT 6 | ||
| 61 | #define PTRACE_EVENT_SECCOMP 7 | ||
| 62 | /* Extended result codes which enabled by means other than options. */ | ||
| 63 | #define PTRACE_EVENT_STOP 128 | ||
| 64 | |||
| 65 | /* Options set using PTRACE_SETOPTIONS or using PTRACE_SEIZE @data param */ | ||
| 66 | #define PTRACE_O_TRACESYSGOOD 1 | ||
| 67 | #define PTRACE_O_TRACEFORK (1 << PTRACE_EVENT_FORK) | ||
| 68 | #define PTRACE_O_TRACEVFORK (1 << PTRACE_EVENT_VFORK) | ||
| 69 | #define PTRACE_O_TRACECLONE (1 << PTRACE_EVENT_CLONE) | ||
| 70 | #define PTRACE_O_TRACEEXEC (1 << PTRACE_EVENT_EXEC) | ||
| 71 | #define PTRACE_O_TRACEVFORKDONE (1 << PTRACE_EVENT_VFORK_DONE) | ||
| 72 | #define PTRACE_O_TRACEEXIT (1 << PTRACE_EVENT_EXIT) | ||
| 73 | #define PTRACE_O_TRACESECCOMP (1 << PTRACE_EVENT_SECCOMP) | ||
| 74 | |||
| 75 | #define PTRACE_O_MASK 0x000000ff | ||
| 76 | |||
| 77 | #include <asm/ptrace.h> | ||
| 78 | |||
| 79 | #ifdef __KERNEL__ | ||
| 80 | /* | ||
| 81 | * Ptrace flags | 11 | * Ptrace flags |
| 82 | * | 12 | * |
| 83 | * The owner ship rules for task->ptrace which holds the ptrace | 13 | * The owner ship rules for task->ptrace which holds the ptrace |
| @@ -108,12 +38,6 @@ | |||
| 108 | #define PT_BLOCKSTEP_BIT 30 | 38 | #define PT_BLOCKSTEP_BIT 30 |
| 109 | #define PT_BLOCKSTEP (1<<PT_BLOCKSTEP_BIT) | 39 | #define PT_BLOCKSTEP (1<<PT_BLOCKSTEP_BIT) |
| 110 | 40 | ||
| 111 | #include <linux/compiler.h> /* For unlikely. */ | ||
| 112 | #include <linux/sched.h> /* For struct task_struct. */ | ||
| 113 | #include <linux/err.h> /* for IS_ERR_VALUE */ | ||
| 114 | #include <linux/bug.h> /* For BUG_ON. */ | ||
| 115 | |||
| 116 | |||
| 117 | extern long arch_ptrace(struct task_struct *child, long request, | 41 | extern long arch_ptrace(struct task_struct *child, long request, |
| 118 | unsigned long addr, unsigned long data); | 42 | unsigned long addr, unsigned long data); |
| 119 | extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len); | 43 | extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len); |
| @@ -130,8 +54,6 @@ extern void exit_ptrace(struct task_struct *tracer); | |||
| 130 | #define PTRACE_MODE_READ 0x01 | 54 | #define PTRACE_MODE_READ 0x01 |
| 131 | #define PTRACE_MODE_ATTACH 0x02 | 55 | #define PTRACE_MODE_ATTACH 0x02 |
| 132 | #define PTRACE_MODE_NOAUDIT 0x04 | 56 | #define PTRACE_MODE_NOAUDIT 0x04 |
| 133 | /* Returns 0 on success, -errno on denial. */ | ||
| 134 | extern int __ptrace_may_access(struct task_struct *task, unsigned int mode); | ||
| 135 | /* Returns true on success, false on denial. */ | 57 | /* Returns true on success, false on denial. */ |
| 136 | extern bool ptrace_may_access(struct task_struct *task, unsigned int mode); | 58 | extern bool ptrace_may_access(struct task_struct *task, unsigned int mode); |
| 137 | 59 | ||
| @@ -403,6 +325,10 @@ static inline void user_single_step_siginfo(struct task_struct *tsk, | |||
| 403 | #define arch_ptrace_stop(code, info) do { } while (0) | 325 | #define arch_ptrace_stop(code, info) do { } while (0) |
| 404 | #endif | 326 | #endif |
| 405 | 327 | ||
| 328 | #ifndef current_pt_regs | ||
| 329 | #define current_pt_regs() task_pt_regs(current) | ||
| 330 | #endif | ||
| 331 | |||
| 406 | extern int task_current_syscall(struct task_struct *target, long *callno, | 332 | extern int task_current_syscall(struct task_struct *target, long *callno, |
| 407 | unsigned long args[6], unsigned int maxargs, | 333 | unsigned long args[6], unsigned int maxargs, |
| 408 | unsigned long *sp, unsigned long *pc); | 334 | unsigned long *sp, unsigned long *pc); |
| @@ -414,6 +340,4 @@ extern void ptrace_put_breakpoints(struct task_struct *tsk); | |||
| 414 | static inline void ptrace_put_breakpoints(struct task_struct *tsk) { } | 340 | static inline void ptrace_put_breakpoints(struct task_struct *tsk) { } |
| 415 | #endif /* CONFIG_HAVE_HW_BREAKPOINT */ | 341 | #endif /* CONFIG_HAVE_HW_BREAKPOINT */ |
| 416 | 342 | ||
| 417 | #endif /* __KERNEL */ | ||
| 418 | |||
| 419 | #endif | 343 | #endif |
