]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | NOTE: ksymoops is useless on 2.6. Please use the Oops in its original format |
2 | (from dmesg, etc). Ignore any references in this or other docs to "decoding | |
62a07e6e | 3 | the Oops" or "running it through ksymoops". If you post an Oops from 2.6 that |
1da177e4 LT |
4 | has been run through ksymoops, people will just tell you to repost it. |
5 | ||
6 | Quick Summary | |
7 | ------------- | |
8 | ||
9 | Find the Oops and send it to the maintainer of the kernel area that seems to be | |
10 | involved with the problem. Don't worry too much about getting the wrong person. | |
11 | If you are unsure send it to the person responsible for the code relevant to | |
12 | what you were doing. If it occurs repeatably try and describe how to recreate | |
13 | it. That's worth even more than the oops. | |
14 | ||
15 | If you are totally stumped as to whom to send the report, send it to | |
16 | [email protected]. Thanks for your help in making Linux as | |
17 | stable as humanly possible. | |
18 | ||
19 | Where is the Oops? | |
20 | ---------------------- | |
21 | ||
22 | Normally the Oops text is read from the kernel buffers by klogd and | |
23 | handed to syslogd which writes it to a syslog file, typically | |
24 | /var/log/messages (depends on /etc/syslog.conf). Sometimes klogd dies, | |
25 | in which case you can run dmesg > file to read the data from the kernel | |
26 | buffers and save it. Or you can cat /proc/kmsg > file, however you | |
27 | have to break in to stop the transfer, kmsg is a "never ending file". | |
28 | If the machine has crashed so badly that you cannot enter commands or | |
29 | the disk is not available then you have three options :- | |
30 | ||
31 | (1) Hand copy the text from the screen and type it in after the machine | |
32 | has restarted. Messy but it is the only option if you have not | |
36174494 DC |
33 | planned for a crash. Alternatively, you can take a picture of |
34 | the screen with a digital camera - not nice, but better than | |
e1f1def6 DJ |
35 | nothing. If the messages scroll off the top of the console, you |
36 | may find that booting with a higher resolution (eg, vga=791) | |
37 | will allow you to read more of the text. (Caveat: This needs vesafb, | |
38 | so won't help for 'early' oopses) | |
1da177e4 LT |
39 | |
40 | (2) Boot with a serial console (see Documentation/serial-console.txt), | |
41 | run a null modem to a second machine and capture the output there | |
42 | using your favourite communication program. Minicom works well. | |
43 | ||
75ba0861 AM |
44 | (3) Use Kdump (see Documentation/kdump/kdump.txt), |
45 | extract the kernel ring buffer from old memory with using dmesg | |
46 | gdbmacro in Documentation/kdump/gdbmacros.txt. | |
1da177e4 LT |
47 | |
48 | ||
49 | Full Information | |
50 | ---------------- | |
51 | ||
52 | NOTE: the message from Linus below applies to 2.4 kernel. I have preserved it | |
53 | for historical reasons, and because some of the information in it still | |
54 | applies. Especially, please ignore any references to ksymoops. | |
55 | ||
56 | From: Linus Torvalds <[email protected]> | |
57 | ||
58 | How to track down an Oops.. [originally a mail to linux-kernel] | |
59 | ||
60 | The main trick is having 5 years of experience with those pesky oops | |
61 | messages ;-) | |
62 | ||
63 | Actually, there are things you can do that make this easier. I have two | |
64 | separate approaches: | |
65 | ||
66 | gdb /usr/src/linux/vmlinux | |
67 | gdb> disassemble <offending_function> | |
68 | ||
69 | That's the easy way to find the problem, at least if the bug-report is | |
70 | well made (like this one was - run through ksymoops to get the | |
71 | information of which function and the offset in the function that it | |
72 | happened in). | |
73 | ||
74 | Oh, it helps if the report happens on a kernel that is compiled with the | |
75 | same compiler and similar setups. | |
76 | ||
77 | The other thing to do is disassemble the "Code:" part of the bug report: | |
78 | ksymoops will do this too with the correct tools, but if you don't have | |
79 | the tools you can just do a silly program: | |
80 | ||
81 | char str[] = "\xXX\xXX\xXX..."; | |
82 | main(){} | |
83 | ||
84 | and compile it with gcc -g and then do "disassemble str" (where the "XX" | |
85 | stuff are the values reported by the Oops - you can just cut-and-paste | |
86 | and do a replace of spaces to "\x" - that's what I do, as I'm too lazy | |
87 | to write a program to automate this all). | |
88 | ||
89 | Finally, if you want to see where the code comes from, you can do | |
90 | ||
91 | cd /usr/src/linux | |
92 | make fs/buffer.s # or whatever file the bug happened in | |
93 | ||
94 | and then you get a better idea of what happens than with the gdb | |
95 | disassembly. | |
96 | ||
97 | Now, the trick is just then to combine all the data you have: the C | |
98 | sources (and general knowledge of what it _should_ do), the assembly | |
99 | listing and the code disassembly (and additionally the register dump you | |
100 | also get from the "oops" message - that can be useful to see _what_ the | |
101 | corrupted pointers were, and when you have the assembler listing you can | |
102 | also match the other registers to whatever C expressions they were used | |
103 | for). | |
104 | ||
105 | Essentially, you just look at what doesn't match (in this case it was the | |
106 | "Code" disassembly that didn't match with what the compiler generated). | |
107 | Then you need to find out _why_ they don't match. Often it's simple - you | |
108 | see that the code uses a NULL pointer and then you look at the code and | |
109 | wonder how the NULL pointer got there, and if it's a valid thing to do | |
110 | you just check against it.. | |
111 | ||
112 | Now, if somebody gets the idea that this is time-consuming and requires | |
113 | some small amount of concentration, you're right. Which is why I will | |
114 | mostly just ignore any panic reports that don't have the symbol table | |
115 | info etc looked up: it simply gets too hard to look it up (I have some | |
116 | programs to search for specific patterns in the kernel code segment, and | |
117 | sometimes I have been able to look up those kinds of panics too, but | |
118 | that really requires pretty good knowledge of the kernel just to be able | |
119 | to pick out the right sequences etc..) | |
120 | ||
121 | _Sometimes_ it happens that I just see the disassembled code sequence | |
122 | from the panic, and I know immediately where it's coming from. That's when | |
123 | I get worried that I've been doing this for too long ;-) | |
124 | ||
125 | Linus | |
126 | ||
127 | ||
128 | --------------------------------------------------------------------------- | |
129 | Notes on Oops tracing with klogd: | |
130 | ||
131 | In order to help Linus and the other kernel developers there has been | |
132 | substantial support incorporated into klogd for processing protection | |
133 | faults. In order to have full support for address resolution at least | |
134 | version 1.3-pl3 of the sysklogd package should be used. | |
135 | ||
136 | When a protection fault occurs the klogd daemon automatically | |
137 | translates important addresses in the kernel log messages to their | |
138 | symbolic equivalents. This translated kernel message is then | |
139 | forwarded through whatever reporting mechanism klogd is using. The | |
140 | protection fault message can be simply cut out of the message files | |
141 | and forwarded to the kernel developers. | |
142 | ||
143 | Two types of address resolution are performed by klogd. The first is | |
144 | static translation and the second is dynamic translation. Static | |
145 | translation uses the System.map file in much the same manner that | |
146 | ksymoops does. In order to do static translation the klogd daemon | |
147 | must be able to find a system map file at daemon initialization time. | |
148 | See the klogd man page for information on how klogd searches for map | |
149 | files. | |
150 | ||
151 | Dynamic address translation is important when kernel loadable modules | |
152 | are being used. Since memory for kernel modules is allocated from the | |
153 | kernel's dynamic memory pools there are no fixed locations for either | |
154 | the start of the module or for functions and symbols in the module. | |
155 | ||
156 | The kernel supports system calls which allow a program to determine | |
157 | which modules are loaded and their location in memory. Using these | |
158 | system calls the klogd daemon builds a symbol table which can be used | |
159 | to debug a protection fault which occurs in a loadable kernel module. | |
160 | ||
161 | At the very minimum klogd will provide the name of the module which | |
162 | generated the protection fault. There may be additional symbolic | |
163 | information available if the developer of the loadable module chose to | |
164 | export symbol information from the module. | |
165 | ||
166 | Since the kernel module environment can be dynamic there must be a | |
167 | mechanism for notifying the klogd daemon when a change in module | |
168 | environment occurs. There are command line options available which | |
169 | allow klogd to signal the currently executing daemon that symbol | |
170 | information should be refreshed. See the klogd manual page for more | |
171 | information. | |
172 | ||
173 | A patch is included with the sysklogd distribution which modifies the | |
174 | modules-2.0.0 package to automatically signal klogd whenever a module | |
175 | is loaded or unloaded. Applying this patch provides essentially | |
176 | seamless support for debugging protection faults which occur with | |
177 | kernel loadable modules. | |
178 | ||
179 | The following is an example of a protection fault in a loadable module | |
180 | processed by klogd: | |
181 | --------------------------------------------------------------------------- | |
182 | Aug 29 09:51:01 blizard kernel: Unable to handle kernel paging request at virtual address f15e97cc | |
183 | Aug 29 09:51:01 blizard kernel: current->tss.cr3 = 0062d000, %cr3 = 0062d000 | |
184 | Aug 29 09:51:01 blizard kernel: *pde = 00000000 | |
185 | Aug 29 09:51:01 blizard kernel: Oops: 0002 | |
186 | Aug 29 09:51:01 blizard kernel: CPU: 0 | |
187 | Aug 29 09:51:01 blizard kernel: EIP: 0010:[oops:_oops+16/3868] | |
188 | Aug 29 09:51:01 blizard kernel: EFLAGS: 00010212 | |
189 | Aug 29 09:51:01 blizard kernel: eax: 315e97cc ebx: 003a6f80 ecx: 001be77b edx: 00237c0c | |
190 | Aug 29 09:51:01 blizard kernel: esi: 00000000 edi: bffffdb3 ebp: 00589f90 esp: 00589f8c | |
191 | Aug 29 09:51:01 blizard kernel: ds: 0018 es: 0018 fs: 002b gs: 002b ss: 0018 | |
192 | Aug 29 09:51:01 blizard kernel: Process oops_test (pid: 3374, process nr: 21, stackpage=00589000) | |
193 | Aug 29 09:51:01 blizard kernel: Stack: 315e97cc 00589f98 0100b0b4 bffffed4 0012e38e 00240c64 003a6f80 00000001 | |
194 | Aug 29 09:51:01 blizard kernel: 00000000 00237810 bfffff00 0010a7fa 00000003 00000001 00000000 bfffff00 | |
195 | Aug 29 09:51:01 blizard kernel: bffffdb3 bffffed4 ffffffda 0000002b 0007002b 0000002b 0000002b 00000036 | |
196 | Aug 29 09:51:01 blizard kernel: Call Trace: [oops:_oops_ioctl+48/80] [_sys_ioctl+254/272] [_system_call+82/128] | |
197 | 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 | |
198 | --------------------------------------------------------------------------- | |
199 | ||
200 | Dr. G.W. Wettstein Oncology Research Div. Computing Facility | |
201 | Roger Maris Cancer Center INTERNET: [email protected] | |
202 | 820 4th St. N. | |
203 | Fargo, ND 58122 | |
204 | Phone: 701-234-7556 | |
205 | ||
206 | ||
207 | --------------------------------------------------------------------------- | |
208 | Tainted kernels: | |
209 | ||
210 | Some oops reports contain the string 'Tainted: ' after the program | |
1cc5753f RD |
211 | counter. This indicates that the kernel has been tainted by some |
212 | mechanism. The string is followed by a series of position-sensitive | |
1da177e4 LT |
213 | characters, each representing a particular tainted value. |
214 | ||
215 | 1: 'G' if all modules loaded have a GPL or compatible license, 'P' if | |
216 | any proprietary module has been loaded. Modules without a | |
217 | MODULE_LICENSE or with a MODULE_LICENSE that is not recognised by | |
218 | insmod as GPL compatible are assumed to be proprietary. | |
219 | ||
1cc5753f | 220 | 2: 'F' if any module was force loaded by "insmod -f", ' ' if all |
1da177e4 LT |
221 | modules were loaded normally. |
222 | ||
223 | 3: 'S' if the oops occurred on an SMP kernel running on hardware that | |
1cc5753f RD |
224 | hasn't been certified as safe to run multiprocessor. |
225 | Currently this occurs only on various Athlons that are not | |
226 | SMP capable. | |
227 | ||
228 | 4: 'R' if a module was force unloaded by "rmmod -f", ' ' if all | |
229 | modules were unloaded normally. | |
230 | ||
231 | 5: 'M' if any processor has reported a Machine Check Exception, | |
232 | ' ' if no Machine Check Exceptions have occurred. | |
233 | ||
234 | 6: 'B' if a page-release function has found a bad page reference or | |
235 | some unexpected page flags. | |
1da177e4 LT |
236 | |
237 | The primary reason for the 'Tainted: ' string is to tell kernel | |
238 | debuggers if this is a clean kernel or if anything unusual has | |
1cc5753f RD |
239 | occurred. Tainting is permanent: even if an offending module is |
240 | unloaded, the tainted value remains to indicate that the kernel is not | |
1da177e4 | 241 | trustworthy. |