Commit 2b19c1e
tracing: Fix bad use of igrab in trace_uprobe.c
commit 0c92c7a upstream.
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.
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.
Link: http://lkml.kernel.org/r/20180423172135.4050588-1-songliubraving@fb.com
Fixes: f3f096c ("tracing: Provide trace events interface for uprobes")
Fixes: 33ea4b2 ("perf/core: Implement the 'perf_uprobe' PMU")
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Howard McLauchlan <hmclauchlan@fb.com>
Cc: Josef Bacik <jbacik@fb.com>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Acked-by: Miklos Szeredi <mszeredi@redhat.com>
Reported-by: Miklos Szeredi <miklos@szeredi.hu>
Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
[bwh: Backported to 3.16:
- Open-code d_real_inode(), d_is_reg()
- Drop changes in create_local_trace_uprobe()]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>1 parent 3ebb4e8 commit 2b19c1e
1 file changed
+10
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| |||
284 | 285 | | |
285 | 286 | | |
286 | 287 | | |
287 | | - | |
| 288 | + | |
288 | 289 | | |
289 | 290 | | |
290 | 291 | | |
| |||
358 | 359 | | |
359 | 360 | | |
360 | 361 | | |
361 | | - | |
362 | 362 | | |
363 | 363 | | |
364 | 364 | | |
365 | 365 | | |
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
369 | | - | |
370 | 369 | | |
371 | 370 | | |
372 | 371 | | |
| |||
432 | 431 | | |
433 | 432 | | |
434 | 433 | | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
| 434 | + | |
| 435 | + | |
439 | 436 | | |
440 | 437 | | |
441 | 438 | | |
442 | 439 | | |
443 | 440 | | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
| 441 | + | |
448 | 442 | | |
449 | | - | |
| 443 | + | |
450 | 444 | | |
451 | 445 | | |
452 | 446 | | |
| |||
485 | 479 | | |
486 | 480 | | |
487 | 481 | | |
488 | | - | |
| 482 | + | |
489 | 483 | | |
490 | 484 | | |
491 | 485 | | |
| |||
552 | 546 | | |
553 | 547 | | |
554 | 548 | | |
555 | | - | |
| 549 | + | |
556 | 550 | | |
557 | 551 | | |
558 | 552 | | |
| |||
919 | 913 | | |
920 | 914 | | |
921 | 915 | | |
| 916 | + | |
922 | 917 | | |
923 | 918 | | |
924 | 919 | | |
| |||
964 | 959 | | |
965 | 960 | | |
966 | 961 | | |
| 962 | + | |
967 | 963 | | |
968 | 964 | | |
969 | 965 | | |
| |||
0 commit comments