[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20121006095258.GD9145@linux.vnet.ibm.com>
Date: Sat, 6 Oct 2012 15:22:58 +0530
From: Srikar Dronamraju <srikar@...ux.vnet.ibm.com>
To: Oleg Nesterov <oleg@...hat.com>
Cc: Ingo Molnar <mingo@...e.hu>, Peter Zijlstra <peterz@...radead.org>,
Ananth N Mavinakayanahalli <ananth@...ibm.com>,
Anton Arapov <anton@...hat.com>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 6/7] uprobes: Fix uprobe_copy_insn() race with itself
* Oleg Nesterov <oleg@...hat.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@...hat.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@...ux.vnet.ibm.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists