dtrace4linux / linux

dtrace for linux - kernel driver and userland tools
http://crtags.blogspot.com
1.17k stars 226 forks source link

dtracedrv fails to create /proc/dtrace/idt and gdt #98

Open orivej opened 9 years ago

orivej commented 9 years ago

Upon loading dtracedrv (patched as described in #94) under AMD64 3.18.1, /proc/dtrace/idt and gdt are not created, and upon immediate unloading this leads to null pointer dereference. (Otherwise I experience #95.)

# modprobe dtracedrv
# ls /proc/dtrace/
debug  fasttrap  fbt  security  stats  syscall  trace
# modprobe -r dtracedrv
Killed
# dmesg
[  119.091987] ------------[ cut here ]------------
[  119.092010] WARNING: CPU: 2 PID: 5297 at fs/proc/generic.c:510 remove_proc_entry+0x139/0x1b0()
[  119.092013] name 'dtrace/idt'
[  119.092016] Modules linked in: dtracedrv(PO-) fuse snd_seq snd_seq_device snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic dell_wmi ppdev sparse_keymap dell_laptop uvcvideo intel_rapl x86_pkg_temp_thermal intel_powerclamp videobuf2_vmalloc videobuf2_memops ath9k videobuf2_core coretemp ath9k_common kvm_intel ath9k_hw ath3k kvm btusb i915 sdhci_pci hid_multitouch bluetooth serio_raw pcspkr ath fbcon bitblit fbcon_rotate snd_hda_intel fbcon_ccw iTCO_wdt iTCO_vendor_support fbcon_ud snd_hda_controller sdhci_acpi fbcon_cw wmi softcursor snd_hda_codec sdhci font e1000e tileblit parport_pc parport mmc_core dw_dmac 8250_fintek drm_kms_helper snd_soc_sst_acpi dw_dmac_core snd_hwdep 8250_dw mei_me ptp snd_pcm intel_gtt 8250 shpchp pps_core mei i2c_i801 snd_timer spi_pxa2xx_platform mac_hid zfs(PO)
[  119.092108]  zunicode(PO) zavl(PO) zcommon(PO) znvpair(PO) spl(O)
[  119.092120] CPU: 2 PID: 5297 Comm: modprobe Tainted: P           O   3.18.1-gentoo #9
[  119.092124] Hardware name: Dell Inc. Latitude E7240/0414F8, BIOS A07 01/02/2014
[  119.092126]  0000000000000000 0000000000000009 ffffffff81f98ec6 ffff8800d5423e18
[  119.092133]  ffffffff810eb277 0000000000000000 ffff8801c1cf9f30 ffffffffa0939458
[  119.092138]  ffffffffa0939451 0000000000000003 ffffffff810eb2da ffffffff823b98e5
[  119.092144] Call Trace:
[  119.092156]  [<ffffffff81f98ec6>] ? dump_stack+0x49/0x6a
[  119.092166]  [<ffffffff810eb277>] ? warn_slowpath_common+0x77/0x90
[  119.092173]  [<ffffffff810eb2da>] ? warn_slowpath_fmt+0x4a/0x50
[  119.092181]  [<ffffffff812824f9>] ? remove_proc_entry+0x139/0x1b0
[  119.092190]  [<ffffffff8115cc60>] ? module_refcount+0xc0/0xc0
[  119.092210]  [<ffffffffa091cff7>] ? intr_exit+0x17/0xd0 [dtracedrv]
[  119.092219]  [<ffffffffa0926bd7>] ? dtracedrv_exit+0x76/0x17a [dtracedrv]
[  119.092228]  [<ffffffff8115e4ab>] ? SyS_delete_module+0x11b/0x1a0
[  119.092236]  [<ffffffff81fa3c4f>] ? int_signal+0x12/0x17
[  119.092242]  [<ffffffff81fa39ad>] ? system_call_fastpath+0x16/0x1b
[  119.092246] ---[ end trace 80b5458924c11acd ]---
[  119.092249] ------------[ cut here ]------------
[  119.092256] WARNING: CPU: 2 PID: 5297 at fs/proc/generic.c:510 remove_proc_entry+0x139/0x1b0()
[  119.092259] name 'dtrace/gdt'
[  119.092261] Modules linked in: dtracedrv(PO-) fuse snd_seq snd_seq_device snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic dell_wmi ppdev sparse_keymap dell_laptop uvcvideo intel_rapl x86_pkg_temp_thermal intel_powerclamp videobuf2_vmalloc videobuf2_memops ath9k videobuf2_core coretemp ath9k_common kvm_intel ath9k_hw ath3k kvm btusb i915 sdhci_pci hid_multitouch bluetooth serio_raw pcspkr ath fbcon bitblit fbcon_rotate snd_hda_intel fbcon_ccw iTCO_wdt iTCO_vendor_support fbcon_ud snd_hda_controller sdhci_acpi fbcon_cw wmi softcursor snd_hda_codec sdhci font e1000e tileblit parport_pc parport mmc_core dw_dmac 8250_fintek drm_kms_helper snd_soc_sst_acpi dw_dmac_core snd_hwdep 8250_dw mei_me ptp snd_pcm intel_gtt 8250 shpchp pps_core mei i2c_i801 snd_timer spi_pxa2xx_platform mac_hid zfs(PO)
[  119.092330]  zunicode(PO) zavl(PO) zcommon(PO) znvpair(PO) spl(O)
[  119.092338] CPU: 2 PID: 5297 Comm: modprobe Tainted: P        W  O   3.18.1-gentoo #9
[  119.092341] Hardware name: Dell Inc. Latitude E7240/0414F8, BIOS A07 01/02/2014
[  119.092343]  0000000000000000 0000000000000009 ffffffff81f98ec6 ffff8800d5423e18
[  119.092349]  ffffffff810eb277 0000000000000000 ffff8801c1cf9f30 ffffffffa0939463
[  119.092354]  ffffffffa093945c 0000000000000003 ffffffff810eb2da ffffffff823b98e5
[  119.092359] Call Trace:
[  119.092365]  [<ffffffff81f98ec6>] ? dump_stack+0x49/0x6a
[  119.092372]  [<ffffffff810eb277>] ? warn_slowpath_common+0x77/0x90
[  119.092378]  [<ffffffff810eb2da>] ? warn_slowpath_fmt+0x4a/0x50
[  119.092386]  [<ffffffff812824f9>] ? remove_proc_entry+0x139/0x1b0
[  119.092392]  [<ffffffff8115cc60>] ? module_refcount+0xc0/0xc0
[  119.092406]  [<ffffffffa091d005>] ? intr_exit+0x25/0xd0 [dtracedrv]
[  119.092415]  [<ffffffffa0926bd7>] ? dtracedrv_exit+0x76/0x17a [dtracedrv]
[  119.092422]  [<ffffffff8115e4ab>] ? SyS_delete_module+0x11b/0x1a0
[  119.092428]  [<ffffffff81fa3c4f>] ? int_signal+0x12/0x17
[  119.092434]  [<ffffffff81fa39ad>] ? system_call_fastpath+0x16/0x1b
[  119.092437] ---[ end trace 80b5458924c11ace ]---
[  119.092452] BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
[  119.092610] IP: [<ffffffff81504b4a>] misc_deregister+0x3a/0xb0
[  119.092723] PGD 9bd45067 PUD d5b5e067 PMD 0 
[  119.092812] Oops: 0002 [#1] PREEMPT SMP 
[  119.092895] Modules linked in: dtracedrv(PO-) fuse snd_seq snd_seq_device snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic dell_wmi ppdev sparse_keymap dell_laptop uvcvideo intel_rapl x86_pkg_temp_thermal intel_powerclamp videobuf2_vmalloc videobuf2_memops ath9k videobuf2_core coretemp ath9k_common kvm_intel ath9k_hw ath3k kvm btusb i915 sdhci_pci hid_multitouch bluetooth serio_raw pcspkr ath fbcon bitblit fbcon_rotate snd_hda_intel fbcon_ccw iTCO_wdt iTCO_vendor_support fbcon_ud snd_hda_controller sdhci_acpi fbcon_cw wmi softcursor snd_hda_codec sdhci font e1000e tileblit parport_pc parport mmc_core dw_dmac 8250_fintek drm_kms_helper snd_soc_sst_acpi dw_dmac_core snd_hwdep 8250_dw mei_me ptp snd_pcm intel_gtt 8250 shpchp pps_core mei i2c_i801 snd_timer spi_pxa2xx_platform mac_hid zfs(PO)
[  119.094435]  zunicode(PO) zavl(PO) zcommon(PO) znvpair(PO) spl(O)
[  119.094542] CPU: 2 PID: 5297 Comm: modprobe Tainted: P        W  O   3.18.1-gentoo #9
[  119.094676] Hardware name: Dell Inc. Latitude E7240/0414F8, BIOS A07 01/02/2014
[  119.094802] task: ffff8801c8c3c0c0 ti: ffff8800d5420000 task.ti: ffff8800d5420000
[  119.094931] RIP: 0010:[<ffffffff81504b4a>]  [<ffffffff81504b4a>] misc_deregister+0x3a/0xb0
[  119.095083] RSP: 0018:ffff8800d5423ed8  EFLAGS: 00010247
[  119.095176] RAX: 0000000000000000 RBX: ffffffffa0940b40 RCX: 0000000000000006
[  119.095299] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff8802132a4d00
[  119.095422] RBP: 00000000ffffff40 R08: 000000000000000a R09: 0000000000000001
[  119.095544] R10: 0000000000000469 R11: ffff8800d5423afe R12: 0000000000000000
[  119.095667] R13: 0000000000000001 R14: 0000000002536500 R15: 0000000000000000
[  119.095791] FS:  00007f588cf83700(0000) GS:ffff88021eb00000(0000) knlGS:0000000000000000
[  119.095930] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  119.096030] CR2: 0000000000000008 CR3: 000000009c839000 CR4: 00000000001407e0
[  119.096154] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  119.096278] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[  119.096400] Stack:
[  119.096436]  0000000000000000 0000000000000000 ffffffffa0967660 ffffffffa0926be1
[  119.096580]  000000000000001f ffffffff8115e4ab ffff8801df28ea00 0000000000000002
[  119.096725]  ffffffffa0967660 00007fff00000000 ffff8800d5423f14 7264656361727464
[  119.096869] Call Trace:
[  119.096921]  [<ffffffffa0926be1>] ? dtracedrv_exit+0x80/0x17a [dtracedrv]
[  119.097042]  [<ffffffff8115e4ab>] ? SyS_delete_module+0x11b/0x1a0
[  119.097151]  [<ffffffff81fa3c4f>] ? int_signal+0x12/0x17
[  119.097247]  [<ffffffff81fa39ad>] ? system_call_fastpath+0x16/0x1b
[  119.097354] Code: 53 48 89 fb 48 83 ec 08 2b 2f 48 39 47 18 74 77 48 c7 c7 40 82 6a 82 e8 e5 cc a9 00 48 8b 43 20 48 8b 53 18 48 8b 3d 9e b1 50 01 <48> 89 42 08 48 89 10 48 b8 00 01 10 00 00 00 ad de 8b 33 48 89 
[  119.097957] RIP  [<ffffffff81504b4a>] misc_deregister+0x3a/0xb0
[  119.098056]  RSP <ffff8800d5423ed8>
[  119.098112] CR2: 0000000000000008
[  119.122547] ---[ end trace 80b5458924c11acf ]---
dtrace4linux commented 9 years ago

