这可能是一个愚蠢的问题,但我正在使用 gdb 调试一个二进制文件,试图对其进行“逆向工程”,并到达一条指令,该指令进行系统调用,之后出现我想要逆向工程的效果。我假设另一个进程正在接管并完成这项工作,所以我想知道是否可以调试使用 gdb 处理系统调用的内核代码。
以下是进行系统调用的 x86 程序集片段(看起来是 sys_getpid):
0x00007ffff7660d3e <+14>: movsxd rdx,edx
0x00007ffff7660d41 <+17>: movsxd rdi,edi
0x00007ffff7660d44 <+20>: mov eax,0x14
0x00007ffff7660d49 <+25>: syscall
The syscall
(or sysenter
or int 0x80
等等...)机器指令用于制作syscalls http://en.wikipedia.org/wiki/Syscall根据定义,它们由Linux内核 http://en.wikipedia.org/wiki/Linux_kernel。详细信息定义在x86-64 ABI 规范 http://www.x86-64.org/documentation/abi.pdf. Read 高级Linux编程 http://advancedlinuxprogramming.com/以了解其中大多数的概述。也可以看看Linux 汇编指南 http://asm.sourceforge.net/howto/Assembly-HOWTO.html.
From the point of view of a user application, a syscall is a virtual atomic instruction.
没有特定的用户态进程正在处理系统调用,处理它们是内核的工作,并且它几乎是应用程序与内核交互的唯一方式。
the processing of syscalls by the kernel for a given process is accounted as system CPU time, e.g. by time(1) http://man7.org/linux/man-pages/man1/time.1.html
记录的系统调用列表在系统调用(2) http://man7.org/linux/man-pages/man2/syscalls.2.html。也可以看看<asm/unistd.h>
and <asm/unistd_64.h>
等等...标题。
你可以使用跟踪(1) http://man7.org/linux/man-pages/man1/strace.1.html了解(某些进程的)特定运行所完成的系统调用的顺序。
也可以看看vdso(7) http://man7.org/linux/man-pages/man7/vdso.7.html.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)