[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: [rtl] kernel crashes with RT-Linux




On Fri, 9 Oct 1998 17:28:08 +0200 Jochen Kuepper wrote:

> for a few days now I do have some trouble running my RTL daq modules and the 
GUI
> frontend (called khidaq). All I get regarding the crash is the following 
output
> to the syslogd out-file. The system seems to be stable still after the oops,
> just my app doesn't work any more. I don't know wether it's the app itself, my
> RTL modules, the standard RTL modules or something else. 
> 
> So can someone explain what this trace down there means ?
> Where do I get information regarding these messages, how can I learn to
> understand them ?

Attached is a file from the Documentation sub-directory in the linux kernel tree 
by Linus Torvalds. It has the most detailed answer to your question I have found 
in over a year of rummaging through many dusty archives. I have not performed 
the procedure described so I can't offer any advice.

> Oct  9 15:50:32 hires kernel: Unable to handle kernel paging request at 
virtual address c481d758
> Oct  9 15:50:32 hires kernel: current->tss.cr3 = 025a0000,
> Oct  9 15:50:32 hires kernel: *pde = 00001067
> Oct  9 15:50:32 hires kernel: *pte = 00000000
> Oct  9 15:50:32 hires kernel: Oops: 0000
> Oct  9 15:50:32 hires kernel: CPU:    0
> Oct  9 15:50:32 hires kernel: EIP:    0010:[<0481d758>]
> Oct  9 15:50:32 hires kernel: EFLAGS: 00010202
> Oct  9 15:50:32 hires kernel: eax: 0481d758   ebx: 00000008   ecx: 00000001   
edx: 00000040
> Oct  9 15:50:32 hires kernel: esi: 025c2400   edi: 00000000   ebp: 00000000   
esp: 029a9f4c
> Oct  9 15:50:32 hires kernel: ds: 0018   es: 0018   fs: 002b   gs: 002b   ss: 
0018
> Oct  9 15:50:32 hires kernel: Process khidaq (pid: 485, process nr: 32, 
stackpage=029a9000)
> Oct  9 15:50:32 hires kernel: Stack: 048188c2 00000000 00000000 025c2434 
0388b9d4 025c2400 00000000 00000246
> Oct  9 15:50:32 hires kernel:        00000008 00000008 00000000 00125a27 
025c2400 0388b9d4 bffff3e8 00000000
> Oct  9 15:50:32 hires kernel:        02fae414 00000001 080518b0 bffff410 
00000000 00000206 00000018 02fa0018
> Oct  9 15:50:32 hires kernel: Call Trace: [<048188c2>] [sys_write+331/388] 
[s_sti+78/80] [system_call+85/124]
> Oct  9 15:50:32 hires kernel: Code: <1>Unable to handle kernel paging request 
at virtual address c481d758
> Oct  9 15:50:32 hires kernel: current->tss.cr3 = 025a0000,
> Oct  9 15:50:32 hires kernel: *pde = 00001067
> Oct  9 15:50:32 hires kernel: *pte = 00000000
> Oct  9 15:50:32 hires kernel: Oops: 0000
> Oct  9 15:50:32 hires kernel: CPU:    0
> Oct  9 15:50:32 hires kernel: EIP:    0010:[die_if_kernel+640/704]
> Oct  9 15:50:32 hires kernel: EFLAGS: 00010206
> Oct  9 15:50:32 hires kernel: eax: 00000010   ebx: 0000002b   ecx: 0481d758   
edx: 001a05d8
> Oct  9 15:50:32 hires kernel: esi: 00000000   edi: 029aa000   ebp: 029a9f10   
esp: 029a9eb4
> Oct  9 15:50:32 hires kernel: ds: 0018   es: 0018   fs: 0010   gs: 002b   ss: 
0018
> Oct  9 15:50:32 hires kernel: Process khidaq (pid: 485, process nr: 32, 
stackpage=029a9000)
> Oct  9 15:50:32 hires kernel: Stack: 0018002b 00000000 0001d000 029a9f10 
02fae414 04800000 05000000 04800000
> Oct  9 15:50:32 hires kernel:        02fa0018 001138ba 0018c6b7 029a9f10 
00000000 001135ec 025c2400 00000000
> Oct  9 15:50:32 hires kernel:        00000000 025d5490 02ff7c18 03030c0c 
0010a7f8 029a9f10 00000000 00000008
> Oct  9 15:50:32 hires kernel: Call Trace: [vt_ioctl+4671/6980] [<04800000>] 
[<05000000>] [<04800000>] [do_page_fault+718/736] [do_page_fault+0/736] 
[error_code+64/72]
> Oct  9 15:50:32 hires kernel:        [<0481d758>] [<0481d758>] [<048188c2>] 
[sys_write+331/388] [s_sti+78/80] [system_call+85/124]
> Oct  9 15:50:32 hires kernel: Code: 64 8a 04 0e 0f a1 88 c2 81 e2 ff 00 00 00 
89 54 24 10 52 68
> 


David Ross

davidr@toadtech.com
Toad Technologies

"I'll be good! I will, I will !"
From: Linus Torvalds <torvalds@cs.helsinki.fi>

How to track down an Oops.. [originally a mail to linux-kernel]

The main trick is having 5 years of experience with those pesky oops 
messages ;-)

