Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSAPP bomb lab 有感 #10

Open
wisecsj opened this issue Jan 13, 2019 · 2 comments
Open

CSAPP bomb lab 有感 #10

wisecsj opened this issue Jan 13, 2019 · 2 comments

Comments

@wisecsj
Copy link
Owner

wisecsj commented Jan 13, 2019

1.熟悉了gdb命令行的使用,之前基本都是用的gui来操作

2.熟悉了linux下一些关于二进制和汇编的tool,譬如objdump、readelf

3.熟悉了AT&T格式的汇编,各种操作符,x86-64下的寄存器使用规范,各种控制结构的汇编形式实现

PS:19年的408一道大题就是类似这个lab的形式

@wisecsj
Copy link
Owner Author

wisecsj commented Jan 14, 2019

具体点讲的话,从阅读一个函数的汇编代码,理清了过程调用中一些事情的发生顺序:

default

譬如main调用上图中的phase_2 function,过程大致如下:

  • call phase_2,将返回地址入栈,进入phase_2
  • phase_2,首先将需要的由被调用者进行保存的寄存器,push到栈里,然后对rsp进行sub,开辟新的栈空间
  • 执行phase_2
  • 执行完毕,对rsp进行add,归还栈空间,恢复第二步中保存的寄存器(通过pop)
  • retq,pop栈顶的值(即返回地址),赋给PC,恢复调用函数的执行

@wisecsj
Copy link
Owner Author

wisecsj commented Jan 14, 2019

default

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant