mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Ingo Molnar <mingo@elte.hu>, Hugh Dickins <hughd@google.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>,
	David Long <dave.long@linaro.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Srikar Dronamraju <srikar@linux.vnet.ibm.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] uprobes: Refuse to insert a probe into MAP_SHARED vma
Date: Mon, 28 Apr 2014 21:30:29 +0200	[thread overview]
Message-ID: <20140428193029.GA9773@redhat.com> (raw)
In-Reply-To: <20140428191622.GA9234@redhat.com>

And of course, I forgot to add Hugh ;) Fix that.

On 04/28, Oleg Nesterov wrote:
>
> valid_vma() rejects the VM_SHARED vmas, but this still allows to insert
> a probe into the MAP_SHARED but not VM_MAYWRITE vma.
> 
> Currently this is fine, such a mapping doesn't really differ from the
> private read-only mmap except mprotect(PROT_WRITE) won't work. However,
> get_user_pages(FOLL_WRITE | FOLL_FORCE) doesn't allow to COW in this
> case, and it would be safer to follow the same conventions as mm even
> if currently this happens to work.
> 
> After the recent cda540ace6a1 "mm: get_user_pages(write,force) refuse
> to COW in shared areas" only uprobes can insert an anon page into the
> shared file-backed area, lets stop this and change valid_vma() to check
> VM_MAYSHARE instead.
> 
> Signed-off-by: Oleg Nesterov <oleg@redhat.com>
> ---
>  kernel/events/uprobes.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
> index d1edc5e..7716c40 100644
> --- a/kernel/events/uprobes.c
> +++ b/kernel/events/uprobes.c
> @@ -127,7 +127,7 @@ struct xol_area {
>   */
>  static bool valid_vma(struct vm_area_struct *vma, bool is_register)
>  {
> -	vm_flags_t flags = VM_HUGETLB | VM_MAYEXEC | VM_SHARED;
> +	vm_flags_t flags = VM_HUGETLB | VM_MAYEXEC | VM_MAYSHARE;
>  
>  	if (is_register)
>  		flags |= VM_WRITE;
> -- 
> 1.5.5.1
> 


      reply	other threads:[~2014-04-28 20:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-28 19:16 Oleg Nesterov
2014-04-28 19:30 ` 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=20140428193029.GA9773@redhat.com \
    --to=oleg@redhat.com \
    --cc=ananth@in.ibm.com \
    --cc=dave.long@linaro.org \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome