0

given a stack like the following:

cat /proc/17019/stack
[<0>] futex_wait_queue_me+0xc4/0x120
[<0>] futex_wait+0x10a/0x250
[<0>] do_futex+0x325/0x500
[<0>] SyS_futex+0x13b/0x180
[<0>] do_syscall_64+0x73/0x130
[<0>] entry_SYSCALL_64_after_hwframe+0x3d/0xa2
[<0>] 0xffffffffffffffff

take the line futex_wait_queue_me+0xc4/0x120 as an example, what does 0xc4 and 0x120 mean?

and additionally, how can I figure out the line of code corresponding to this address?

DeanSinaean
  • 2,297
  • 4
  • 16
  • 19

1 Answers1

2

futex_wait_queue_me+0xc4/0x120 - In call stack at this function current operation is at offset 0xc4 and total size of the function is 0x120, both are in hexadecimal format. For Kernel subroutines, you can get the corresponding line by using objdump of vmlinux provided it has debug symbols to map it.

As shown below in system_call_fastpath, current offset of 0x22 is actually 34d in disassembled output.

[root@linux ~]# cat /proc/26581/stack
[<ffffffff9f28eace>] ep_poll+0x23e/0x360  
[<ffffffff9f28ff9d>] SyS_epoll_wait+0xed/0x120
[<ffffffff9f774ddb>] system_call_fastpath+0x22/0x27
[<ffffffffffffffff>] 0xffffffffffffffff

(gdb) disassemble system_call_fastpath
Dump of assembler code for function system_call_fastpath:
0xffffffff81774db9 <+0>:     cmp    $0x14c,%rax
0xffffffff81774dbf <+6>:     jae    0xffffffff81774f43 <badsys>
0xffffffff81774dc5 <+12>:    sbb    %rcx,%rcx
0xffffffff81774dc8 <+15>:    and    %rcx,%rax
0xffffffff81774dcb <+18>:    mov    %r10,%rcx
0xffffffff81774dce <+21>:    mov    -0x7e7fd6c0(,%rax,8),%rax
0xffffffff81774dd6 <+29>:    callq  0xffffffff81386770 <__x86_indirect_thunk_rax>
0xffffffff81774ddb <+34>:    mov    %rax,0x50(%rsp)
End of assembler dump.
(gdb) 
Sunil Bojanapally
  • 12,528
  • 4
  • 33
  • 46