linux – 什么是汇编中的%gs
发布时间:2021-01-24 12:07:01 所属栏目:Linux 来源:互联网
导读:void return_input (void){ char array[30]; gets (array); printf(%sn, array); } 在gcc中编译之后,此函数将转换为以下程序集代码: push %ebpmov %esp,%ebpsub $0x28,%espmov %gs:0x14,%eaxmov %
void return_input (void)
{
char array[30];
gets (array);
printf("%sn",array);
}
在gcc中编译之后,此函数将转换为以下程序集代码: push %ebp mov %esp,%ebp sub $0x28,%esp mov %gs:0x14,%eax mov %eax,-0x4(%ebp) xor %eax,%eax lea -0x22(%ebp),(%esp) call 0x8048374 lea -0x22(%ebp),(%esp) call 0x80483a4 mov -0x4(%ebp),%eax xor %gs:0x14,%eax je 0x80484ac call 0x8048394 leave ret 我不明白两行: mov %gs:0x14,%eax 什么是%gs,这两行究竟是什么呢? 这是编译命令: cc -c -mpreferred-stack-boundary=2 -ggdb file.c 解决方法GS是一个段寄存器,其在linux中的使用可以在 here上读取(它基本上用于每个进程数据).mov %gs:0x14,%eax 该代码用于验证堆栈没有爆炸或已被证实,使用存储在GS 0x14中的金丝雀值,参见this. (编辑:长春站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- Linux 精准获取进程pid--转
- linux – sqlplus:加载共享库时出错:libsqlplus.so:无法
- Awk by Example--转载
- linux – xorg.conf,xset和xinput set之间有什么区别?
- 使用云形成在linux-Ec2实例中自动挂载ebs卷?
- 是否有可能运行使用linux中的react-native开发的ios应用程序
- linux – 当计算机切换到睡眠模式时,TCP连接会发生什么?
- /bin/bash^M: bad interpreter: 没有那个文件或目录--转载
- linux – 有什么区别:“. [script]“或”source [script]“
- 寻找一种安全的方式来部署PHP代码
