lkml.org 
[lkml]   [2012]   [Oct]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 6/7] uprobes: Fix uprobe_copy_insn() race with itself
* Oleg Nesterov <oleg@redhat.com> [2012-09-30 21:42:24]:

> install_breakpoint() is called under mm->mmap_sem, this protects
> set_swbp() but not uprobe_copy_insn(). Two or more different tasks
> can call install_breakpoint()->uprobe_copy_insn() at the same time,
> this leads to numerous problems if UPROBE_COPY_INSN is not set.
>
> Just for example, the second copy_insn() can corrupt the already
> analyzed/fixuped uprobe->arch.insn and race with handle_swbp().
>
> This patch simply adds uprobe->copy_mutex to serialize this code.
> We could probably reuse ->consumer_rwsem, but this would mean that
> consumer->handler() can not use mm->mmap_sem, not good.
>
> Note: this is another temporary ugly hack until we move this logic
> into uprobe_register().
>
> Signed-off-by: Oleg Nesterov <oleg@redhat.com>

Given that we copy just for the first install, and register not being a
performance path, Can we use a single mutex instead of a per-uprobe
mutex.

Acked-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>



\
 
 \ /
  Last update: 2012-10-06 12:21    [W:0.197 / U:0.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site