aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/uprobes.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/uprobes.h')
-rw-r--r--include/linux/uprobes.h52
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
30struct vm_area_struct; 31struct vm_area_struct;
31struct mm_struct; 32struct mm_struct;
32struct inode; 33struct inode;
33struct notifier_block; 34struct 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
63enum uprobe_task_state { 62enum 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 */
73struct uprobe_task { 72struct 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 */
90struct 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
94struct xol_area;
95
104struct uprobes_state { 96struct 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
109extern int __weak set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr); 101extern int __weak set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr);
110extern bool __weak is_swbp_insn(uprobe_opcode_t *insn); 102extern bool __weak is_swbp_insn(uprobe_opcode_t *insn);
111extern bool __weak is_trap_insn(uprobe_opcode_t *insn); 103extern bool __weak is_trap_insn(uprobe_opcode_t *insn);
104extern unsigned long __weak uprobe_get_swbp_addr(struct pt_regs *regs);
112extern int uprobe_write_opcode(struct mm_struct *mm, unsigned long vaddr, uprobe_opcode_t); 105extern int uprobe_write_opcode(struct mm_struct *mm, unsigned long vaddr, uprobe_opcode_t);
113extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); 106extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc);
114extern int uprobe_apply(struct inode *inode, loff_t offset, struct uprobe_consumer *uc, bool); 107extern 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);
120extern void uprobe_dup_mmap(struct mm_struct *oldmm, struct mm_struct *newmm); 113extern void uprobe_dup_mmap(struct mm_struct *oldmm, struct mm_struct *newmm);
121extern void uprobe_free_utask(struct task_struct *t); 114extern void uprobe_free_utask(struct task_struct *t);
122extern void uprobe_copy_process(struct task_struct *t, unsigned long flags); 115extern void uprobe_copy_process(struct task_struct *t, unsigned long flags);
123extern unsigned long __weak uprobe_get_swbp_addr(struct pt_regs *regs);
124extern int uprobe_post_sstep_notifier(struct pt_regs *regs); 116extern int uprobe_post_sstep_notifier(struct pt_regs *regs);
125extern int uprobe_pre_sstep_notifier(struct pt_regs *regs); 117extern int uprobe_pre_sstep_notifier(struct pt_regs *regs);
126extern void uprobe_notify_resume(struct pt_regs *regs); 118extern 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}
179static inline unsigned long uprobe_get_swbp_addr(struct pt_regs *regs)
180{
181 return 0;
182}
183static inline void uprobe_free_utask(struct task_struct *t) 171static inline void uprobe_free_utask(struct task_struct *t)
184{ 172{
185} 173}