1

我正在尝试调试内核模块。我已经用 -g 编译了它,并且我正在使用 netconsole 进行日志记录。

在输出中我看到:

[ 575.335966] RIP: 0010:switch_rtai_tasks+0x329/0x428 [rtai_sched]

我理解的意思是问题

[575.335942] general protection fault: 0000 [#1] PREEMPT SMP PTI

发生在函数 switch_rtai_tasks 函数启动后的 0x329 字节处。Objdump 给了我:

329: 48 0f ae 0a fxrstor64 (%rdx)

(到目前为止,在三起崩溃中,它始终指向 fxstor64,但随着添加更多调试和重新编译,我无法确定它是否相同)但是,我在该函数中有调试 printk 语句,这些语句没有被输出。所以我不完全相信问题出在那个函数上。

addr2line 不同意,这让我更加缺乏信心:

addr2line -f -e rtai_sched.ko switch_rtai_tasks+0x329
rt_find_task_by_pid
??:?

这将问题放在“rt_find_task_by_pid”中,它(还)不包含任何调试 printk。

那么,我应该相信谁?(switch_rtai_tasks+0x329/0x428 中 / 之后的第二个偏移量是多少?

为了完整起见,更多的转储:

[28961.004764] finit_module: fd=3, uargs=00000000f223f6b7, flags=0
[28961.004866] Core section allocation order:
[28961.004871]  .text
[28961.004875]  .note.gnu.build-id
[28961.004878]  .note.Linux
[28961.004881]  .rodata
[28961.004885]  .rodata.str1.1
[28961.004888]  .rodata.str1.8
[28961.004891]  __param
[28961.004894]  .data
[28961.004897]  .gnu.linkonce.this_module
[28961.004900]  .bss
[28961.004903] Init section allocation order:
[28961.004908]  .symtab
[28961.004911]  .strtab
[28961.004922] final section addresses:
[28961.004926]  0xffffffffc065f000 .note.gnu.build-id
[28961.004929]  0xffffffffc065f024 .note.Linux
[28961.004932]  0xffffffffc065e000 .text
[28961.004935]  0xffffffffc065f040 .rodata
[28961.004939]  0xffffffffc065f082 .rodata.str1.1
[28961.004941]  0xffffffffc065f0b0 .rodata.str1.8
[28961.004944]  0xffffffffc065f128 __param
[28961.004947]  0xffffffffc0660000 .data
[28961.004950]  0xffffffffc0660040 .gnu.linkonce.this_module
[28961.004953]  0xffffffffc0660380 .bss
[28961.004966]  0xffffffffc010e000 .symtab
[28961.004970]  0xffffffffc010e870 .strtab
[28961.004991] Absolute symbol: 0x00000000
[28961.004994] Absolute symbol: 0x00000000
[28961.005002] threads does not use hal_lib!
[28961.005012] Allocating new usage for threads.
[28961.005018] threads uses hal_lib!
[28961.005023] threads uses hal_lib!
[28961.005029] threads does not use rtapi!
[28961.005033] Allocating new usage for threads.
[28961.005037] threads uses hal_lib!
[28961.007426] general protection fault: 0000 [#1] PREEMPT SMP PTI
[28961.007433] CPU: 1 PID: 0 Comm: swapper/1 Tainted: P        W  O      4.19.114-vulcano-amd64 #1
[28961.007436] Hardware name: RM plc RM ONE ECOQUIET 320/DQ77CP, BIOS MKQ7710H.86A.0072.2017.0519.1347 05/19/2017
[28961.007439] I-pipe domain: Linux
[28961.007446] RIP: 0010:switch_rtai_tasks+0x329/0x428 [rtai_sched]
[28961.007450] Code: e0 e7 73 c0 48 39 d9 74 25 4c 8d 81 00 01 00 00 31 c0 89 c2 4c 89 c7 48 0f ae 07 48 89 1c f5 e0 e7 73 c0 48 8d 93 00 01 00 00 <48> 0f ae 0a 0f 31 48 c1 e2 20 89 c0 48 89 2c f5 00 81 73 c0 48 8d
[28961.007455] RSP: 0000:ffff949f37f83ea8 EFLAGS: 00010046
[28961.007458] RAX: 0000000000000000 RBX: ffff949f37f83e20 RCX: ffff949f94b5c000
[28961.007461] RDX: ffff949f37f83f20 RSI: 0000000000000001 RDI: ffff949f94b5c100
[28961.007464] RBP: ffff949f94b5c000 R08: ffff949f94b5c100 R09: ffff949f37f83d60
[28961.007467] R10: 000000000000000f R11: 0000000000000000 R12: 0000000000000001
[28961.007470] R13: ffffffffc0739280 R14: 0000000000000001 R15: ffffffffc073a640
[28961.007473] FS:  0000000000000000(0000) GS:ffff949f9a300000(0000) knlGS:0000000000000000
[28961.007476] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[28961.007480] CR2: 0000000000000000 CR3: 000000004f20a001 CR4: 00000000001606e0
[28961.007483] Call Trace:
[28961.007486] Modules linked in: threads(O) hal_lib(O) rtapi(O) rtai_math(O) rtai_sched(O) rtai_hal(O) fuse cfg80211 rfkill netconsole appletalk psnap llc ax25 configfs x86_pkg_temp_thermal coretemp hid_generic crct10dif_pclmul crc32_pclmul usbhid hid snd_hda_codec_realtek ghash_clmulni_intel snd_hda_codec_generic cryptd pcspkr sg snd_hda_intel snd_hda_codec snd_hda_core snd_hwdep snd_pcm snd_timer snd soundcore mei_me mei ie31200_edac evdev parport_pc ppdev lp parport ip_tables x_tables autofs4 ext4 crc32c_generic crc16 mbcache jbd2 fscrypto sd_mod sr_mod cdrom ahci libahci i915 crc32c_intel i2c_i801 libata scsi_mod lpc_ich mfd_core ehci_pci ehci_hcd e1000e xhci_pci xhci_hcd usbcore i2c_algo_bit drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops drm drm_panel_orientation_quirks fan video
[28961.007515]  [last unloaded: rtai_hal]
[28961.007528] Kernel panic - not syncing: Fatal exception
[28961.007537] Kernel Offset: 0x2e000000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff)
[28961.007542] Rebooting in 20 seconds..
[28980.849837] ACPI MEMORY or I/O RESET_REG.
4

0 回答 0