Bug 28557 - unable to probe function in kernel module (xfs:xfs_ilock &others?)
Summary: unable to probe function in kernel module (xfs:xfs_ilock &others?)
Status: RESOLVED FIXED
Alias: None
Product: systemtap
Classification: Unclassified
Component: kprobes (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-06 20:40 UTC by Serhei Makarov
Modified: 2021-11-14 21:31 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
Project(s) to access:
ssh public key:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Serhei Makarov 2021-11-06 20:40:55 UTC
Manifests on kernel 5.14.0-1.el9.x86_64.

$ /opt/stap-checkout/stap_install/bin/stap -vvvve 'probe begin { println("running") } probe module("xfs").function("xfs_ilock") { exit() }'
running
<indefinite hang>

SHOULD BE
parse 'xfs_ilock', func 'xfs_ilock'
pattern 'xfs' matches module 'xfs'
focused on module 'xfs' = [0x10000-0x144c28, bias 0 file /usr/lib/debug/usr/lib/modules/4.18.0-348.4.el8.x86_64/kernel/fs/xfs/xfs.ko.debug ELF machine |x86_64 (code 62)
focused on module 'xfs'
selected function xfs_ilock
xfs_ilock = dwfl_module_addrinfo(entrypc=0x85760 + (nil))
added to filtered_functions (dieoffset: 0x8efee9)
checking instances of inline xfs_ilock
selected inline instance of xfs_ilock
entry-pc lookup (dwarf_entrypc dieoffset: 0x8f014e) = 0x85797 (rc 0)
added to filtered_inlines (dieoffset: 0x8f014e)
selected function xfs_ilock
xfs_ilock = dwfl_module_addrinfo(entrypc=0x85760 + (nil))
added to filtered_functions (dieoffset: 0x8efee9)
checking instances of inline xfs_ilock
selected inline instance of xfs_ilock
entry-pc lookup (dwarf_entrypc dieoffset: 0x8f014e) = 0x85797 (rc 0)
added to filtered_inlines (dieoffset: 0x8f014e)
probe xfs_ilock@fs/xfs/xfs_inode.c:166 module=xfs reloc=.text pc=0x85760
      function exit is defined in new-tapset-file /opt/stap-checkout/stap_install/share/systemtap/tapset/logging.stp
querying entrypc 0x85797 of instance of inline 'xfs_ilock'
probe xfs_ilock@fs/xfs/xfs_inode.c:166 module=xfs reloc=.text pc=0x85797
symbol resolution for derived-probe probe module("xfs").function("xfs_ilock@fs/xfs/xfs_inode.c:166") /* pc=<xfs:xfs_ilock+0> */ /* <- module("xfs").function("xfs_ilock@fs/xfs/xfs_inode.c:166") */{
exit();
}
symbol resolution for derived-probe probe module("xfs").function("xfs_ilock@fs/xfs/xfs_inode.c:166") /* pc=<xfs:xfs_ilock+55> */ /* <- module("xfs").function("xfs_ilock@fs/xfs/xfs_inode.c:166") */{
exit();
}

INSTEAD
parse 'xfs_ilock', func 'xfs_ilock'
pattern 'xfs' matches module 'xfs'
focused on module 'xfs' = [0x10000-0x187048, bias 0 file /lib/modules/5.14.0-1.el9.x86_64/kernel/fs
/xfs/xfs.ko.xz ELF machine |x86_64 (code 62)
focused on module 'xfs'
selected function xfs_ilock
xfs_ilock = dwfl_module_addrinfo(entrypc=0x8ea40 + (nil))
added to filtered_functions (dieoffset: 0x655c15)
selected function xfs_ilock
xfs_ilock = dwfl_module_addrinfo(entrypc=0x8ea40 + (nil))
added to filtered_functions (dieoffset: 0x655c15)
probe xfs_ilock@fs/xfs/xfs_inode.c:164 module=xfs reloc=.text pc=0x8ea40
      function exit is defined in new-tapset-file /opt/stap-checkout/stap_install/share/systemtap/tapset/logging.stp
symbol resolution for derived-probe probe module("xfs").function("xfs_ilock@fs/xfs/xfs_inode.c:164") /* pc=<xfs:xfs_ilock+0> */ /* <- module("xfs").function("xfs_ilock@fs/xfs/xfs_inode.c:164") */{
exit();
}
Comment 1 Frank Ch. Eigler 2021-11-14 21:31:18 UTC
commit 0425c60d7eed27437c5f83d79612786e50aed8ba 
Author: Frank Ch. Eigler <fche@redhat.com>
Date:   Sun Nov 14 16:28:12 2021 -0500

    PR28557: module probe insertion on modern kernels

appears to fix this on newer kernels, and keep things working on older kernels.