All of lore.kernel.org
 help / color / mirror / Atom feed
From: oleg@redhat.com (Oleg Nesterov)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC 5/8] ARM64: Re-factor flush_ptrace_access
Date: Fri, 2 Jan 2015 18:51:15 +0100	[thread overview]
Message-ID: <20150102175115.GB6761@redhat.com> (raw)
In-Reply-To: <f41f96aaed90007076ce496b9a0746c6f1a01ddb.1420038188.git.panand@redhat.com>

On 12/31, Pratyush Anand wrote:
>
> Re-factor flush_ptrace_access to reuse vma independent part.

But for what? The changelog should explain this.

> Signed-off-by: Pratyush Anand <panand@redhat.com>
> ---
>  arch/arm64/mm/flush.c | 24 +++++++++++++++---------
>  1 file changed, 15 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/arm64/mm/flush.c b/arch/arm64/mm/flush.c
> index b6f14e8d2121..9a4dd6f39cfb 100644
> --- a/arch/arm64/mm/flush.c
> +++ b/arch/arm64/mm/flush.c
> @@ -34,19 +34,25 @@ void flush_cache_range(struct vm_area_struct *vma, unsigned long start,
>  		__flush_icache_all();
>  }
>
> +static void __flush_ptrace_access(struct page *page, unsigned long uaddr,
> +		void *kaddr, unsigned long len)
> +{
> +	unsigned long addr = (unsigned long)kaddr;
> +
> +	if (icache_is_aliasing()) {
> +		__flush_dcache_area(kaddr, len);
> +		__flush_icache_all();
> +	} else {
> +		flush_icache_range(addr, addr + len);
> +	}
> +}
> +
>  static void flush_ptrace_access(struct vm_area_struct *vma, struct page *page,
>  				unsigned long uaddr, void *kaddr,
>  				unsigned long len)
>  {
> -	if (vma->vm_flags & VM_EXEC) {
> -		unsigned long addr = (unsigned long)kaddr;
> -		if (icache_is_aliasing()) {
> -			__flush_dcache_area(kaddr, len);
> -			__flush_icache_all();
> -		} else {
> -			flush_icache_range(addr, addr + len);
> -		}
> -	}
> +	if (vma->vm_flags & VM_EXEC)
> +		__flush_ptrace_access(page, uaddr, kaddr, len);
>  }

So why uprobes can't use flush_ptrace_access() ? flush_uprobe_xol_access() is
called by arch_uprobe_copy_ixol(), and xol vma has VM_EXEC bit set.

Oleg.

WARNING: multiple messages have this Message-ID (diff)
From: Oleg Nesterov <oleg@redhat.com>
To: Pratyush Anand <panand@redhat.com>
Cc: linux-arm-kernel@lists.infradead.org, linux@arm.linux.org.uk,
	tixy@linaro.org, ananth@in.ibm.com, sandeepa.prabhu@linaro.org,
	catalin.marinas@arm.com, will.deacon@arm.com,
	linux-kernel@vger.kernel.org, anil.s.keshavamurthy@intel.com,
	masami.hiramatsu.pt@hitachi.com, wcohen@redhat.com
Subject: Re: [RFC 5/8] ARM64: Re-factor flush_ptrace_access
Date: Fri, 2 Jan 2015 18:51:15 +0100	[thread overview]
Message-ID: <20150102175115.GB6761@redhat.com> (raw)
In-Reply-To: <f41f96aaed90007076ce496b9a0746c6f1a01ddb.1420038188.git.panand@redhat.com>

On 12/31, Pratyush Anand wrote:
>
> Re-factor flush_ptrace_access to reuse vma independent part.

But for what? The changelog should explain this.

> Signed-off-by: Pratyush Anand <panand@redhat.com>
> ---
>  arch/arm64/mm/flush.c | 24 +++++++++++++++---------
>  1 file changed, 15 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/arm64/mm/flush.c b/arch/arm64/mm/flush.c
> index b6f14e8d2121..9a4dd6f39cfb 100644
> --- a/arch/arm64/mm/flush.c
> +++ b/arch/arm64/mm/flush.c
> @@ -34,19 +34,25 @@ void flush_cache_range(struct vm_area_struct *vma, unsigned long start,
>  		__flush_icache_all();
>  }
>
> +static void __flush_ptrace_access(struct page *page, unsigned long uaddr,
> +		void *kaddr, unsigned long len)
> +{
> +	unsigned long addr = (unsigned long)kaddr;
> +
> +	if (icache_is_aliasing()) {
> +		__flush_dcache_area(kaddr, len);
> +		__flush_icache_all();
> +	} else {
> +		flush_icache_range(addr, addr + len);
> +	}
> +}
> +
>  static void flush_ptrace_access(struct vm_area_struct *vma, struct page *page,
>  				unsigned long uaddr, void *kaddr,
>  				unsigned long len)
>  {
> -	if (vma->vm_flags & VM_EXEC) {
> -		unsigned long addr = (unsigned long)kaddr;
> -		if (icache_is_aliasing()) {
> -			__flush_dcache_area(kaddr, len);
> -			__flush_icache_all();
> -		} else {
> -			flush_icache_range(addr, addr + len);
> -		}
> -	}
> +	if (vma->vm_flags & VM_EXEC)
> +		__flush_ptrace_access(page, uaddr, kaddr, len);
>  }

