简体   繁体   English

Linux 内核编程:“无法处理内核空指针解引用”

[英]Linux Kernel Programming: "Unable to handle kernel NULL pointer dereference"

I'm writing a Linux module and getting:我正在编写一个 Linux 模块并得到:

Unable to handle kernel NULL pointer dereference

What does it mean?这是什么意思?

Sounds like a pointer which currently has the NULL value (zero) is being dereferenced.听起来像当前具有 NULL 值(零)的指针正在被取消引用。 Assign an address to the pointer before dereferencing it.在取消引用之前为指针分配一个地址。

eg例如

int x = 5;
int * x_ptr = NULL;

x_ptr = &x; // this line may be missing in your code

*x_ptr += 5; //can't dereference x_ptr here if x_ptr is still NULL

The kernel tries to read from address 0 , which your kernel apparently treats specially (good thing!).内核尝试从地址0读取,您的内核显然对其进行了特殊处理(好事!)。 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 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.这会产生一个无法在内核中处理的页面错误——如果它正在运行一个用户任务(但在内核空间中),它通常会产生一个“Oops”,它(不干净地)杀死当前任务并可能泄漏内核资源。 If it's in some other context, eg an interrupt, it generally causes a kernel panic.如果是在其他上下文中,例如中断,则通常会导致内核崩溃。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Linux 内核编程:“无法处理虚拟地址 [地址] 处的内核空指针取消引用” - Linux Kernel Programming: “Unable to handle kernel NULL pointer dereference at virtual address [address]” 无法处理内核空指针取消引用 - unable to handle kernel null pointer dereference Helping with Linux kernel dump crash: Unable to handle kernel NULL pointer dereference at virtual address 00000001 - Helping with Linux kernel dump crash: Unable to handle kernel NULL pointer dereference at virtual address 00000001 “无法在虚拟地址处处理内核NULL指针取消引用。”-在向内核模块发送信号时| 面向对象 - “Unable to handle kernel NULL pointer dereference at Virtual Address.” - On signalling the Kernel Module | OOPS 内核无法处理NULL指针解除引用 - 使用kmem_cache_alloc和struct - Kernel unable to handle NULL pointer dereference - using kmem_cache_alloc with struct 来自 kzalloc 的 memset 中的 Linux 内核空指针取消引用 - Linux kernel NULL-pointer dereference in memset from kzalloc BUG:使用linux链表时kernel NULL指针解引用 - BUG: kernel NULL pointer dereference when using linux linked list Linux内核模块编程 - Linux kernel module programming 无法处理内核模块中的空指针 - Unable to handle null pointers in Kernel Module Linux Kernel 编程中的前导下划线 - Leading Underscores in Linux Kernel Programming
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM