Linux 内核编程:“无法处理内核 NULL 指针取消引用”
我正在编写一个 Linux 模块并得到:
Unable to handle kernel NULL pointer dereference
这是什么意思?
I'm writing a Linux module and getting:
Unable to handle kernel NULL pointer dereference
What does it mean?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
听起来好像当前具有 NULL 值(零)的指针正在被取消引用。 在取消引用指针之前为其分配一个地址。
例如
Sounds like a pointer which currently has the NULL value (zero) is being dereferenced. Assign an address to the pointer before dereferencing it.
e.g.
内核尝试从地址
0
读取,您的内核显然对此进行了特殊处理(好事!)。 由于内核无法像我们从用户模式应用程序中知道的那样杀死自己(这些应用程序将收到分段错误),这个错误是致命的。 它可能会恐慌并向您显示该消息。http://en.wikipedia.org/wiki/Null_pointer#The_null_pointer
The kernel tries to read from address
0
, which your kernel apparently treats specially (good thing!). As the kernel has no way to just kill itself like we know from user mode applications (those would have received a Segmentation Fault), this error is fatal. It will have probably panic'ed and displayed that message to you.http://en.wikipedia.org/wiki/Null_pointer#The_null_pointer
这意味着内核试图遵循空指针。 这会产生一个无法在内核中处理的页面错误 - 如果它正在运行用户任务(但在内核空间中),它通常会发出“哎呀”,这(不干净地)杀死当前任务并可能泄漏内核资源。 如果它在其他上下文中,例如中断,它通常会导致内核恐慌。
It means the kernel tried to deference a null pointer. This generates a page fault which can't be handled in the kernel- if it's running a user task (but in kernel space), it generally makes an "Oops" which (uncleanly) kills the current task and may leak kernel resources. If it's in some other context, e.g. an interrupt, it generally causes a kernel panic.