Actually, there are things you can do that make this easier. I have two 
separate approaches:

	gdb /usr/src/linux/vmlinux
	gdb> disassemble <offending_function>

That's the easy way to find the problem, at least if the bug-report is 
well made (like this one was - run through ksymoops to get the 
information of which function and the offset in the function that it 
happened in).

Oh, it helps if the report happens on a kernel that is compiled with the 
same compiler and similar setups.

The other thing to do is disassemble the "Code:" part of the bug report: 
ksymoops will do this too with the correct tools (and new version of 
ksymoops), but if you don't have the tools you can just do a silly 
program:

	char str[] = "\xXX\xXX\xXX...";
	main(){}

and compile it with gcc -g and then do "disassemble str" (where the "XX" 
stuff are the values reported by the Oops - you can just cut-and-paste 
and do a replace of spaces to "\x" - that's what I do, as I'm too lazy 
to write a program to automate this all).

Finally, if you want to see where the code comes from, you can do

	cd /usr/src/linux
	make fs/buffer.s 	# or whatever file the bug happened in

and then you get a better idea of what happens than with the gdb 
disassembly.

Now, the trick is just then to combine all the data you have: the C 
sources (and general knowledge of what it _should_ do, the assembly 
listing and the code disassembly (and additionally the register dump you 
also get from the "oops" message - that can be useful to see _what_ the 
corrupted pointers were, and when you have the assembler listing you can 
also match the other registers to whatever C expressions they were used 
for).

Essentially, you just look at what doesn't match (in this case it was the 
"Code" disassembly that didn't match with what the compiler generated). 
Then you need to find out _why_ they don't match. Often it's simple - you 
see that the code uses a NULL pointer and then you look at the code and 
wonder how the NULL pointer got there, and if it's a valid thing to do 
you just check against it..

Now, if somebody gets the idea that this is time-consuming and requires 
some small amount of concentration, you're right. Which is why I will 
mostly just ignore any panic reports that don't have the symbol table 
info etc looked up: it simply gets too hard to look it up (I have some 
programs to search for specific patterns in the kernel code segment, and 
sometimes I have been able to look up those kinds of panics too, but 
that really requires pretty good knowledge of the kernel just to be able 
to pick out the right sequences etc..)

_Sometimes_ it happens that I just see the disassembled code sequence 
from the panic, and I know immediately where it's coming from. That's when 
I get worried that I've been doing this for too long ;-)

		Linus


---------------------------------------------------------------------------
Notes on Oops tracing with klogd:

In order to help Linus and the other kernel developers there has been
substantial support incorporated into klogd for processing protection
faults.  In order to have full support for address resolution at least
version 1.3-pl3 of the sysklogd package should be used.

When a protection fault occurs the klogd daemon automatically
translates important addresses in the kernel log messages to their
symbolic equivalents.  This translated kernel message is then
forwarded through whatever reporting mechanism klogd is using.  The
protection fault message can be simply cut out of the message files
and forwarded to the kernel developers.

Two types of address resolution are performed by klogd.  The first is
static translation and the second is dynamic translation.  Static
translation uses the System.map file in much the same manner that
ksymoops does.  In order to do static translation the klogd daemon
must be able to find a system map file at daemon initialization time.
See the klogd man page for information on how klogd searches for map
files.

Dynamic address translation is important when kernel loadable modules
are being used.  Since memory for kernel modules is allocated from the
kernel's dynamic memory pools there are no fixed locations for either
the start of the module or for functions and symbols in the module.

The kernel supports system calls which allow a program to determine
which modules are loaded and their location in memory.  Using these
system calls the klogd daemon builds a symbol table which can be used
to debug a protection fault which occurs in a loadable kernel module.

At the very minimum klogd will provide the name of the module which
generated the protection fault.  There may be additional symbolic
information available if the developer of the loadable module chose to
export symbol information from the module.

Since the kernel module environment can be dynamic there must be a
mechanism for notifying the klogd daemon when a change in module
environment occurs.  There are command line options available which
allow klogd to signal the currently executing daemon that symbol
information should be refreshed.  See the klogd manual page for more
information.

A patch is included with the sysklogd distribution which modifies the
modules-2.0.0 package to automatically signal klogd whenever a module
is loaded or unloaded.  Applying this patch provides essentially
seamless support for debugging protection faults which occur with
kernel loadable modules.

The following is an example of a protection fault in a loadable module
processed by klogd:
---------------------------------------------------------------------------
Aug 29 09:51:01 blizard kernel: Unable to handle kernel paging request at virtual address f15e97cc
Aug 29 09:51:01 blizard kernel: current->tss.cr3 = 0062d000, %cr3 = 0062d000
Aug 29 09:51:01 blizard kernel: *pde = 00000000
Aug 29 09:51:01 blizard kernel: Oops: 0002
Aug 29 09:51:01 blizard kernel: CPU:    0
Aug 29 09:51:01 blizard kernel: EIP:    0010:[oops:_oops+16/3868]
Aug 29 09:51:01 blizard kernel: EFLAGS: 00010212
Aug 29 09:51:01 blizard kernel: eax: 315e97cc   ebx: 003a6f80   ecx: 001be77b   edx: 00237c0c
Aug 29 09:51:01 blizard kernel: esi: 00000000   edi: bffffdb3   ebp: 00589f90   esp: 00589f8c
Aug 29 09:51:01 blizard kernel: ds: 0018   es: 0018   fs: 002b   gs: 002b   ss: 0018
Aug 29 09:51:01 blizard kernel: Process oops_test (pid: 3374, process nr: 21, stackpage=00589000)
Aug 29 09:51:01 blizard kernel: Stack: 315e97cc 00589f98 0100b0b4 bffffed4 0012e38e 00240c64 003a6f80 00000001 
Aug 29 09:51:01 blizard kernel:        00000000 00237810 bfffff00 0010a7fa 00000003 00000001 00000000 bfffff00 
Aug 29 09:51:01 blizard kernel:        bffffdb3 bffffed4 ffffffda 0000002b 0007002b 0000002b 0000002b 00000036 
Aug 29 09:51:01 blizard kernel: Call Trace: [oops:_oops_ioctl+48/80] [_sys_ioctl+254/272] [_system_call+82/128] 
Aug 29 09:51:01 blizard kernel: Code: c7 00 05 00 00 00 eb 08 90 90 90 90 90 90 90 90 89 ec 5d c3 
---------------------------------------------------------------------------

Dr. G.W. Wettstein           Oncology Research Div. Computing Facility
Roger Maris Cancer Center    INTERNET: greg@wind.rmcc.com
820 4th St. N.
Fargo, ND  58122
Phone: 701-234-7556