Linux Device Driver - Oops -1

今天剛好遇到一個 vmalloc 產生的 Oops


虛擬記憶體:

我們先看一個虛擬記憶體的觀念.
為了讓實體記憶體能有效的被利用, 系統上應用程式存取的位置,
可以動態被配置到實體的位置, 而這虛擬/實體位置轉換.
通常透過 CPU 的 MMU ( 記憶體管理單元 ) 來輔助執行

但當地址出錯/分頁出錯/NULL 指針 這類 access 的問題產生時,
就會產生 Oops

e.g. Oops: 37 [#1] PREEMPT SMP ARM

一開始的數字 error code : 37
對照 fault.c 中的 enum 定義

/* * Page fault error code bits: *
     * bit 0 == 0: no page found 1: protection fault
     * bit 1 == 0: read access 1: write access
     * bit 2 == 0: kernel-mode access 1: user-mode access
     * bit 3 == 1: use of reserved bit detected
     * bit 4 == 1: fault was an instruction fetch
     * bit 5 == 1: protection keys block access */

( 不過今天遇到這挺奇怪的, 是 user-mode access? )

--
[#1] 代表 發生 crach 的次數

PREEMPT 代表系統支援搶占

SMP: Symmetric multi-processors

--
Tainted:


1: 'G' if all modules loaded have a GPL or compatible license, 'P' if any proprietary module has been loaded. Modules without a MODULE_LICENSE or with a MODULE_LICENSE that is not recognized by insmod as GPL compatible are assumed to be proprietary.

2: 'F' if any module was force loaded by "insmod -f", ' ' if all modules were loaded normally.

3: 'S' if the oops occurred on an SMP kernel running on hardware that hasn't been certified as safe to run multiprocessor. Currently this occurs only on various Athlons that are not SMP capable.

4: 'R' if a module was force unloaded by "rmmod -f", ' ' if all modules were unloaded normally.

5: 'M' if any processor has reported a Machine Check Exception, ' ' if no Machine Check Exceptions have occurred.

6: 'B' if a page-release function has found a bad page reference or some unexpected page flags.

7: 'U' if a user or user application specifically requested that the Tainted flag be set, ' ' otherwise.

8: 'D' if the kernel has died recently, i.e. there was an OOPS or BUG.

9: 'A' if the ACPI table has been overridden.

10: 'W' if a warning has previously been issued by the kernel. (Though some warnings may set more specific taint flags.)

11: 'C' if a staging driver has been loaded.

12: 'I' if the kernel is working around a severe bug in the platform firmware (BIOS or similar).

13: ' O'  : built an out of kernel module you insmodded into the kernel.

e.g.
CPU: 0 PID: 13590 Comm: kworker/0:1 Tainted: P        W  O    4.4.3-208 #1

P - 怪了, 不是 GPL..
W - 看來前面還有 taint
O - module 是 insmod 進來的

CPU : 0 - 發生錯誤的 CPU

PID: 13590 Comm: Kworker/0:1 - prcoess ID name



==

 "Unable to handle kernel paging request at virtual address " : 哪一類的錯誤


==

"Modules linked in  " : 後面有加載模塊名稱

==

" PC is at " : 後面會顯示出錯的地方  ( program counter )

==

unwind_backtrace: ...
後面會 show 出 function 的 call tree...


今天先記錄到這..
下一篇 : vmalloc 繼續





留言

熱門文章