In the development of my BSc thesis (a rootkit for the 5.4 Linux Kernel), I found myself having to identify a function address (i.e., the address of do_syscall_64()
) in memory. I don't know it in advance 'cause there is KASLR.
What I'm doing is:
- retrieve the system call handler via MSRs;
- scan the memory location starting from the base address of
entry_SYSCALL_64
, which is the system call handler's code block, until I find the actual call todo_syscall_64()
; - isolate 4 bytes after the opcode (i.e.,
e8
), that is the offset to which the execution flow will jump after the call:
e8 c4 bd f8 ff call 0xffffffff81b8be40 <do_syscall_64>
So, what should I do with the hex offset retrieved?
I found out that the address specified after this call
instruction is an offset from the base code segment.
Do I need to convert the offset into decimal and add it to the base code segment address?
Thanks in advance.