内核线程对内核地址空间的任意读取是否会引发恐慌?
我们知道,在用户空间中,如果某些虚拟地址空间尚未分配但已被访问,则会发生页面错误。
那么在内核空间呢?例如,我想在Linux中运行一个内核线程,天真地读取最高1G地址空间的每个字。
我想这是可以的,即内核线程在内核地址空间中的任意读取不会引起恐慌。正确吗?有谁能详细说一下吗?如果在一些空白区域读取怎么办?
As we know in user space, if some virtual address space is not allocated yet but accessed, a page fault will occur.
How about in kernel space? For example, I want to run a kernel thread in Linux to, naively, read each word of the highest 1G address space.
I guess it is OK, i.e. an arbitrary read in kernel address space by a kernel thread will incur no panic. Is it correct? Can anybody detail it? What if read on some empty area?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你无法读取未映射到内核空间的内存地址,处理器会捕获该地址并生成错误,在 Linux 下将报告为 Oops。请参阅http://www.kerneloops.org/
You can't read a memory address which is not mapped in kernel space, the processor will catch that and generate a fault, which will be reported as an Oops under Linux. See http://www.kerneloops.org/