“堆栈以每个程序的相同地址开始" [英] "the stack begins with the same address for every program"

查看:18
本文介绍了“堆栈以每个程序的相同地址开始"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

机器上运行的每个进程都给人一种错觉,认为它是机器上运行的唯一进程.每个进程都有一个文本、数据和一个堆栈部分.

Every process running on a machine is given the illusion that it is the only process running on it. And every process has a text, data and a stack section.

然而,我不明白为什么每个进程的堆栈地址都从同一个地址开始(假设没有安装内核补丁并且禁用了地址随机化).

However, I fail to understand why the stack address of every process starts off at the same address(assuming that no kernel patches are installed and Address randomization is disabled).

有人可以向我指出一些阅读资源或解释为什么会发生这种情况吗?

Could someone point me towards a few reading resources or explain why this happens?

推荐答案

堆增大,栈减小,所以在大多数操作系统上虚拟空间看起来像:

The heap grows up and the stack grows down, so on most operating systems the virtual space looks like:

Program text
Program data/bss
Heap
(dynamically grows up)
...
...
(dynamically growing down)
stack

因此,堆的位置根据程序大小移动,但堆栈的起始空间不依赖于程序的任何内容.

Thus the location of the heap moves depending on the program size but the stack's starting space is not dependent on anything about the program.

这篇关于“堆栈以每个程序的相同地址开始"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