So why uprobes can't use flush_ptrace_access() ? flush_uprobe_xol_access() is
called by arch_uprobe_copy_ixol(), and xol vma has VM_EXEC bit set.

Oleg.


  reply	other threads:[~2015-01-02 17:51 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-31 15:21 [RFC 0/8] ARM64: Uprobe support added Pratyush Anand
2014-12-31 15:21 ` Pratyush Anand
2014-12-31 15:21 ` [RFC 1/8] ARM64: Move BRK opcodes defines from kprobes.h to insn.h Pratyush Anand
2015-01-08 16:55   ` Will Deacon
2015-01-08 16:55     ` Will Deacon
2015-01-08 17:31     ` Pratyush Anand
2015-01-08 17:31       ` Pratyush Anand
2014-12-31 15:21 ` [RFC 2/8] ARM64: Refactor kprobes-arm64 Pratyush Anand
2015-01-08 16:55   ` Will Deacon
2015-01-08 16:55     ` Will Deacon
2015-01-08 17:33     ` Pratyush Anand
2015-01-08 17:33       ` Pratyush Anand
2015-01-08 17:36       ` Will Deacon
2015-01-08 17:36         ` Will Deacon
2015-01-08 17:39         ` Pratyush Anand
2015-01-08 17:39           ` Pratyush Anand
2014-12-31 15:21 ` [RFC 3/8] Kernel/uprobe: Define arch_uprobe_exception_notify as __weak Pratyush Anand
2015-01-02 17:43   ` Oleg Nesterov
2015-01-02 17:43     ` Oleg Nesterov
2015-01-04 13:50     ` Pratyush Anand
2015-01-04 13:50       ` Pratyush Anand
2014-12-31 15:21 ` [RFC 4/8] ARM64: Add instruction_pointer_set function Pratyush Anand
2015-01-08 16:59   ` Will Deacon
2015-01-08 16:59     ` Will Deacon
2015-01-09  5:18     ` Pratyush Anand
2015-01-09  5:18       ` Pratyush Anand
2014-12-31 15:21 ` [RFC 5/8] ARM64: Re-factor flush_ptrace_access Pratyush Anand
2015-01-02 17:51   ` Oleg Nesterov [this message]
2015-01-02 17:51     ` Oleg Nesterov
2015-01-02 18:19     ` Oleg Nesterov
2015-01-02 18:19       ` Oleg Nesterov
2015-01-04 13:50       ` Pratyush Anand
2015-01-04 13:50         ` Pratyush Anand
2014-12-31 15:21 ` [RFC 6/8] ARM64: Handle TRAP_HWBRKPT for user mode as well Pratyush Anand
2015-01-02 18:05   ` Oleg Nesterov
2015-01-02 18:05     ` Oleg Nesterov
2015-01-08 17:01     ` Will Deacon
2015-01-08 17:01       ` Will Deacon
2015-01-08 17:51       ` Pratyush Anand
2015-01-08 17:51         ` Pratyush Anand
2014-12-31 15:21 ` [RFC 7/8] ARM64: Handle TRAP_BRKPT " Pratyush Anand
2014-12-31 15:21 ` [RFC 8/8] ARM64: Add uprobe support Pratyush Anand
2015-01-02 17:23   ` Oleg Nesterov
2015-01-02 17:23     ` Oleg Nesterov
2015-01-04 13:49     ` Pratyush Anand
2015-01-04 13:49       ` Pratyush Anand
2015-01-04 18:40       ` Oleg Nesterov
2015-01-04 18:40         ` Oleg Nesterov
2015-01-05  4:17         ` Pratyush Anand
2015-01-05  4:17           ` Pratyush Anand
2015-01-08 17:03   ` Will Deacon
2015-01-08 17:03     ` Will Deacon
2015-01-08 17:54     ` Pratyush Anand
2015-01-08 17:54       ` Pratyush Anand
2015-01-09 17:45       ` Oleg Nesterov
2015-01-09 17:45         ` Oleg Nesterov
2015-01-12  4:50         ` Pratyush Anand
2015-01-12  4:50           ` Pratyush Anand
2015-01-09 17:59   ` Oleg Nesterov
2015-01-09 17:59     ` Oleg Nesterov
2015-01-12  5:04     ` Pratyush Anand
2015-01-12  5:04       ` Pratyush Anand
2015-01-12  6:45       ` Pratyush Anand
2015-01-12  6:45         ` Pratyush Anand
2015-01-12 14:38         ` Oleg Nesterov
2015-01-12 14:38           ` Oleg Nesterov
2015-01-12 14:28       ` Oleg Nesterov
2015-01-12 14:28         ` Oleg Nesterov
2015-01-01  1:59 ` [RFC 0/8] ARM64: Uprobe support added Pratyush Anand
2015-01-01  1:59   ` Pratyush Anand

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=20150102175115.GB6761@redhat.com \
    --to=oleg@redhat.com \
    --cc=linux-arm-kernel@lists.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 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.