为什么私有数据是可执行的
我正在使用 vmmap for windows 查看不同应用程序的私有数据。我发现很多应用程序都将私有数据标记为可执行。我还发现从内核非分页池动态分配的页面也是可执行的。 Windows 为什么允许从数据页执行代码。或者有一些特殊情况需要这样做。
谢谢
I was looking into private data for different applications using vmmap for windows. And I found lot of apps have private data marked as executable. I also found dynamically allocated pages from non paged pool of kernel are also executable. How come windows allows to execute code from data pages. Or there are some specific cases where this is required.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
任何动态生成的代码都必须位于可执行页面中。
这很常见。例如,任何 .Net 应用程序、Java 应用程序或 Web 浏览器都会有大量 JIT 代码; ATL 代码使用动态生成的蹦床作为窗口过程;任何重定向 API 的应用程序(例如使用 Detours)都会为重定向的函数创建蹦床。
我不知道内核在做什么,但也许(如 ATL)它使用蹦床来执行性能关键代码以避免表查找。
Any dynamically generated code has to live in an executable page.
This is quite common. For example, any .Net app, Java app or web browser will have plenty of JITted code; ATL code uses dynamically generated trampolines for window procedures; any app that redirects an API (e.g. using Detours) will create trampolines for the redirected functions.
I don't know what the kernel is doing but maybe (like ATL) it uses trampolines for performance critical code to avoid a table lookup.
如果您的代码已经在内核模式下运行,则禁用某些页面的执行在某种程度上是有用的。您的内核模式代码始终可以破解内核或直接操作页表并执行几乎任何操作。
因此,禁用执行可以帮助捕获一些错误,但它对安全性(您已经处于其中)或可靠性(内核模式页面错误触发 BSOD)没有帮助。也许由于这些原因,内核中的所有地方都没有强制执行禁用。
If your code is already running in kernel mode, disabling execution from certain pages is useful up to a point. Your kernel mode code can always hack the kernel or manipulate page tables directly and do pretty much anything.
So, disabling execution can help catch some bugs, but it can't help with security (you're already in) or reliability (kernel mode page faults trigger BSODs). Perhaps for these reasons execution disabling is not enforced everywhere in the kernel.