All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>,
	Ingo Molnar <mingo@kernel.org>,
	Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>,
	Anton Blanchard <anton@samba.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 3/3] kernel/uprobes: Fix check for active uprobe
Date: Fri, 29 Sep 2017 18:54:25 +0200	[thread overview]
Message-ID: <20170929165425.GA21087@redhat.com> (raw)
In-Reply-To: <20170929132723.GA2318@linux.vnet.ibm.com>

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.

      reply	other threads:[~2017-09-29 16:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-22  9:13 [PATCH v3 0/3] A few uprobe fixes Naveen N. Rao
2017-09-22  9:13 ` [PATCH v3 1/3] kernel/uprobes: Do away with uprobe_warn() Naveen N. Rao
2017-09-22  9:13 ` [PATCH v3 2/3] kernel/uprobes: Warn if unable to install breakpoint Naveen N. Rao
2017-09-22  9:13 ` [PATCH v3 3/3] kernel/uprobes: Fix check for active uprobe Naveen N. Rao
2017-09-25 16:16   ` Oleg Nesterov
2017-09-28  7:06     ` Ingo Molnar
2017-09-29 13:27     ` Srikar Dronamraju
2017-09-29 16:54       ` Oleg Nesterov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170929165425.GA21087@redhat.com \
    --to=oleg@redhat.com \
    --cc=ananth@linux.vnet.ibm.com \
    --cc=anton@samba.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=naveen.n.rao@linux.vnet.ibm.com \
    --cc=srikar@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.