尝试modprobe驱动程序后“无法在null处理内核空指针解除引用”

时间:2013-10-29 21:32:16

标签: linux-kernel kernel panic

我有一个在启动时初始化驱动程序的脚本,在我启用内核跟踪并重新编译内核以尝试用一个软件调试问题之前,它运行得非常好。如果我尝试以任何方式初始化驱动程序(modprobe,insmod等),则此输出将打印到屏幕:

[   26.263308] BUG: unable to handle kernel NULL pointer dereference at   (null)
[   26.263322] IP: [<c108664d>] trace_module_notify+0x16b/0x20a
[   26.263325] *pde = 00000000 
[   26.263329] Oops: 0000 [#1] PREEMPT SMP 
[   26.263335] Modules linked in: phddrv(O+)
[   26.263343] Pid: 704, comm: insmod Tainted: G           O 3.6.3-rt9 #21 Advanced     Digital Logic, Inc CB4053/ADLS15PC
[   26.263346] EIP: 0060:[<c108664d>] EFLAGS: 00010213 CPU: 0
[   26.263350] EIP is at trace_module_notify+0x16b/0x20a
[   26.263353] EAX: ee6e9274 EBX: f082550c ECX: ee6e920c EDX: f082550c
[   26.263356] ESI: 00000000 EDI: ee6e92dc EBP: ee6ebf4c ESP: ee6ebf24    
[   26.263359]  DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
[   26.263362] CR0: 8005003b CR2: 00000000 CR3: 2f2ea000 CR4: 000007d0
[   26.263365] DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
[   26.263367] DR6: ffff0ff0 DR7: 00000400
[   26.263371] Process insmod (pid: 704, ti=ee6ea000 task=ef218000 task.ti=ee6ea000)
[   26.263372] Stack:
[   26.263381]  ee6e9274 ee6e9344 ee6e92dc ee6e920c ee6e9274 ee6e9344 c2086424 c15a5d58
[   26.263388]  00000000 00000001 ee6ebf68 c1046d33 f082550c c15a51bc c15a3778 00000000
[   26.263396]  c15a3790 ee6ebf8c c1046fa9 fffffffd 00000000 f082550c 00000001 f082550c
[   26.263397] Call Trace:
[   26.263407]  [<c1046d33>] notifier_call_chain+0x2b/0x4d
[   26.263413]  [<c1046fa9>] __blocking_notifier_call_chain+0x3c/0x51
[   26.263419]  [<c1046fcf>] blocking_notifier_call_chain+0x11/0x13
[   26.263426]  [<c10671b7>] sys_init_module+0x57/0x190
[   26.263434]  [<c13a3d10>] sysenter_do_call+0x12/0x26
[   26.263489] Code: 00 c7 42 04 64 5d 5a c1 89 15 64 5d 5a c1 89 45 ec 8d 42 74 83 c2 0c 89 45 e8 89 55 e4 eb 19 57 8b 4d e4 89 da ff 75 ec ff 75 e8 <8b> 06 83 c6 04 e8 c2 fb ff ff 83 c4 0c 3b 75 f0 72 e2 eb 77 b8
[   26.263495] EIP: [<c108664d>] trace_module_notify+0x16b/0x20a SS:ESP 0068:ee6ebf24
[   26.263497] CR2: 0000000000000000
[   26.267381] ---[ end trace 0000000000000002 ]---

任何有关正在发生的事情的提示都将不胜感激!

2 个答案:

答案 0 :(得分:2)

我遇到了类似的问题(几乎相同的恐慌堆栈痕迹)。 我的根本原因是,在我更改内核配置(启用跟踪点)后,我只重建了内核bzImage,但忘了重建ko模块!这可能会导致新内核和旧ko模块之间的执行不匹配。 重建并更新内核映像和ko模块后,问题就消失了。

答案 1 :(得分:0)

在驱动程序的某处有一个NULL指针。指针变量值的值为NULL,驱动程序正在尝试使用它。

myPtr->value;   /* if myPtr is NULL, this will raise the kernel oops */

您必须调试驱动程序以找到存在空指针的位置和原因