1.输出日志
1 [2022-08-01 09:20:13] [ 126.604045][ T2548] Unable to handle kernel access to user memory outside uaccess routines at virtual address 0000000000000110
2 [2022-08-01 09:20:13] [ 126.616876][ T2548] Mem abort info:
3 [2022-08-01 09:20:13] [ 126.620775][ T2548] ESR = 0x96000045
4 [2022-08-01 09:20:13] [ 126.624979][ T2548] EC = 0x25: DABT (current EL), IL = 32 bits
5 [2022-08-01 09:20:13] [ 126.631692][ T2548] SET = 0, FnV = 0
6 [2022-08-01 09:20:13] [ 126.636051][ T2548] EA = 0, S1PTW = 0
7 [2022-08-01 09:20:13] [ 126.640350][ T2548] Data abort info:
8 [2022-08-01 09:20:13] [ 126.644382][ T2548] ISV = 0, ISS = 0x00000045
9 [2022-08-01 09:20:13] [ 126.649449][ T2548] CM = 0, WnR = 1
10 [2022-08-01 09:20:13] [ 126.653695][ T2548] user pgtable: 4k pages, 39-bit VAs, pgdp=00000000c3473000
11 [2022-08-01 09:20:13] [ 126.661685][ T2548] [0000000000000110] pgd=0000000000000000, pud=0000000000000000
12 [2022-08-01 09:20:13] [ 126.670085][ T2548] Internal error: Oops: 96000045 [
13 [2022-08-01 09:20:13] [ 126.677084][ T2548] Modules linked in: aic8800_fdrv snd_aloop hall_sensor gslX680new aic8800_btlpm aic8800_bsp virtual spi_sunxi
sunxi_ve sunxi_sysinfo sunxi_keyboard sr9800 sr9700 ax88179_178a asix smsc95xx smsc75xx ppp_synctty ppp_async option usb_wwan usbserial sunxi_usbc sunxi_us
b_udc ohci_sunxi ohci_hcd ehci_sunxi sunxi_hci lan78xx kaweth gpu_domain gl620a g2d_sunxi dump_reg_misc dump_reg dm9601 arc4 snd_soc_sunxi_simple_card snd_
soc_simple_card_utils snd_soc_sunxi_spdif snd_soc_sunxi_dmic snd_soc_dmic snd_soc_sunxi_daudio sun50iw10_sndcodec sun50iw10_codec snd_soc_sunxi_component_j
ack snd_soc_sunxi_dummy_cpudai snd_soc_sunxi mir3da sc7a20 init_input pvrsrvkm(O) vin_v4l2 dw9714_act actuator gc030a_mipi gc02m2_mipi gc5035_mipi vin_io s
unxi_rfkill sunxi_drm_heap optee tee zram zsmalloc nand sunxi_uart sunxi_thermal sunxi_nsi sunxi_addr sunxi_mmc_host disp fb sunxi_iommu sun6i_dma virt_dma
sun50i_cpufreq_nvmem sunxi_sid sunxi_smc rtc_sunxi pwm_sunxi_group pinctrl_sun50iw10p1_r
14 [2022-08-01 09:20:13] [ 126.677191][ T2548] pinctrl_sun50iw10p1 pinctrl_sunxi nvmem_sunxi_sid irq_sunxi_wakeupgen irq_sun8i_nmi i2c_sunxi i2c_dev cpufre
q_dt ccu_sun50iw10_ddr ccu_sun50iw10_r ccu_sun50iw10 ccu_sunxi_ng axp2202_usb_power axp2202_battery axp2101_regulator axp2101_pek axp2101_i2c axp2101 rtc_s
unxi_ccu
15 [2022-08-01 09:20:13] [ 126.803325][ T2548] CPU: 0 PID: 2548 Comm: sh Tainted: G O 5.4.161-00160-g69cc09208884
16 [2022-08-01 09:20:13] [ 126.813911][ T2548] Hardware name: sun50iw10 (DT)
17 [2022-08-01 09:20:13] [ 126.819160][ T2548] pstate: 60400005 (nZCv daif +PAN -UAO)
18 [2022-08-01 09:20:13] [ 126.825308][ T2548] pc : dpm_run_callback+0x1bc/0x418
19 [2022-08-01 09:20:13] [ 126.830963][ T2548] lr : dpm_run_callback+0x1b8/0x418
20 [2022-08-01 09:20:13] [ 126.836619][ T2548] sp : ffffffc016abba00
21 [2022-08-01 09:20:13] [ 126.841105][ T2548] x29: ffffffc016abba00 x28: ffffffc011cdf000
22 [2022-08-01 09:20:13] [ 126.847833][ T2548] x27: ffffffc011bb8000 x26: ffffff80bb0cc148
23 [2022-08-01 09:20:13] [ 126.854562][ T2548] x25: ffffffc011bb8208 x24: 0000000000000110
24 [2022-08-01 09:20:13] [ 126.861287][ T2548] x23: 0000000000000000 x22: 0000000000000002
25 [2022-08-01 09:20:13] [ 126.868014][ T2548] x21: ffffffc01166b85b x20: ffffff80519a7078
26 [2022-08-01 09:20:13] [ 126.874743][ T2548] x19: ffffffc010f8425c x18: ffffffc015917088
27 [2022-08-01 09:20:13] [ 126.881469][ T2548] x17: ffffffc011c6bfd4 x16: 00000000000061d0
28 [2022-08-01 09:20:13] [ 126.888198][ T2548] x15: 0000000000000004 x14: 000000000000003c
29 [2022-08-01 09:20:13] [ 126.894925][ T2548] x13: 0000000000019e6c x12: 0000000000000000
30 [2022-08-01 09:20:13] [ 126.901650][ T2548] x11: 0000000000000000 x10: 00000000ffffffff
31 [2022-08-01 09:20:13] [ 126.908378][ T2548] x9 : 49b5268679ba0000 x8 : 49b5268679ba0000
32 [2022-08-01 09:20:13] [ 126.915105][ T2548] x7 : 0000000000000000 x6 : ffffffc011c85e36
33 [2022-08-01 09:20:13] [ 126.921830][ T2548] x5 : 0000000000000000 x4 : 0000000000000004
34 [2022-08-01 09:20:13] [ 126.928557][ T2548] x3 : 0000000000000a32 x2 : fffffffffffffb37
35 [2022-08-01 09:20:13] [ 126.935286][ T2548] x1 : 0000000000000000 x0 : 0000000000000026
36 [2022-08-01 09:20:13] [ 126.942014][ T2548] Call trace:
37 [2022-08-01 09:20:13] [ 126.945529][ T2548] dpm_run_callback+0x1bc/0x418
38 [2022-08-01 09:20:13] [ 126.950796][ T2548] __device_suspend+0x320/0x48c
39 [2022-08-01 09:20:13] [ 126.956063][ T2548] dpm_suspend+0x110/0x4ec
40 [2022-08-01 09:20:13] [ 126.960840][ T2548] dpm_suspend_start+0x88/0xac
41 [2022-08-01 09:20:13] [ 126.966016][ T2548] suspend_devices_and_enter+0xf4/0x4a8
42 [2022-08-01 09:20:13] [ 126.972060][ T2548] enter_state+0x98/0x494
43 [2022-08-01 09:20:13] [ 126.976743][ T2548] pm_suspend+0x58/0xd8
44 [2022-08-01 09:20:13] [ 126.981232][ T2548] state_store+0x104/0x13c
45 [2022-08-01 09:20:13] [ 126.986012][ T2548] kobj_attr_store+0x34/0x80
46 [2022-08-01 09:20:13] [ 126.990992][ T2548] sysfs_kf_write+0x60/0xb8
47 [2022-08-01 09:20:13] [ 126.995870][ T2548] kernfs_fop_write+0x124/0x1b8
48 [2022-08-01 09:20:13] [ 127.001140][ T2548] __vfs_write+0x60/0x200
49 [2022-08-01 09:20:13] [ 127.005823][ T2548] vfs_write+0xe4/0x1a8
50 [2022-08-01 09:20:13] [ 127.010307][ T2548] ksys_write+0x78/0xe4
51 [2022-08-01 09:20:13] [ 127.014795][ T2548] __arm64_sys_write+0x1c/0x28
52 [2022-08-01 09:20:13] [ 127.019969][ T2548] el0_svc_common+0xc4/0x1ac
53 [2022-08-01 09:20:13] [ 127.024943][ T2548] el0_svc_handler+0x1c/0x28
54 [2022-08-01 09:20:13] [ 127.029919][ T2548] el0_svc+0x8/0xc
55 [2022-08-01 09:20:13] [ 127.033924][ T2548] Code: 52803d41 aa1303e2 97e7d911 d50332bf (b9000313)
56 [2022-08-01 09:20:13] [ 127.041502][ T2548] ---[ end trace a6dd74825f312efd ]---
57 [2022-08-01 09:20:13] [ 127.047449][ T2548] Kernel panic - not syncing: Fatal exception
58 [2022-08-01 09:20:13] [ 127.054080][ T2548] SMP: stopping secondary CPUs
59 [2022-08-01 09:20:13] [ 127.059361][ T2548] Kernel Offset: disabled
60 [2022-08-01 09:20:13] [ 127.064079][ T2548] CPU features: 0x00010002,20002004
61 [2022-08-01 09:20:13] [ 127.069734][ T2548] Memory Limit: none
62 [2022-08-01 09:20:13] [ 127.073934][ T2548] Rebooting in 5 seconds..

- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
2. Oops缺页异常日志片段1(判断错误类型)
1 [2022-08-01 09:20:13] [ 126.604045][ T2548] Unable to handle kernel access to user memory outside uaccess routines at virtual address 0000000000000110
- 第1行,我们看出,用户态访问了非法地址,虚拟地址为0x0000000000000110。
- 第1行还有很多异常访问的原因实现在die_kernel_fault()函数中,而具体的异常原因归纳后如下表:
| 异常类型 | 异常原因 | 输出日志 |
|---|
| 内核态访问权限问题 | 写内存 | write to read-only memory |
| 内核态访问权限问题 | 读内存 | read from unreadable memory |
| 内核态访问了错误地址 | 访问了空指针 | NULL pointer dereference |
| 内核态访问了错误地址 | MMU不能索引物理地址 | paging request |
| 用户态访问权限问题 | 用户态访问了内核态地址 | access to user memory with fs=KERNEL_DS |
| 用户态访问了错误地址 | 用户态从不可执行区域执行程序 | execution of user memory |
| 用户态访问了错误地址 | 访问非法用户空间 | access to user memory outside uaccess routines |
3. Oops缺页异常日志片段2(输出与ESR相关的信息)
2 [2022-08-01 09:20:13] [ 126.616876][ T2548] Mem abort info:
3 [2022-08-01 09:20:13] [ 126.620775][ T2548] ESR = 0x96000045
4 [2022-08-01 09:20:13] [ 126.624979][ T2548] EC = 0x25: DABT (current EL), IL = 32 bits
5 [2022-08-01 09:20:13] [ 126.631692][ T2548] SET = 0, FnV = 0
6 [2022-08-01 09:20:13] [ 126.636051][ T2548] EA = 0, S1PTW = 0
7 [2022-08-01 09:20:13] [ 126.640350][ T2548] Data abort info:
8 [2022-08-01 09:20:13] [ 126.644382][ T2548] ISV = 0, ISS = 0x00000045
9 [2022-08-01 09:20:13] [ 126.649449][ T2548] CM = 0, WnR = 1
- 第2~9行,输出ESR相关域的值,并且解析异常类型,从第4行可以看出异常类型是DABT。此外第7行之后会输出数据异常的ISS中几个重要域的值,方便进一步解析。
4. Oops缺页异常日志片段3(遍历页表和输出页表项内容)
10 [2022-08-01 09:20:13] [ 126.653695][ T2548] user pgtable: 4k pages, 39-bit VAs, pgdp=00000000c3473000
11 [2022-08-01 09:20:13] [ 126.661685][ T2548] [0000000000000110] pgd=0000000000000000, pud=0000000000000000
- 上述日志由show_pte()函数实现。
- 第10行:
- user pgtable:表示发生在用户态,若发生异常的地址在内核空间,那么会输出“swapper pteable”。
- 4k pages:表示系统使用的页面大小。
- 39-bit VAs:表示虚拟地址总线的位宽,该值等于CONFIG_ARM64_VA_BITS。
- pgdp:表示以及页表的指针,即mm->pgd。
- 第11行:
- pgd:表示异常地址所在的PGD页表项的内容,注意,这里是PGD页表项的内容,而不是页表项指针,它是通过pgd_val()宏读取的。
- pud:表示异常地址所在的PUD页表项的内容。
- pte:表示异常地址所在的PTE的内容。
5. Oops缺页异常日志片段4(输出寄存器信息)
12 [2022-08-01 09:20:13] [ 126.670085][ T2548] Internal error: Oops: 96000045 [
- 第12行,上述日志有__die()函数实现:
- Internal error:表示发生了严重的内部错误。
- Oops:表示错误的类型为oops。
- 96000045:表示ARM64的ESR的值。
- [#1]:表示发生错误的次数。
6. Oops缺页异常日志片段5(输出已安装模块)
13 [2022-08-01 09:20:13] [ 126.677084][ T2548] Modules linked in: aic8800_fdrv snd_aloop hall_sensor gslX680new aic8800_btlpm aic8800_bsp virtual spi_sunxi
sunxi_ve sunxi_sysinfo sunxi_keyboard sr9800 sr9700 ax88179_178a asix smsc95xx smsc75xx ppp_synctty ppp_async option usb_wwan usbserial sunxi_usbc sunxi_us
b_udc ohci_sunxi ohci_hcd ehci_sunxi sunxi_hci lan78xx kaweth gpu_domain gl620a g2d_sunxi dump_reg_misc dump_reg dm9601 arc4 snd_soc_sunxi_simple_card snd_
soc_simple_card_utils snd_soc_sunxi_spdif snd_soc_sunxi_dmic snd_soc_dmic snd_soc_sunxi_daudio sun50iw10_sndcodec sun50iw10_codec snd_soc_sunxi_component_j
ack snd_soc_sunxi_dummy_cpudai snd_soc_sunxi mir3da sc7a20 init_input pvrsrvkm(O) vin_v4l2 dw9714_act actuator gc030a_mipi gc02m2_mipi gc5035_mipi vin_io s
unxi_rfkill sunxi_drm_heap optee tee zram zsmalloc nand sunxi_uart sunxi_thermal sunxi_nsi sunxi_addr sunxi_mmc_host disp fb sunxi_iommu sun6i_dma virt_dma
sun50i_cpufreq_nvmem sunxi_sid sunxi_smc rtc_sunxi pwm_sunxi_group pinctrl_sun50iw10p1_r
14 [2022-08-01 09:20:13] [ 126.677191][ T2548] pinctrl_sun50iw10p1 pinctrl_sunxi nvmem_sunxi_sid irq_sunxi_wakeupgen irq_sun8i_nmi i2c_sunxi i2c_dev cpufre
q_dt ccu_sun50iw10_ddr ccu_sun50iw10_r ccu_sun50iw10 ccu_sunxi_ng axp2202_usb_power axp2202_battery axp2101_regulator axp2101_pek axp2101_i2c axp2101 rtc_s
unxi_ccu
- 第13~14行,输出系统已经加载的内核模块名称。由print_modules()函数。
7. Oops缺页异常日志片段6(输出内核通用寄存器)
15 [2022-08-01 09:20:13] [ 126.803325][ T2548] CPU: 0 PID: 2548 Comm: sh Tainted: G O 5.4.161-00160-g69cc09208884
16 [2022-08-01 09:20:13] [ 126.813911][ T2548] Hardware name: sun50iw10 (DT)
17 [2022-08-01 09:20:13] [ 126.819160][ T2548] pstate: 60400005 (nZCv daif +PAN -UAO)
18 [2022-08-01 09:20:13] [ 126.825308][ T2548] pc : dpm_run_callback+0x1bc/0x418
19 [2022-08-01 09:20:13] [ 126.830963][ T2548] lr : dpm_run_callback+0x1b8/0x418
20 [2022-08-01 09:20:13] [ 126.836619][ T2548] sp : ffffffc016abba00
21 [2022-08-01 09:20:13] [ 126.841105][ T2548] x29: ffffffc016abba00 x28: ffffffc011cdf000
22 [2022-08-01 09:20:13] [ 126.847833][ T2548] x27: ffffffc011bb8000 x26: ffffff80bb0cc148
23 [2022-08-01 09:20:13] [ 126.854562][ T2548] x25: ffffffc011bb8208 x24: 0000000000000110
24 [2022-08-01 09:20:13] [ 126.861287][ T2548] x23: 0000000000000000 x22: 0000000000000002
25 [2022-08-01 09:20:13] [ 126.868014][ T2548] x21: ffffffc01166b85b x20: ffffff80519a7078
26 [2022-08-01 09:20:13] [ 126.874743][ T2548] x19: ffffffc010f8425c x18: ffffffc015917088
27 [2022-08-01 09:20:13] [ 126.881469][ T2548] x17: ffffffc011c6bfd4 x16: 00000000000061d0
28 [2022-08-01 09:20:13] [ 126.888198][ T2548] x15: 0000000000000004 x14: 000000000000003c
29 [2022-08-01 09:20:13] [ 126.894925][ T2548] x13: 0000000000019e6c x12: 0000000000000000
30 [2022-08-01 09:20:13] [ 126.901650][ T2548] x11: 0000000000000000 x10: 00000000ffffffff
31 [2022-08-01 09:20:13] [ 126.908378][ T2548] x9 : 49b5268679ba0000 x8 : 49b5268679ba0000
32 [2022-08-01 09:20:13] [ 126.915105][ T2548] x7 : 0000000000000000 x6 : ffffffc011c85e36
33 [2022-08-01 09:20:13] [ 126.921830][ T2548] x5 : 0000000000000000 x4 : 0000000000000004
34 [2022-08-01 09:20:13] [ 126.928557][ T2548] x3 : 0000000000000a32 x2 : fffffffffffffb37
35 [2022-08-01 09:20:13] [ 126.935286][ T2548] x1 : 0000000000000000 x0 : 0000000000000026

- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 输出ARM64处理器的通用寄存器,由__show_regs()函数实现:
- 第15行,“CPU: 0” :触发异常时CPU的编号。 “PID: 2548 Comm: sh”:触发异常时的PID和名称。 “Tainted: G O 5.4.161-00160-g69cc09208884 #2”:Linux内核版本即commit。
- 第16行,“Hardware name: sun50iw10 (DT)”:硬件板子名称。
- 第17行,pstate:PSTATE寄存器的值。
- 第18行,pc:PC寄存器的值和对应的符号表信息。
- 第19行,lr:LR寄存器的值和对应的符号表信息。
- 第20行,sp:当前栈的SP的值。
- 第21~ 35行:x0~x29:通用寄存器的值。
8. Oops缺页异常日志片段7(内核函数调用路径输出)
36 [2022-08-01 09:20:13] [ 126.942014][ T2548] Call trace:
37 [2022-08-01 09:20:13] [ 126.945529][ T2548] dpm_run_callback+0x1bc/0x418
38 [2022-08-01 09:20:13] [ 126.950796][ T2548] __device_suspend+0x320/0x48c
39 [2022-08-01 09:20:13] [ 126.956063][ T2548] dpm_suspend+0x110/0x4ec
40 [2022-08-01 09:20:13] [ 126.960840][ T2548] dpm_suspend_start+0x88/0xac
41 [2022-08-01 09:20:13] [ 126.966016][ T2548] suspend_devices_and_enter+0xf4/0x4a8
42 [2022-08-01 09:20:13] [ 126.972060][ T2548] enter_state+0x98/0x494
43 [2022-08-01 09:20:13] [ 126.976743][ T2548] pm_suspend+0x58/0xd8
44 [2022-08-01 09:20:13] [ 126.981232][ T2548] state_store+0x104/0x13c
45 [2022-08-01 09:20:13] [ 126.986012][ T2548] kobj_attr_store+0x34/0x80
46 [2022-08-01 09:20:13] [ 126.990992][ T2548] sysfs_kf_write+0x60/0xb8
47 [2022-08-01 09:20:13] [ 126.995870][ T2548] kernfs_fop_write+0x124/0x1b8
48 [2022-08-01 09:20:13] [ 127.001140][ T2548] __vfs_write+0x60/0x200
49 [2022-08-01 09:20:13] [ 127.005823][ T2548] vfs_write+0xe4/0x1a8
50 [2022-08-01 09:20:13] [ 127.010307][ T2548] ksys_write+0x78/0xe4
51 [2022-08-01 09:20:13] [ 127.014795][ T2548] __arm64_sys_write+0x1c/0x28
52 [2022-08-01 09:20:13] [ 127.019969][ T2548] el0_svc_common+0xc4/0x1ac
53 [2022-08-01 09:20:13] [ 127.024943][ T2548] el0_svc_handler+0x1c/0x28
54 [2022-08-01 09:20:13] [ 127.029919][ T2548] el0_svc+0x8/0xc

- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 第36~54行,输出异常时的内核调用路径。由dump_backtrace()函数实现。
9. Oops缺页异常日志片段8(输出PC寄存器前4条指令)
55 [2022-08-01 09:20:13] [ 127.033924][ T2548] Code: 52803d41 aa1303e2 97e7d911 d50332bf (b9000313)
56 [2022-08-01 09:20:13] [ 127.041502][ T2548] ---[ end trace a6dd74825f312efd ]---
- 第55~56行,输出PC寄存器指向的地址addr输出,并输出addr的前4条指令。由__dump_instr()函数实现。
10. Oops缺页异常日志片段9(系统重启)
57 [2022-08-01 09:20:13] [ 127.047449][ T2548] Kernel panic - not syncing: Fatal exception
58 [2022-08-01 09:20:13] [ 127.054080][ T2548] SMP: stopping secondary CPUs
59 [2022-08-01 09:20:13] [ 127.059361][ T2548] Kernel Offset: disabled
60 [2022-08-01 09:20:13] [ 127.064079][ T2548] CPU features: 0x00010002,20002004
61 [2022-08-01 09:20:13] [ 127.069734][ T2548] Memory Limit: none
62 [2022-08-01 09:20:13] [ 127.073934][ T2548] Rebooting in 5 seconds..