内核函数可以有不同的虚拟地址吗

发布于 2024-12-10 18:41:03 字数 319 浏览 0 评论 0原文

这更像是一个知识问题而不是实际实施。我想知道系统启动后是否有任何内核函数可以拥有不同的虚拟地址。我对可执行文件编译的理解是为其二进制文件分配虚拟地址,但虚拟地址到物理地址是在运行时由操作系统完成的。(分页。我知道这些东西。所以,不需要2解释) 但是对于内核函数,每次重新启动系统时我都会看到它们具有不同的虚拟地址。 1. 内核函数在地址范围内是如何映射的? 2.它们能否在运行时映射到不同的虚拟地址。 (我想知道怎么可能) 3. dll的地址映射是怎样的?它们是在编译时给予虚拟地址还是在运行时分配相对地址? (我认为这就是它的完成方式。) 4. 有没有办法找到是否有任何内核虚拟地址固定到物理内存。

谢谢

This is more like a knowledge question than actual implementation. I was wondering if any kernel function can have different virtual addresses after the system starts. My understanding of compilation for executable is virtual addresses are assigned for its binary but virtual to physical is done at run time by os.(paging. I know that stuff. So, no need 2 explain)
But in case of kernel functions, I see them having different virtual addresses when every time I restart the system.
1. How are kernel functions mapped in the address range? 2. Can they be mapped to different virtual addresses at run time. (I wonder how it is possible) 3. How is the address mapping for dlls? Are they given a virtual address at compilation or assigned a relative address at run time? (I think that's how it is done.) 4. Is there any way to find if any kernel virtual address is pinned to physical memory.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

别把无礼当个性 2024-12-17 18:41:04

传统上,可执行文件在编译时被分配固定的虚拟地址映射。然而,近年来,很明显这对安全不利 - 攻击者可以利用他们对内存中事物确切位置的了解作为攻击的一部分。为了帮助缓解这一问题,可以使用位置无关或可重定位的可执行文件来允许加载地址随机化(至少在 Linux 上)。然而,这也有一个缺点 - 启动程序需要更多时间,因为动态加载器必须执行重定位(要么这样,要么在运行时与位置无关的机器代码会产生额外的开销)。

对于操作系统内核来说,与启动所花费的其余时间相比,额外的开销是微不足道的;事实上,Windows 内核实际上动态链接了它的许多组件。所以内核是随机化加载地址的明显地方。

Traditionally, executables are assigned a fixed virtual address mapping at compile time. However, in recent years, it has become evident that this is bad for security - attackers can use their knowledge of exactly where things are in memory as part of an exploit. To help mitigate this, one can use position-independent or relocatable executables to allow the load address to be randomized (at least on Linux). However, this comes with a downside - starting the program takes more time, as the dynamic loader must perform relocations (either that, or there is additional overhead at runtime from position-independent machine code).

For the OS kernel, the additional overhead is trivial compared to the rest of the time spent booting; indeed, the Windows kernel actually dynamically links many of its components. So the kernel is an obvious place to randomize the load address.

め七分饶幸 2024-12-17 18:41:04
  1. 内核函数如何映射到地址范围内?

它们根本不必映射到用户空间。直到我停止在这方面的练习之前,他们都是通过软中断到达的。

  1. How are kernel functions mapped in the address range?

They aren't necessarily mapped into user space at all. Up until I stopped practicing in this area they were reached by soft interrupts.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文