- Make sure perf reporting works correctly in setups using overlayfs or FUSE

- Move the uprobe optimization to a better location logically
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEzv7L6UO9uDPlPSfHEsHwGGHeVUoFAmj0x3YACgkQEsHwGGHe
 VUo6nQ/9E8LWC6PJG40QUXNZuj5qLe9VVaiWTW7w/zgeCf9nxkt6OhlOIu4fCMKz
 6n5marqnvOoG9EXetUz5+n0wJvc9vDACESC0m6ESddaI4PGXULNJIsN2C5dR3UZ3
 RULxaXvz9PVVkW3UIuM/U9az7fsG/ttH1rtrWQOsUYQZEO7vA9g+8KtASwnB7yBa
 29WzVDYQIuHigdFPkVOuKBEdhslOjNjMM/N/shFOyFS62MGgwwFG/f4xv0c2GanJ
 9gS2HPGhwOXLm8x/1Y6D8eKjiT5lvqZcDcRnui8bj7L7YGx+HU4PhRIIg7sBvGqA
 QQGolxA9Xo2BTufUTxEQK9v2fSvg0f9wuKbkDbRUdyUeWiZZjEeBM/m0AkzEEeKf
 FUrLCi3V/mN5J/sXSgIwjuCtYctwmsfaukL2bz6DB7feoTHceQmHunKCtBlDZtLE
 Md/4hzMNYM+T/3nx27quGz8Cepxn9PSObN7W+DddWr0TxOxg2Pq6iMbnd7MulueP
 K/AMvqDtbbVUB1XpsFvadRLcYUYYfXT9tiOCxa9O2w2NXDG8qeB6FZwScBaWuz1N
 9GpKBhVMgZT8m0d3N8NoBi0+h32UVZnsJJ3UhHnceE8UyYf4kSO5L2K3nPHJa301
 AavIPkH7+YOl5TAg6JlyYbRRdwfoUzxKUqY/hQ6Q8aLvwb2Jing=
 =huy7
 -----END PGP SIGNATURE-----

Merge tag 'perf_urgent_for_v6.18_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull perf fixes from Borislav Petkov:

 - Make sure perf reporting works correctly in setups using
   overlayfs or FUSE

 - Move the uprobe optimization to a better location logically

* tag 'perf_urgent_for_v6.18_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  perf/core: Fix MMAP2 event device with backing files
  perf/core: Fix MMAP event path names with backing files
  perf/core: Fix address filter match with backing files
  uprobe: Move arch_uprobe_optimize right after handlers execution
This commit is contained in:
Linus Torvalds 2025-10-19 04:54:08 -10:00
commit 343b4b44a1
2 changed files with 7 additions and 7 deletions

View File

@ -9403,7 +9403,7 @@ static void perf_event_mmap_event(struct perf_mmap_event *mmap_event)
flags |= MAP_HUGETLB; flags |= MAP_HUGETLB;
if (file) { if (file) {
struct inode *inode; const struct inode *inode;
dev_t dev; dev_t dev;
buf = kmalloc(PATH_MAX, GFP_KERNEL); buf = kmalloc(PATH_MAX, GFP_KERNEL);
@ -9416,12 +9416,12 @@ static void perf_event_mmap_event(struct perf_mmap_event *mmap_event)
* need to add enough zero bytes after the string to handle * need to add enough zero bytes after the string to handle
* the 64bit alignment we do later. * the 64bit alignment we do later.
*/ */
name = file_path(file, buf, PATH_MAX - sizeof(u64)); name = d_path(file_user_path(file), buf, PATH_MAX - sizeof(u64));
if (IS_ERR(name)) { if (IS_ERR(name)) {
name = "//toolong"; name = "//toolong";
goto cpy_name; goto cpy_name;
} }
inode = file_inode(vma->vm_file); inode = file_user_inode(vma->vm_file);
dev = inode->i_sb->s_dev; dev = inode->i_sb->s_dev;
ino = inode->i_ino; ino = inode->i_ino;
gen = inode->i_generation; gen = inode->i_generation;
@ -9492,7 +9492,7 @@ static bool perf_addr_filter_match(struct perf_addr_filter *filter,
if (!filter->path.dentry) if (!filter->path.dentry)
return false; return false;
if (d_inode(filter->path.dentry) != file_inode(file)) if (d_inode(filter->path.dentry) != file_user_inode(file))
return false; return false;
if (filter->offset > offset + size) if (filter->offset > offset + size)

View File

@ -2765,6 +2765,9 @@ static void handle_swbp(struct pt_regs *regs)
handler_chain(uprobe, regs); handler_chain(uprobe, regs);
/* Try to optimize after first hit. */
arch_uprobe_optimize(&uprobe->arch, bp_vaddr);
/* /*
* If user decided to take execution elsewhere, it makes little sense * If user decided to take execution elsewhere, it makes little sense
* to execute the original instruction, so let's skip it. * to execute the original instruction, so let's skip it.
@ -2772,9 +2775,6 @@ static void handle_swbp(struct pt_regs *regs)
if (instruction_pointer(regs) != bp_vaddr) if (instruction_pointer(regs) != bp_vaddr)
goto out; goto out;
/* Try to optimize after first hit. */
arch_uprobe_optimize(&uprobe->arch, bp_vaddr);
if (arch_uprobe_skip_sstep(&uprobe->arch, regs)) if (arch_uprobe_skip_sstep(&uprobe->arch, regs))
goto out; goto out;