You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I am trying to get the exact place a kernel lock was acquired using a modified version of klockstat. I am using the address I get from the stack with the function name to search the lock acquisition. Below is the example of one of the trace for pipe->mutex
Functions
addresses
file
Lock
mutex_lock_nested+0x5 [kernel],
"0xffffffff81cc9805",
mutex_lock_nested at /root/linux/kbuild/../kernel/locking/mutex.c:799
pipe->mutex
pipe_read+0x2d3 [kernel],
"0xffffffff81391d93",
pipe_occupancy at /root/linux/kbuild/../include/linux/pipe_fs_i.h:144
vfs_read+0x2bb [kernel],
"0xffffffff8138706b",
call_read_iter at /root/linux/kbuild/../include/linux/fs.h:2193
ksys_read+0xb7 [kernel],
"0xffffffff813879a7",
ksys_read at /root/linux/kbuild/../fs/read_write.c:613
do_syscall_64+0x38 [kernel],
"0xffffffff81cb7148",
do_syscall_x64 at /root/linux/kbuild/../arch/x86/entry/common.c:50
entry_SYSCALL_64_after_hwframe+0x63 [kernel],
"0xffffffff81e0009b"
entry_SYSCALL_64_after_hwframe at /root/linux/kbuild/../arch/x86/entry/entry_64.S:120
I am using addr2line to convert to source code. My goal is to use both file name with line number and function to get the line of acquisition for different locks (as a func can have multiple signature, I need both file and func name to resolve this). While for some traces the function name the the func name I get using addr2line matches for some like the example above, it does not match. For example, for pipe_read when I convert 0xffffffff81391d93 it points to something completely different. I have tried getting the address for pipe_read and adding the offset for sanity check, the address seems fine but I am not sure why would it point to pipe_occupancy. Among the cases that this is happening, there is case when function pointers are involved. In this example, pipe_read is accessed via a function pointer. I understand that function pointers are resolved at runtime. I am wondering if anyone can help me understand why there is a mismatch between func name and what I get with addr2line for such cases. Thanks in advance!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi, I am trying to get the exact place a kernel lock was acquired using a modified version of klockstat. I am using the address I get from the stack with the function name to search the lock acquisition. Below is the example of one of the trace for
pipe->mutex
I am using
addr2line
to convert to source code. My goal is to use both file name with line number and function to get the line of acquisition for different locks (as a func can have multiple signature, I need both file and func name to resolve this). While for some traces the function name the the func name I get usingaddr2line
matches for some like the example above, it does not match. For example, forpipe_read
when I convert0xffffffff81391d93
it points to something completely different. I have tried getting the address forpipe_read
and adding the offset for sanity check, the address seems fine but I am not sure why would it point topipe_occupancy
. Among the cases that this is happening, there is case when function pointers are involved. In this example,pipe_read
is accessed via a function pointer. I understand that function pointers are resolved at runtime. I am wondering if anyone can help me understand why there is a mismatch between func name and what I get with addr2line for such cases. Thanks in advance!Beta Was this translation helpful? Give feedback.
All reactions