I think this is fixed in my (sometime) next release - the dying on exit. But I think one of the symbols is missing in the kernel leading to a reason why the driver wont startup.

3.16 and above kernels are not properly supported (yet).

On 19 January 2015 at 03:18, Orivej Desh notifications@github.com wrote:

Upon loading dtracedrv (patched as described in #94 https://github.com/dtrace4linux/linux/issues/94) under AMD64 3.18.1, /proc/dtrace/idt and gdt are not created, and upon immediate unloading this leads to null pointer dereference. (Otherwise I experience #95 https://github.com/dtrace4linux/linux/issues/95.)

[ 119.091987] ------------[ cut here ]------------ [ 119.092010] WARNING: CPU: 2 PID: 5297 at fs/proc/generic.c:510 remove_proc_entry+0x139/0x1b0() [ 119.092013] name 'dtrace/idt' [ 119.092016] Modules linked in: dtracedrv(PO-) fuse snd_seq snd_seq_device snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic dell_wmi ppdev sparse_keymap dell_laptop uvcvideo intel_rapl x86_pkg_temp_thermal intel_powerclamp videobuf2_vmalloc videobuf2_memops ath9k videobuf2_core coretemp ath9k_common kvm_intel ath9k_hw ath3k kvm btusb i915 sdhci_pci hid_multitouch bluetooth serio_raw pcspkr ath fbcon bitblit fbcon_rotate snd_hda_intel fbcon_ccw iTCO_wdt iTCO_vendor_support fbcon_ud snd_hda_controller sdhci_acpi fbcon_cw wmi softcursor snd_hda_codec sdhci font e1000e tileblit parport_pc parport mmc_core dw_dmac 8250_fintek drm_kms_helper snd_soc_sst_acpi dw_dmac_core snd_hwdep 8250_dw mei_me ptp snd_pcm intel_gtt 8250 shpchp pps_core mei i2c_i801 snd_timer spi_pxa2xx_platform mac_hid zfs(PO) [ 119.092108] zunicode(PO) zavl(PO) zcommon(PO) znvpair(PO) spl(O) [ 119.092120] CPU: 2 PID: 5297 Comm: modprobe Tainted: P O 3.18.1-gentoo #9 [ 119.092124] Hardware name: Dell Inc. Latitude E7240/0414F8, BIOS A07 01/02/2014 [ 119.092126] 0000000000000000 0000000000000009 ffffffff81f98ec6 ffff8800d5423e18 [ 119.092133] ffffffff810eb277 0000000000000000 ffff8801c1cf9f30 ffffffffa0939458 [ 119.092138] ffffffffa0939451 0000000000000003 ffffffff810eb2da ffffffff823b98e5 [ 119.092144] Call Trace: [ 119.092156] [] ? dump_stack+0x49/0x6a [ 119.092166] [] ? warn_slowpath_common+0x77/0x90 [ 119.092173] [] ? warn_slowpath_fmt+0x4a/0x50 [ 119.092181] [] ? remove_proc_entry+0x139/0x1b0 [ 119.092190] [] ? module_refcount+0xc0/0xc0 [ 119.092210] [] ? intr_exit+0x17/0xd0 [dtracedrv] [ 119.092219] [] ? dtracedrv_exit+0x76/0x17a [dtracedrv] [ 119.092228] [] ? SyS_delete_module+0x11b/0x1a0 [ 119.092236] [] ? int_signal+0x12/0x17 [ 119.092242] [] ? system_call_fastpath+0x16/0x1b [ 119.092246] ---[ end trace 80b5458924c11acd ]--- [ 119.092249] ------------[ cut here ]------------ [ 119.092256] WARNING: CPU: 2 PID: 5297 at fs/proc/generic.c:510 remove_proc_entry+0x139/0x1b0() [ 119.092259] name 'dtrace/gdt' [ 119.092261] Modules linked in: dtracedrv(PO-) fuse snd_seq snd_seq_device snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic dell_wmi ppdev sparse_keymap dell_laptop uvcvideo intel_rapl x86_pkg_temp_thermal intel_powerclamp videobuf2_vmalloc videobuf2_memops ath9k videobuf2_core coretemp ath9k_common kvm_intel ath9k_hw ath3k kvm btusb i915 sdhci_pci hid_multitouch bluetooth serio_raw pcspkr ath fbcon bitblit fbcon_rotate snd_hda_intel fbcon_ccw iTCO_wdt iTCO_vendor_support fbcon_ud snd_hda_controller sdhci_acpi fbcon_cw wmi softcursor snd_hda_codec sdhci font e1000e tileblit parport_pc parport mmc_core dw_dmac 8250_fintek drm_kms_helper snd_soc_sst_acpi dw_dmac_core snd_hwdep 8250_dw mei_me ptp snd_pcm intel_gtt 8250 shpchp pps_core mei i2c_i801 snd_timer spi_pxa2xx_platform mac_hid zfs(PO) [ 119.092330] zunicode(PO) zavl(PO) zcommon(PO) znvpair(PO) spl(O) [ 119.092338] CPU: 2 PID: 5297 Comm: modprobe Tainted: P W O 3.18.1-gentoo #9 [ 119.092341] Hardware name: Dell Inc. Latitude E7240/0414F8, BIOS A07 01/02/2014 [ 119.092343] 0000000000000000 0000000000000009 ffffffff81f98ec6 ffff8800d5423e18 [ 119.092349] ffffffff810eb277 0000000000000000 ffff8801c1cf9f30 ffffffffa0939463 [ 119.092354] ffffffffa093945c 0000000000000003 ffffffff810eb2da ffffffff823b98e5 [ 119.092359] Call Trace: [ 119.092365] [] ? dump_stack+0x49/0x6a [ 119.092372] [] ? warn_slowpath_common+0x77/0x90 [ 119.092378] [] ? warn_slowpath_fmt+0x4a/0x50 [ 119.092386] [] ? remove_proc_entry+0x139/0x1b0 [ 119.092392] [] ? module_refcount+0xc0/0xc0 [ 119.092406] [] ? intr_exit+0x25/0xd0 [dtracedrv] [ 119.092415] [] ? dtracedrv_exit+0x76/0x17a [dtracedrv] [ 119.092422] [] ? SyS_delete_module+0x11b/0x1a0 [ 119.092428] [] ? int_signal+0x12/0x17 [ 119.092434] [] ? system_call_fastpath+0x16/0x1b [ 119.092437] ---[ end trace 80b5458924c11ace ]--- [ 119.092452] BUG: unable to handle kernel NULL pointer dereference at 0000000000000008 [ 119.092610] IP: [] misc_deregister+0x3a/0xb0 [ 119.092723] PGD 9bd45067 PUD d5b5e067 PMD 0 [ 119.092812] Oops: 0002 [#1] PREEMPT SMP [ 119.092895] Modules linked in: dtracedrv(PO-) fuse snd_seq snd_seq_device snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic dell_wmi ppdev sparse_keymap dell_laptop uvcvideo intel_rapl x86_pkg_temp_thermal intel_powerclamp videobuf2_vmalloc videobuf2_memops ath9k videobuf2_core coretemp ath9k_common kvm_intel ath9k_hw ath3k kvm btusb i915 sdhci_pci hid_multitouch bluetooth serio_raw pcspkr ath fbcon bitblit fbcon_rotate snd_hda_intel fbcon_ccw iTCO_wdt iTCO_vendor_support fbcon_ud snd_hda_controller sdhci_acpi fbcon_cw wmi softcursor snd_hda_codec sdhci font e1000e tileblit parport_pc parport mmc_core dw_dmac 8250_fintek drm_kms_helper snd_soc_sst_acpi dw_dmac_core snd_hwdep 8250_dw mei_me ptp snd_pcm intel_gtt 8250 shpchp pps_core mei i2c_i801 snd_timer spi_pxa2xx_platform mac_hid zfs(PO) [ 119.094435] zunicode(PO) zavl(PO) zcommon(PO) znvpair(PO) spl(O) [ 119.094542] CPU: 2 PID: 5297 Comm: modprobe Tainted: P W O 3.18.1-gentoo #9 [ 119.094676] Hardware name: Dell Inc. Latitude E7240/0414F8, BIOS A07 01/02/2014 [ 119.094802] task: ffff8801c8c3c0c0 ti: ffff8800d5420000 task.ti: ffff8800d5420000 [ 119.094931] RIP: 0010:[] [] misc_deregister+0x3a/0xb0 [ 119.095083] RSP: 0018:ffff8800d5423ed8 EFLAGS: 00010247 [ 119.095176] RAX: 0000000000000000 RBX: ffffffffa0940b40 RCX: 0000000000000006 [ 119.095299] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff8802132a4d00 [ 119.095422] RBP: 00000000ffffff40 R08: 000000000000000a R09: 0000000000000001 [ 119.095544] R10: 0000000000000469 R11: ffff8800d5423afe R12: 0000000000000000 [ 119.095667] R13: 0000000000000001 R14: 0000000002536500 R15: 0000000000000000 [ 119.095791] FS: 00007f588cf83700(0000) GS:ffff88021eb00000(0000) knlGS:0000000000000000 [ 119.095930] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 119.096030] CR2: 0000000000000008 CR3: 000000009c839000 CR4: 00000000001407e0 [ 119.096154] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 119.096278] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 119.096400] Stack: [ 119.096436] 0000000000000000 0000000000000000 ffffffffa0967660 ffffffffa0926be1 [ 119.096580] 000000000000001f ffffffff8115e4ab ffff8801df28ea00 0000000000000002 [ 119.096725] ffffffffa0967660 00007fff00000000 ffff8800d5423f14 7264656361727464 [ 119.096869] Call Trace: [ 119.096921] [] ? dtracedrv_exit+0x80/0x17a [dtracedrv] [ 119.097042] [] ? SyS_delete_module+0x11b/0x1a0 [ 119.097151] [] ? int_signal+0x12/0x17 [ 119.097247] [] ? system_call_fastpath+0x16/0x1b [ 119.097354] Code: 53 48 89 fb 48 83 ec 08 2b 2f 48 39 47 18 74 77 48 c7 c7 40 82 6a 82 e8 e5 cc a9 00 48 8b 43 20 48 8b 53 18 48 8b 3d 9e b1 50 01 <48> 89 42 08 48 89 10 48 b8 00 01 10 00 00 00 ad de 8b 33 48 89 [ 119.097957] RIP [] misc_deregister+0x3a/0xb0 [ 119.098056] RSP [ 119.098112] CR2: 0000000000000008 [ 119.122547] ---[ end trace 80b5458924c11acf ]---

— Reply to this email directly or view it on GitHub https://github.com/dtrace4linux/linux/issues/98.