LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Alexander Shishkin <alexander.shishkin@linux.intel.com>
To: Song Liu <songliubraving@fb.com>
Cc: linux-kernel@vger.kernel.org, kernel-team@fb.com,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH 2/2] perf/core: fix bad use of igrab in kernel/event/core.c
Date: Thu, 19 Apr 2018 09:17:10 +0300	[thread overview]
Message-ID: <20180419061710.l6sdq3kvricpyjdu@um.fi.intel.com> (raw)
In-Reply-To: <20180418062907.3210386-2-songliubraving@fb.com>

On Tue, Apr 17, 2018 at 11:29:07PM -0700, Song Liu wrote:
> As Miklos reported and suggested:
> 
>   This pattern repeats two times in trace_uprobe.c and in
>   kernel/events/core.c as well:
> 
>       ret = kern_path(filename, LOOKUP_FOLLOW, &path);
>       if (ret)
>           goto fail_address_parse;
> 
>       inode = igrab(d_inode(path.dentry));
>       path_put(&path);
> 
>   And it's wrong.  You can only hold a reference to the inode if you
>   have an active ref to the superblock as well (which is normally
>   through path.mnt) or holding s_umount.

Oops. I must have snatched it from the uprobe code without thinking.

>   This way unmounting the containing filesystem while the tracepoint is
>   active will give you the "VFS: Busy inodes after unmount..." message
>   and a crash when the inode is finally put.
> 
>   Solution: store path instead of inode.
> 
> This patch fixes the issue in kernel/event/core.c.
> 
> NOTE: Based on my understanding, perf_addr_filter only supports intel_pt.

Coresight too, but that's probably even further away from what you have.

> However, my test system doesn't support address filtering (or I made a
> mistake?). Therefore, I have NOT tested this patch.

Check /sys/devices/intel_pt/caps/num_address_ranges, if it's non-zero,
it's supported.

> Could someone please help test it?

Yes:

Reviewed-and-tested-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>

The subject line needs a little love to be more like other perf commits, but
other than that, looks good.

Thanks!

  reply	other threads:[~2018-04-19  6:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-18  6:29 [PATCH 1/2] tracing: fix bad use of igrab in trace_uprobe.c Song Liu
2018-04-18  6:29 ` [PATCH 2/2] perf/core: fix bad use of igrab in kernel/event/core.c Song Liu
2018-04-19  6:17   ` Alexander Shishkin [this message]
2018-05-22 21:56     ` Song Liu
2018-05-23 13:11       ` Peter Zijlstra
2018-05-25  9:49   ` [tip:perf/core] perf/core: Fix bad use of igrab() tip-bot for Song Liu
2018-04-18 14:03 ` [PATCH 1/2] tracing: fix bad use of igrab in trace_uprobe.c Miklos Szeredi
2018-04-18 14:25   ` Steven Rostedt
2018-04-18 14:40     ` Miklos Szeredi
2018-04-18 15:19       ` Steven Rostedt
2018-04-18 16:15     ` Song Liu
2018-04-18 16:08   ` Song Liu
2018-04-18 16:25     ` Steven Rostedt

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=20180419061710.l6sdq3kvricpyjdu@um.fi.intel.com \
    --to=alexander.shishkin@linux.intel.com \
    --cc=kernel-team@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=songliubraving@fb.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;
as well as URLs for NNTP newsgroup(s).