- 論壇徽章:
- 0
|
最近在分析一個coredump的問題,但是由于core不完整,導(dǎo)致無法直觀的看到案發(fā)現(xiàn)場的調(diào)用棧,只能通過棧楨結(jié)構(gòu)反推。
但是,由于注冊了信號捕獲函數(shù)core_handler。
也就是,coredump發(fā)生時,進程捕獲到coredump信號(如:11信號,07信號等),需要先保護現(xiàn)場(寄存器等信息)
之后再通過系統(tǒng)調(diào)用,進入信號處理函數(shù)core_handler。
但是查了很多資料,沒有明確找到,系統(tǒng)調(diào)用時的現(xiàn)場保護,壓棧了哪些內(nèi)容?壓棧順序是怎么樣的?
在系統(tǒng)調(diào)用這一棧楨看到的內(nèi)容,環(huán)境是x64 suse11的:
gdb查看rsp往上的 22 * 8字節(jié)內(nèi)容,但是不知道前面 5 * 8字節(jié)保存的是什么內(nèi)容?
x /22xg $rsp
? | ? | ? | ? | ? | r8寄存器 | r9寄存器 | r10寄存器 | r11寄存器 | r12寄存器 | r13寄存器 | r14寄存器 | r15寄存器 | rbp寄存器 | rdi寄存器 | rsi寄存器 | rdx寄存器 | rbx寄存器 | rcx寄存器 | rax寄存器 | rsp寄存器 | rip寄存器 |
有看到關(guān)于SAVE_ALL宏的介紹,但是這個應(yīng)該是32位系統(tǒng)的,對于64位系統(tǒng)應(yīng)該不一樣的吧?
#define SAVE_ALL \
cld; \
pushl %es; \
pushl %ds; \
pushl %eax; \
pushl %ebp; \
pushl %edi; \
pushl %esi; \
pushl %edx; \
pushl %ecx; \
pushl %ebx; \
movl $(__USER_DS), %edx; \
movl %edx, %ds; \
movl %edx, %es;
|
|