diff options
Diffstat (limited to 'include/linux/uprobes.h')
-rw-r--r-- | include/linux/uprobes.h | 52 |
1 files changed, 20 insertions, 32 deletions
diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h index 319eae70fe84..e32251e00e62 100644 --- a/include/linux/uprobes.h +++ b/include/linux/uprobes.h | |||
@@ -26,16 +26,13 @@ | |||
26 | 26 | ||
27 | #include <linux/errno.h> | 27 | #include <linux/errno.h> |
28 | #include <linux/rbtree.h> | 28 | #include <linux/rbtree.h> |
29 | #include <linux/types.h> | ||
29 | 30 | ||
30 | struct vm_area_struct; | 31 | struct vm_area_struct; |
31 | struct mm_struct; | 32 | struct mm_struct; |
32 | struct inode; | 33 | struct inode; |
33 | struct notifier_block; | 34 | struct notifier_block; |
34 | 35 | ||
35 | #ifdef CONFIG_ARCH_SUPPORTS_UPROBES | ||
36 | # include <asm/uprobes.h> | ||
37 | #endif | ||
38 | |||
39 | #define UPROBE_HANDLER_REMOVE 1 | 36 | #define UPROBE_HANDLER_REMOVE 1 |
40 | #define UPROBE_HANDLER_MASK 1 | 37 | #define UPROBE_HANDLER_MASK 1 |
41 | 38 | ||
@@ -60,6 +57,8 @@ struct uprobe_consumer { | |||
60 | }; | 57 | }; |
61 | 58 | ||
62 | #ifdef CONFIG_UPROBES | 59 | #ifdef CONFIG_UPROBES |
60 | #include <asm/uprobes.h> | ||
61 | |||
63 | enum uprobe_task_state { | 62 | enum uprobe_task_state { |
64 | UTASK_RUNNING, | 63 | UTASK_RUNNING, |
65 | UTASK_SSTEP, | 64 | UTASK_SSTEP, |
@@ -72,35 +71,28 @@ enum uprobe_task_state { | |||
72 | */ | 71 | */ |
73 | struct uprobe_task { | 72 | struct uprobe_task { |
74 | enum uprobe_task_state state; | 73 | enum uprobe_task_state state; |
75 | struct arch_uprobe_task autask; | ||
76 | 74 | ||
77 | struct return_instance *return_instances; | 75 | union { |
78 | unsigned int depth; | 76 | struct { |
79 | struct uprobe *active_uprobe; | 77 | struct arch_uprobe_task autask; |
78 | unsigned long vaddr; | ||
79 | }; | ||
80 | 80 | ||
81 | struct { | ||
82 | struct callback_head dup_xol_work; | ||
83 | unsigned long dup_xol_addr; | ||
84 | }; | ||
85 | }; | ||
86 | |||
87 | struct uprobe *active_uprobe; | ||
81 | unsigned long xol_vaddr; | 88 | unsigned long xol_vaddr; |
82 | unsigned long vaddr; | ||
83 | }; | ||
84 | 89 | ||
85 | /* | 90 | struct return_instance *return_instances; |
86 | * On a breakpoint hit, thread contests for a slot. It frees the | 91 | unsigned int depth; |
87 | * slot after singlestep. Currently a fixed number of slots are | ||
88 | * allocated. | ||
89 | */ | ||
90 | struct xol_area { | ||
91 | wait_queue_head_t wq; /* if all slots are busy */ | ||
92 | atomic_t slot_count; /* number of in-use slots */ | ||
93 | unsigned long *bitmap; /* 0 = free slot */ | ||
94 | struct page *page; | ||
95 | |||
96 | /* | ||
97 | * We keep the vma's vm_start rather than a pointer to the vma | ||
98 | * itself. The probed process or a naughty kernel module could make | ||
99 | * the vma go away, and we must handle that reasonably gracefully. | ||
100 | */ | ||
101 | unsigned long vaddr; /* Page(s) of instruction slots */ | ||
102 | }; | 92 | }; |
103 | 93 | ||
94 | struct xol_area; | ||
95 | |||
104 | struct uprobes_state { | 96 | struct uprobes_state { |
105 | struct xol_area *xol_area; | 97 | struct xol_area *xol_area; |
106 | }; | 98 | }; |
@@ -109,6 +101,7 @@ extern int __weak set_swbp(struct arch_uprobe *aup, struct mm_struct *mm, unsign | |||
109 | extern int __weak set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr); | 101 | extern int __weak set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr); |
110 | extern bool __weak is_swbp_insn(uprobe_opcode_t *insn); | 102 | extern bool __weak is_swbp_insn(uprobe_opcode_t *insn); |
111 | extern bool __weak is_trap_insn(uprobe_opcode_t *insn); | 103 | extern bool __weak is_trap_insn(uprobe_opcode_t *insn); |
104 | extern unsigned long __weak uprobe_get_swbp_addr(struct pt_regs *regs); | ||
112 | extern int uprobe_write_opcode(struct mm_struct *mm, unsigned long vaddr, uprobe_opcode_t); | 105 | extern int uprobe_write_opcode(struct mm_struct *mm, unsigned long vaddr, uprobe_opcode_t); |
113 | extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); | 106 | extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); |
114 | extern int uprobe_apply(struct inode *inode, loff_t offset, struct uprobe_consumer *uc, bool); | 107 | extern int uprobe_apply(struct inode *inode, loff_t offset, struct uprobe_consumer *uc, bool); |
@@ -120,7 +113,6 @@ extern void uprobe_end_dup_mmap(void); | |||
120 | extern void uprobe_dup_mmap(struct mm_struct *oldmm, struct mm_struct *newmm); | 113 | extern void uprobe_dup_mmap(struct mm_struct *oldmm, struct mm_struct *newmm); |
121 | extern void uprobe_free_utask(struct task_struct *t); | 114 | extern void uprobe_free_utask(struct task_struct *t); |
122 | extern void uprobe_copy_process(struct task_struct *t, unsigned long flags); | 115 | extern void uprobe_copy_process(struct task_struct *t, unsigned long flags); |
123 | extern unsigned long __weak uprobe_get_swbp_addr(struct pt_regs *regs); | ||
124 | extern int uprobe_post_sstep_notifier(struct pt_regs *regs); | 116 | extern int uprobe_post_sstep_notifier(struct pt_regs *regs); |
125 | extern int uprobe_pre_sstep_notifier(struct pt_regs *regs); | 117 | extern int uprobe_pre_sstep_notifier(struct pt_regs *regs); |
126 | extern void uprobe_notify_resume(struct pt_regs *regs); | 118 | extern void uprobe_notify_resume(struct pt_regs *regs); |
@@ -176,10 +168,6 @@ static inline bool uprobe_deny_signal(void) | |||
176 | { | 168 | { |
177 | return false; | 169 | return false; |
178 | } | 170 | } |
179 | static inline unsigned long uprobe_get_swbp_addr(struct pt_regs *regs) | ||
180 | { | ||
181 | return 0; | ||
182 | } | ||
183 | static inline void uprobe_free_utask(struct task_struct *t) | 171 | static inline void uprobe_free_utask(struct task_struct *t) |
184 | { | 172 | { |
185 | } | 173 | } |