gpt4 book ai didi

windows - 为什么栈的 "logical bottom"和 "physical bottom"的偏移量是随机的?

转载 作者:可可西里 更新时间:2023-11-01 10:33:55 24 4
gpt4 key购买 nike

我使用 windbg 在我的 Windows 10 机器上运行一个程序,并让它在初始断点处中断。我获取堆栈的物理底部地址(TEB 的 stackBase),并减去 ntdll!LdrInitializeThunkrsp 值。我只是在同一个程序上做了 5 次,我得到了 5 个不同的值:

0x600
0x9f0
0xa40
0x5d0
0x570

如果您对 ntdll!RtlUserThreadStart 等执行相同的操作,您会得到类似的结果。这表明堆栈的“逻辑底部”在某种程度上是随机的。这是为什么?这是堆栈内部的某种“迷你 ASLR”吗?这在任何地方都有记录吗?

最佳答案

在专门针对 Vista 中的 ASLR 进行一些谷歌搜索后(ASLR 在 Vista 中引入),我找到了 this document来自赛门铁克。在第5页,它提到了我的问题是关于(强调我的)的现象:

Once the stack has been placed, the initial stack pointer is further randomized by a random decremental amount. The initial offset is selected to be up to half a page (2,048 bytes), but is limited to naturally aligned addresses [...]

所以它似乎是出于安全原因故意完成的(这样就更难找出位于相对于堆栈基址的固定偏移处的事物的地址)。

我将这个问题悬而未决一段时间,希望有人能提供更有见地的答案。如果没有人这样做,我会接受这个答案。

关于windows - 为什么栈的 "logical bottom"和 "physical bottom"的偏移量是随机的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38172157/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com