aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/fork.c
diff options
context:
space:
mode:
authorSrikar Dronamraju <srikar@linux.vnet.ibm.com>2012-03-30 14:26:31 -0400
committerIngo Molnar <mingo@kernel.org>2012-03-31 05:50:01 -0400
commitd4b3b6384f98f8692ad0209891ccdbc7e78bbefe (patch)
tree29c703af306a3b0e42d7ee3bdfce58db78d702b7 /kernel/fork.c
parent0326f5a94ddea33fa331b2519f4172f4fb387baa (diff)
uprobes/core: Allocate XOL slots for uprobes use
Uprobes executes the original instruction at a probed location out of line. For this, we allocate a page (per mm) upon the first uprobe hit, in the process user address space, divide it into slots that are used to store the actual instructions to be singlestepped. These slots are known as xol (execution out of line) slots. Care is taken to ensure that the allocation is in an unmapped area as close to the top of the user address space as possible, with appropriate permission settings to keep selinux like frameworks happy. Upon a uprobe hit, a free slot is acquired, and is released after the singlestep completes. Lots of improvements courtesy suggestions/inputs from Peter and Oleg. [ Folded a fix for build issue on powerpc fixed and reported by Stephen Rothwell. ] Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Cc: Jim Keniston <jkenisto@linux.vnet.ibm.com> Cc: Linux-mm <linux-mm@kvack.org> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: Christoph Hellwig <hch@infradead.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Arnaldo Carvalho de Melo <acme@infradead.org> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Anton Arapov <anton@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20120330182631.10018.48175.sendpatchset@srdronam.in.ibm.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/fork.c')
-rw-r--r--kernel/fork.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index eb7b63334009..3133b9da59d5 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -554,6 +554,7 @@ void mmput(struct mm_struct *mm)
554 might_sleep(); 554 might_sleep();
555 555
556 if (atomic_dec_and_test(&mm->mm_users)) { 556 if (atomic_dec_and_test(&mm->mm_users)) {
557 uprobe_clear_state(mm);
557 exit_aio(mm); 558 exit_aio(mm);
558 ksm_exit(mm); 559 ksm_exit(mm);
559 khugepaged_exit(mm); /* must run before exit_mmap */ 560 khugepaged_exit(mm); /* must run before exit_mmap */
@@ -760,6 +761,7 @@ struct mm_struct *dup_mm(struct task_struct *tsk)
760#ifdef CONFIG_TRANSPARENT_HUGEPAGE 761#ifdef CONFIG_TRANSPARENT_HUGEPAGE
761 mm->pmd_huge_pte = NULL; 762 mm->pmd_huge_pte = NULL;
762#endif 763#endif
764 uprobe_reset_state(mm);
763 765
764 if (!mm_init(mm, tsk)) 766 if (!mm_init(mm, tsk))
765 goto fail_nomem; 767 goto fail_nomem;