2014-01-30 2 views
0

커널 모듈 스택을 덤프하려면 어떻게합니까?커널 모듈 스택 덤프

BUG()을 사용하고 싶지는 않으므로이 프로세스가 중단 될 수 있습니다. 스택을 버리고 싶습니다.

또한 백 트레이스를 요구하는 것이 아니라 실제 스택을 요구합니다.

예 :

[14027.797527] ------------[ cut here ]------------ 
[14027.797532] Kernel BUG at ffffffffa020e05e [verbose debug info unavailable] 
[14027.797538] invalid opcode: 0000 [#3] SMP 
[14027.797544] Modules linked in: monks(OF) snd_hrtimer(F) vboxsf(OF) vboxvideo(OF) drm bnep rfcomm bluetooth joydev(F) snd_intel8x0 snd_ac97_codec ac97_bus snd_pcm(F) snd_page_alloc(F) snd_seq_midi(F) snd_seq_midi_event(F) snd_rawmidi(F) snd_seq(F) snd_seq_device(F) snd_timer(F) ppdev(F) parport_pc(F) snd(F) psmouse(F) lp(F) i2c_piix4 mac_hid vboxguest(OF) parport(F) microcode(F) serio_raw(F) soundcore(F) vesafb(F) hid_generic usbhid hid ahci(F) libahci(F) e1000(F) [last unloaded: monks] 
[14027.797569] CPU 0 
[14027.797576] Pid: 15169, comm: a.out Tainted: GF  D O 3.8.0-29-generiC#42-Ubuntu innotek GmbH VirtualBox/VirtualBox 
[14027.797582] RIP: 0010:[<ffffffffa020e05e>] [<ffffffffa020e05e>] hooked_sys32_pre_close+0x3e/0x40 [monks] 
[14027.797594] RSP: 0000:ffff880038787f3c EFLAGS: 00010286 
[14027.797599] RAX: 0000000000000025 RBX: ffff88003b843c80 RCX: 00000000000057db 
[14027.797604] RDX: 00000000000057db RSI: 0000000000000082 RDI: 0000000000000246 
[14027.797609] RBP: ffff880038787f44 R08: 000000000000000a R09: 0000000000000000 
[14027.797614] R10: 00000000000003e6 R11: 0000000000000006 R12: 0000000000000000 
[14027.797619] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 
[14027.797625] FS: 0000000000000000(0000) GS:ffff88003fc00000(0000) knlGS:0000000000000000 
[14027.797630] CS: 0010 DS: 002b ES: 002b CR0: 000000008005003b 
[14027.797635] CR2: 00000000f778dba0 CR3: 000000003cad9000 CR4: 00000000000006f0 
[14027.797644] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 
[14027.797650] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 
[14027.797655] Process a.out (pid: 15169, threadinfo ffff880038786000, task ffff88003a0eae80) 
[14027.797660] Stack: 
[14027.797665] 0000000000000003 ffff880038787f78 ffffc900003db054 ffffffff816d7149 
[14027.797671] 0000000000000000 0000000000000000 0000000000000000 3b843c8000000000 
[14027.797677] 816d7149ffff8800 00000000ffffffff 0000000000000000 0000000000000000 
[14027.797684] Call Trace: 
[14027.797698] [<ffffffff816d7149>] ? ia32_do_call+0x13/0x13 
[14027.797703] Code: 00 48 c7 c7 d9 10 21 a0 48 89 c6 48 89 c3 31 c0 e8 63 25 4b e1 48 89 5d 34 48 8b 75 34 48 c7 c7 f5 10 21 a0 31 c0 e8 4d 25 4b e1 <0f> 0b 66 66 66 66 90 55 48 89 e5 53 48 8b 55 40 48 8b 5d 48 48 
[14027.797731] RIP [<ffffffffa020e05e>] hooked_sys32_pre_close+0x3e/0x40 [monks] 
[14027.797739] RSP <ffff880038787f3c> 
[14027.797746] ---[ end trace 6c79e7a670d4c886 ]--- 

의 I는없이 를 덤프 할 정보 프로세스를 죽이는 라인 [14027.797677]

감사에 선 [14027.797660]에서입니다!

편집 :

dump_stack() 출력 :

[17467.729035] Pid: 16281, comm: a.out Tainted: GF  D O 3.8.0-29-generiC#42-Ubuntu 
[17467.729042] Call Trace: 
[17467.729070] [<ffffffffa020e144>] hooked_sys32_pre_close+0x14/0x90 [monks] 
[17467.729084] [<ffffffff816d7149>] ? ia32_do_call+0x13/0x13 

이것은 내가 무엇을 찾고 나를 점점되지 않습니다. 내가 뭔가 잘못하고 있는거야?

답변

2

스택을 덤프하는 방법을 알아 내려고 노력의 좌절보다 더 나쁜 유일한 것은, 당신이 실제로dump_stack()라고 의 발견 순간 - 가정 당신을 웃게하는 주위 동료가 ...

글쎄, 내 뇌에 화상을 입은 것도 내가 생각한만큼 유용하지 않거나 아치 코드가 다소 다른 것들 중 하나이다. 나는 x86에 익숙하지 않지만, the function that appears to print that stack data에서 잠깐 찌르는 것은 show_stack(NULL, NULL)을 제안한다.

+0

멋진 시도 :)하지만 아니,'''dump_stack()'''내가 원하는 것을 반환하지 않습니다. 편집을 참조하십시오. – alexandernst