diff options
author | Oleg Nesterov <oleg@redhat.com> | 2012-08-08 11:11:42 -0400 |
---|---|---|
committer | Oleg Nesterov <oleg@redhat.com> | 2012-08-28 12:21:18 -0400 |
commit | f8ac4ec9c064b330dcc49e03c450fe74298c4622 (patch) | |
tree | 62d53120d0289719438d27de5f868c36e136ed28 /include/linux/uprobes.h | |
parent | 78f7411668aa0b2006d331f6a288416dd91b8e5d (diff) |
uprobes: Introduce MMF_HAS_UPROBES
Add the new MMF_HAS_UPROBES flag. It is set by install_breakpoint()
and it is copied by dup_mmap(), uprobe_pre_sstep_notifier() checks
it to avoid the slow path if the task was never probed. Perhaps it
makes sense to check it in valid_vma(is_register => false) as well.
This needs the new dup_mmap()->uprobe_dup_mmap() hook. We can't use
uprobe_reset_state() or put MMF_HAS_UPROBES into MMF_INIT_MASK, we
need oldmm->mmap_sem to avoid the race with uprobe_register() or
mmap() from another thread.
Currently we never clear this bit, it can be false-positive after
uprobe_unregister() or uprobe_munmap() or if dup_mmap() hits the
probed VM_DONTCOPY vma. But this is fine correctness-wise and has
no effect unless the task hits the non-uprobe breakpoint.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Diffstat (limited to 'include/linux/uprobes.h')
-rw-r--r-- | include/linux/uprobes.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h index 03ae547c1c31..4a37ab153247 100644 --- a/include/linux/uprobes.h +++ b/include/linux/uprobes.h | |||
@@ -108,6 +108,7 @@ extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_con | |||
108 | extern void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); | 108 | extern void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); |
109 | extern int uprobe_mmap(struct vm_area_struct *vma); | 109 | extern int uprobe_mmap(struct vm_area_struct *vma); |
110 | extern void uprobe_munmap(struct vm_area_struct *vma, unsigned long start, unsigned long end); | 110 | extern void uprobe_munmap(struct vm_area_struct *vma, unsigned long start, unsigned long end); |
111 | extern void uprobe_dup_mmap(struct mm_struct *oldmm, struct mm_struct *newmm); | ||
111 | extern void uprobe_free_utask(struct task_struct *t); | 112 | extern void uprobe_free_utask(struct task_struct *t); |
112 | extern void uprobe_copy_process(struct task_struct *t); | 113 | extern void uprobe_copy_process(struct task_struct *t); |
113 | extern unsigned long __weak uprobe_get_swbp_addr(struct pt_regs *regs); | 114 | extern unsigned long __weak uprobe_get_swbp_addr(struct pt_regs *regs); |
@@ -138,6 +139,10 @@ static inline void | |||
138 | uprobe_munmap(struct vm_area_struct *vma, unsigned long start, unsigned long end) | 139 | uprobe_munmap(struct vm_area_struct *vma, unsigned long start, unsigned long end) |
139 | { | 140 | { |
140 | } | 141 | } |
142 | static inline void | ||
143 | uprobe_dup_mmap(struct mm_struct *oldmm, struct mm_struct *newmm) | ||
144 | { | ||
145 | } | ||
141 | static inline void uprobe_notify_resume(struct pt_regs *regs) | 146 | static inline void uprobe_notify_resume(struct pt_regs *regs) |
142 | { | 147 | { |
143 | } | 148 | } |