卸载内核模块

卸载内核模块

我正在完成内核编程的作业,遇到了一个空指针问题:

[25543.418530] BUG: unable to handle kernel NULL pointer dereference at 00000008
[25543.418533] IP: [<f9d1426c>] init_module+0x25c/0x290 [simple_solution]

现在我正试图杀死这个模块

[01/31/20]seed@VM:~/.../4230_new$ lsmod
Module                  Size  Used by
simple_solution        16384  1

我使用以下方式加载它:

[01/31/20]seed@VM:~/.../4230_new$ sudo insmod simple-solution.ko

尝试删除它:

[01/31/20]seed@VM:~/.../4230_new$ sudo rmmod simple-solution.ko
rmmod: ERROR: Module simple_solution is in use

还尝试过这个:

[01/31/20]seed@VM:~/.../4230_new$ sudo modprobe -r simple_solution
modprobe: FATAL: Module simple_solution not found.
[01/31/20]seed@VM:~/.../4230_new$ sudo modprobe -r simple-solution.ko
modprobe: FATAL: Module simple-solution.ko not found.


Update: Also Tried grep and it returned the module. 

[01/31/20]seed@VM:~/.../4230_new$ lsmod | grep simple_solution
simple_solution        16384  1

我对此有疑问:

  • 为什么找不到我的模块?
  • 有没有什么方法可以用来终止这个过程?

注意:没有任何其他依赖于此的流程

dmesg 日志:

[56173.486387] BUG: unable to handle kernel NULL pointer dereference at 00000018
[56173.486390] IP: [<fb7781fc>] init_module+0x1ec/0x280 [simple_solution]
[56173.486393] *pdpt = 0000000002c58001 *pde = 0000000000000000 
[56173.486395] Oops: 0000 [#1] SMP
[56173.486397] Modules linked in: simple_solution(OE+) nls_utf8 isofs vboxsf(OE) vboxvideo(OE) snd_intel8x0 snd_ac97_codec ac97_bus snd_pcm snd_seq_midi snd_seq_midi_event crc32_pclmul snd_rawmidi aesni_intel snd_seq aes_i586 lrw ablk_helper cryptd snd_seq_device snd_timer joydev input_leds serio_raw i2c_piix4 snd vboxguest(OE) soundcore mac_hid binfmt_misc parport_pc ppdev lp parport autofs4 hid_generic usbhid hid vmwgfx ttm drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops ahci drm psmouse libahci e1000 fjes video pata_acpi
[56173.486414] CPU: 0 PID: 22220 Comm: insmod Tainted: G        W  OE   4.8.0-36-generic #36~16.04.1-Ubuntu
[56173.486415] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
[56173.486417] task: f4e6b480 task.stack: cd510000
[56173.486419] EIP: 0060:[<fb7781fc>] EFLAGS: 00010286 CPU: 0
[56173.486420] EIP is at init_module+0x1ec/0x280 [simple_solution]
[56173.486421] EAX: 00000045 EBX: fb779fe8 ECX: f71c4880 EDX: 00000007
[56173.486422] ESI: cd511f28 EDI: fb778010 EBP: cd511d9c ESP: cd511d84
[56173.486423]  DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
[56173.486425] CR0: 80050033 CR2: 00000018 CR3: 0e8d42e0 CR4: 000406f0
[56173.486428] Stack:
[56173.486429]  fb779098 ce8d4e2c 00000008 0000000d 000007cb 00000000 cd511e10 da002182
[56173.486432]  00000000 f36f6100 00000000 00000002 f7542610 dabf4780 cd511dec f36f6b40
[56173.486434]  f7505670 f6c01c00 cd511df4 da1dcb70 f36f6b40 00000001 cd511e10 da1dd925
[56173.486436] Call Trace:
[56173.486440]  [<da002182>] do_one_initcall+0x42/0x190
[56173.486448]  [<da1dcb70>] ? kfree+0x140/0x150
[56173.486450]  [<da1dd925>] ? kmem_cache_alloc_trace+0x145/0x1a0
[56173.486452]  [<da18190e>] ? do_init_module+0x21/0x1c3
[56173.486453]  [<da18190e>] ? do_init_module+0x21/0x1c3
[56173.486455]  [<da18193d>] do_init_module+0x50/0x1c3
[56173.486457]  [<da100809>] load_module+0x1559/0x1aa0
[56173.486459]  [<da100faa>] SyS_finit_module+0xca/0x110
[56173.486461]  [<da0038ad>] do_fast_syscall_32+0x8d/0x140
[56173.486463]  [<da80dafa>] sysenter_past_esp+0x47/0x75
[56173.486464] Code: a0 77 fb 8b 50 f0 83 e8 0c 89 54 24 10 8b 50 f8 89 54 24 0c 8b 50 f4 89 44 24 04 c7 04 24 98 90 77 fb 89 54 24 08 e8 3b 95 a0 de <a1> 18 00 00 00 3d 00 a0 77 fb 8d 50 e8 75 45 83 c4 14 31 c0 5b
[56173.486479] EIP: [<fb7781fc>] init_module+0x1ec/0x280 [simple_solution] SS:ESP 0068:cd511d84
[56173.486481] CR2: 0000000000000018
[56173.486483] ---[ end trace 1a7bc72bb0629fa0 ]---

相关内容