mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>,
	Peter Zijlstra <peterz@infradead.org>,
	Ananth N Mavinakayanahalli <ananth@in.ibm.com>,
	Anton Arapov <anton@redhat.com>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] uprobes: Change valid_vma() to demand VM_MAYEXEC rather than VM_EXEC
Date: Tue, 25 Sep 2012 14:21:29 +0530	[thread overview]
Message-ID: <20120925085129.GB18334@linux.vnet.ibm.com> (raw)
In-Reply-To: <20120916175246.GA32370@redhat.com>

* Oleg Nesterov <oleg@redhat.com> [2012-09-16 19:52:46]:

> uprobe_register() or uprobe_mmap() requires VM_READ | VM_EXEC, this
> is not right. An apllication can do mprotect(PROT_EXEC) later and
> execute this code.
> 
> Change valid_vma(is_register => true) to check VM_MAYEXEC instead.
> No need to check VM_MAYREAD, it is always set.
> 
> Signed-off-by: Oleg Nesterov <oleg@redhat.com>

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

> ---
>  kernel/events/uprobes.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
> index fa1579a..b9b50dd 100644
> --- a/kernel/events/uprobes.c
> +++ b/kernel/events/uprobes.c
> @@ -106,8 +106,8 @@ static bool valid_vma(struct vm_area_struct *vma, bool is_register)
>  	if (!is_register)
>  		return true;
> 
> -	if ((vma->vm_flags & (VM_HUGETLB|VM_READ|VM_WRITE|VM_EXEC|VM_SHARED))
> -				== (VM_READ|VM_EXEC))
> +	if ((vma->vm_flags & (VM_HUGETLB | VM_WRITE | VM_MAYEXEC | VM_SHARED))
> +				== VM_MAYEXEC)
>  		return true;
> 
>  	return false;
> -- 
> 1.5.5.1
> 


  reply	other threads:[~2012-09-25  9:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-16 17:52 [PATCH 0/3] uprobes: mprotect fixes Oleg Nesterov
2012-09-16 17:52 ` [PATCH 1/3] uprobes: Change write_opcode() to use FOLL_FORCE Oleg Nesterov
2012-09-25  8:49   ` Srikar Dronamraju
2012-09-16 17:52 ` [PATCH 2/3] uprobes: Change valid_vma() to demand VM_MAYEXEC rather than VM_EXEC Oleg Nesterov
2012-09-25  8:51   ` Srikar Dronamraju [this message]
2012-09-16 17:52 ` [PATCH 3/3] uprobes: Restrict valid_vma(false) to skip VM_SHARED Oleg Nesterov
2012-09-25  9:05   ` Srikar Dronamraju
2012-09-25 14:20     ` Oleg Nesterov

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=20120925085129.GB18334@linux.vnet.ibm.com \
    --to=srikar@linux.vnet.ibm.com \
    --cc=ananth@in.ibm.com \
    --cc=anton@redhat.com \
    --cc=bigeasy@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    /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