[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20170929165425.GA21087@redhat.com>
Date: Fri, 29 Sep 2017 18:54:25 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Srikar Dronamraju <srikar@...ux.vnet.ibm.com>
Cc: "Naveen N. Rao" <naveen.n.rao@...ux.vnet.ibm.com>,
Ingo Molnar <mingo@...nel.org>,
Ananth N Mavinakayanahalli <ananth@...ux.vnet.ibm.com>,
Anton Blanchard <anton@...ba.org>,
Michael Ellerman <mpe@...erman.id.au>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 3/3] kernel/uprobes: Fix check for active uprobe
On 09/29, Srikar Dronamraju wrote:
>
> > This is correct because we do this check under mmap_sem so we can't race with
> > install_breakpoint(), so is_trap_at_addr() == T can't be falsely true if
> > UPROBE_COPY_INSN is not set.
> >
>
> Right, Given that we are doing this in the mmap_sem, we should also be
> removing the rmb/wmb pairs too.
Well, down_read(&mm->mmap_sem) can only guarantee that this mm can not be
modified by install_breakpoint().
But what if, say, another task with different ->mm does uprobe_mmap() and
calls prepare_uprobe() for the 1st time?
Or suppose we race with unregister+register...
OTOH, I agree that we can remove these barriers, but this needs a lengthy
comment while the current code looks "obviously correct" in that you do
not even need to think about potential races.
Oleg.
Powered by blists - more mailing lists