引用维基百科:
Address space layout randomization (ASLR) is a computer security method which involves randomly arranging the positions of key data areas,usually including the base of the executable and position of librarIEs,heap,and stack,in a process’s address space.
Benefits
Address space randomization hinders some types of security attacks by making it more difficult for an attacker to predict target addresses. For example,attackers trying to execute return-to-libc attacks must locate the code to be executed,while other attackers trying to execute shellcode injected on the stack have to find the stack first. In both cases,the related memory addresses are obscured from the attackers. These values have to be guessed,and a mistaken guess is not usually recoverable due to the application crashing.
例如,当我在我的Ubuntu 10.10盒子上重复运行从以下C代码生成的相同可执行文件时:
#include <stdio.h>int g = 0;int main() { int x = 0; printf("%p %p\n",&x,&g);}
局部变量(x)的地址不断变化,但全局变量(g)的地址保持不变.
总结以上是内存溢出为你收集整理的linux – 为什么变量的地址在运行之间不断变化全部内容,希望文章能够帮你解决linux – 为什么变量的地址在运行之间不断变化所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)