summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2012-08-08 17:17:46 +0200
committerAnton Arapov <anton@redhat.com>2012-10-29 11:42:36 +0100
commitc71c9f524c45281ce38921738162223f99e79b96 (patch)
tree7ee1590857b5b1ad79aa2425b1045210402154e7
parent07f61d55c42ce77708f5ba2772070985451fd28c (diff)
downloadkernel-uprobes-c71c9f524c45281ce38921738162223f99e79b96.zip
kernel-uprobes-c71c9f524c45281ce38921738162223f99e79b96.tar.gz
kernel-uprobes-c71c9f524c45281ce38921738162223f99e79b96.tar.xz
uprobes: Fold uprobe_reset_state() into uprobe_dup_mmap()
Now that we have uprobe_dup_mmap() we can fold uprobe_reset_state() into the new hook and remove it. mmput()->uprobe_clear_state() can't be called before dup_mmap(). Signed-off-by: Oleg Nesterov <oleg@redhat.com> Acked-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
-rw-r--r--include/linux/uprobes.h4
-rw-r--r--kernel/events/uprobes.c10
-rw-r--r--kernel/fork.c2
3 files changed, 2 insertions, 14 deletions
diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h
index 4a37ab1..30297f9 100644
--- a/include/linux/uprobes.h
+++ b/include/linux/uprobes.h
@@ -118,7 +118,6 @@ extern void uprobe_notify_resume(struct pt_regs *regs);
extern bool uprobe_deny_signal(void);
extern bool __weak arch_uprobe_skip_sstep(struct arch_uprobe *aup, struct pt_regs *regs);
extern void uprobe_clear_state(struct mm_struct *mm);
-extern void uprobe_reset_state(struct mm_struct *mm);
#else /* !CONFIG_UPROBES */
struct uprobes_state {
};
@@ -163,8 +162,5 @@ static inline void uprobe_copy_process(struct task_struct *t)
static inline void uprobe_clear_state(struct mm_struct *mm)
{
}
-static inline void uprobe_reset_state(struct mm_struct *mm)
-{
-}
#endif /* !CONFIG_UPROBES */
#endif /* _LINUX_UPROBES_H */
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index 33870b1..610e1c8 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -1148,16 +1148,10 @@ void uprobe_clear_state(struct mm_struct *mm)
kfree(area);
}
-/*
- * uprobe_reset_state - Free the area allocated for slots.
- */
-void uprobe_reset_state(struct mm_struct *mm)
-{
- mm->uprobes_state.xol_area = NULL;
-}
-
void uprobe_dup_mmap(struct mm_struct *oldmm, struct mm_struct *newmm)
{
+ newmm->uprobes_state.xol_area = NULL;
+
if (test_bit(MMF_HAS_UPROBES, &oldmm->flags))
set_bit(MMF_HAS_UPROBES, &newmm->flags);
}
diff --git a/kernel/fork.c b/kernel/fork.c
index cbb5f9f..2343c9e 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -837,8 +837,6 @@ struct mm_struct *dup_mm(struct task_struct *tsk)
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
mm->pmd_huge_pte = NULL;
#endif
- uprobe_reset_state(mm);
-
if (!mm_init(mm, tsk))
goto fail_nomem;