linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Shishkin <alexander.shishkin@linux.intel.com>
To: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: peterz@infradead.org, mingo@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC 2/3] perf/core: update filter only on executable mmap
Date: Mon, 18 Jul 2016 14:23:50 +0300	[thread overview]
Message-ID: <874m7np4u1.fsf@ashishki-desk.ger.corp.intel.com> (raw)
In-Reply-To: <1468621541-31024-3-git-send-email-mathieu.poirier@linaro.org>

Mathieu Poirier <mathieu.poirier@linaro.org> writes:

> Function perf_event_mmap() is called by the MM subsystem each time
> part of a binary is loaded in memory.  There can be several mapping
> for a binary, many times unrelated to the code section.
>
> Each time a section of a binary is mapped address filters are
> updated, event when the map doesn't pertain to the code section.
> The end result is that filters are configured based on the last map
> event that was received rather than the last mapping of the code
> segment.

Good catch! I'd like to fix it in 4.7-stable as well; I think it's too
late for 4.7 already.

> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
> ---
>  kernel/events/core.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index df21611585d7..b9aa8f0ff070 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -6604,7 +6604,8 @@ void perf_event_mmap(struct vm_area_struct *vma)
>  		/* .flags (attr_mmap2 only) */
>  	};
>  
> -	perf_addr_filters_adjust(vma);
> +	if ((vma->vm_flags & VM_EXEC) && (vma->vm_pgoff == 0))
> +		perf_addr_filters_adjust(vma);

You shouldn't need the vm_pgoff check; the range comparison logic in
__perf_addr_filters_adjust() should already take it into account.

Also, I'd put the check to perf_addr_filters_adjust() instead, with a
comment that we don't do data-based filters yet or something along those
lines.

Thanks,
--
Alex

  reply	other threads:[~2016-07-18 11:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-15 22:25 [PATCH 0/3] perf/core: miscellaneous fix for address filtering Mathieu Poirier
2016-07-15 22:25 ` [PATCH 1/3] perf/core: fixing filename for start/stop filters Mathieu Poirier
2016-07-18 11:08   ` Alexander Shishkin
2016-07-15 22:25 ` [PATCH RFC 2/3] perf/core: update filter only on executable mmap Mathieu Poirier
2016-07-18 11:23   ` Alexander Shishkin [this message]
2016-07-15 22:25 ` [PATCH 3/3] perf/core: enabling mapping of the stop filters Mathieu Poirier
2016-07-18 11:31   ` Alexander Shishkin
2016-07-18 11:35 ` [PATCH 0/3] perf/core: miscellaneous fix for address filtering Alexander Shishkin

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=874m7np4u1.fsf@ashishki-desk.ger.corp.intel.com \
    --to=alexander.shishkin@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=mingo@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;
as well as URLs for NNTP newsgroup(s).