Re: [PATCH v3 1/2] tracing: fix bad use of igrab in trace_uprobe.c

From: Steven Rostedt
Date: Fri Apr 20 2018 - 14:30:17 EST


On Fri, 20 Apr 2018 09:56:24 -0700
Song Liu <songliubraving@xxxxxx> wrote:

> s 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.
>
> 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 two instances in trace_uprobe.c. struct path is added to
> struct trace_uprobe to keep the inode and containing mount point
> referenced.
>
> Fixes: f3f096cfedf8 ("tracing: Provide trace events interface for uprobes")
> Fixes: 33ea4b24277b ("perf/core: Implement the 'perf_uprobe' PMU")
> Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>
> Cc: Ingo Molnar <mingo@xxxxxxxxxx>
> Cc: Howard McLauchlan <hmclauchlan@xxxxxx>
> Cc: Josef Bacik <jbacik@xxxxxx>
> Cc: Srikar Dronamraju <srikar@xxxxxxxxxxxxxxxxxx>
> Cc: Miklos Szeredi <miklos@xxxxxxxxxx>
> Reported-by: Miklos Szeredi <miklos@xxxxxxxxxx>
> Signed-off-by: Song Liu <songliubraving@xxxxxx>
> ---

Can I get an Acked-by or Reviewed-by from someone?

Thanks!

-- Steve