Skip to content

运行一段时间后内核Panic #228

@woshimaniubi8

Description

@woshimaniubi8

运行平台:

  • 全志A20 armv7
  • Debian 12 , Linux 6.18.0

版本:0.1.6 (2026-02-22)
安装方式:deb包安装


问题:

在运行一段时间后,内核会Panic:

default username is [debian] with a one time password of [temppwd]
root@debian-a20:~# 
root@debian-a20:~# ps aux | grep tokio
root       836  0.0  0.1   7432  1696 ttyS0    S+   16:40   0:00 grep tokio
root@debian-a20:~# rmmod rtl8xxxu
root@debian-a20:~# #排除驱动原因
root@debian-a20:~# [ 3599.047870] Mass Storage Function, version: 2009/09/11
[ 3599.053093] LUN: removable file: (no medium)
[ 3599.519610] sun4i-pinctrl 1c20800.pinctrl: supply vcc-pd not found, using dummy regulator
[ 6534.473029] 8<--- cut here ---
[ 6534.476165] Unable to handle kernel NULL pointer dereference at virtual address 00000044 when read
[ 6534.485141] [00000044] *pgd=00000000
[ 6534.488744] Internal error: Oops: 5 [#1] SMP ARM
[ 6534.493376] Modules linked in: [last unloaded: rtl8xxxu]
[ 6534.498712] CPU: 0 UID: 0 PID: 1092 Comm: tokio-runtime-w Not tainted 6.18.0 #11 NONE 
[ 6534.506644] Hardware name: Generic DT based system
[ 6534.511443] PC is at __switch_to+0x8/0x54
[ 6534.515483] LR is at __schedule+0x338/0x8a0
[ 6534.519687] pc : [<c0101130>]    lr : [<c0a53a54>]    psr: 60010093
[ 6534.525962] sp : f0ec5d00  ip : c40ea238  fp : f0ec5ef1
[ 6534.531195] r10: 00000043  r9 : 00000500  r8 : 6badac00
[ 6534.536427] r7 : c31c2a40  r6 : c40ea200  r5 : ef7ce140  r4 : c1407f80
[ 6534.542970] r3 : c1360000  r2 : 00000000  r1 : c40ea200  r0 : c1407f80
[ 6534.549509] Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment none
[ 6534.556747] Control: 10c5387d  Table: 439f006a  DAC: 00000051
[ 6534.562501] Register r0 information: non-slab/vmalloc memory
[ 6534.568182] Register r1 information: slab task_struct start c40ea200 pointer offset 0 size 2176
[ 6534.576922] Register r2 information: NULL pointer
[ 6534.581642] Register r3 information: non-slab/vmalloc memory
[ 6534.587314] Register r4 information: non-slab/vmalloc memory
[ 6534.592986] Register r5 information: non-slab/vmalloc memory
[ 6534.598658] Register r6 information: slab task_struct start c40ea200 pointer offset 0 size 2176
[ 6534.607391] Register r7 information: slab mm_struct start c31c2a40 pointer offset 0 size 832
[ 6534.615865] Register r8 information: non-paged memory
[ 6534.620930] Register r9 information: non-paged memory
[ 6534.625994] Register r10 information: non-paged memory
[ 6534.631146] Register r11 information: 2-page vmalloc region starting at 0xf0ec4000 allocated at kernel_clone+0xa4/0x344
[ 6534.641963] Register r12 information: slab task_struct start c40ea200 pointer offset 56 size 2176
[ 6534.650871] Process tokio-runtime-w (pid: 1092, stack limit = 0x40036a5d)
[ 6534.657674] Stack: (0xf0ec5d00 to 0xf0ec6000)
[ 6534.662051] 5d00: 00000000 00000000 ef7ce140 c182a19c 00000000 00000002 ef7d5db0 a0070093
[ 6534.670245] 5d20: c40ea480 00089a25 ef7ce140 cd15b824 c40ea480 ef7ce180 00000000 00000400
[ 6534.678437] 5d40: 00000000 c04c42a8 ef7ce180 00000000 ef7ce140 ef7ce140 c136a140 c016114c
[ 6534.686629] 5d60: 00000000 cd15b824 c40ea480 c40ea480 ef7ce180 c01611e8 f0ec5e08 00000000
[ 6534.694821] 5d80: c40ea480 c0161444 00000000 00000001 00000001 00000001 00000000 cd15b824
[ 6534.703014] 5da0: 00000000 c118b8c4 ef7ce140 f0ec5e08 c40ea200 00000000 00000000 ffffffff
[ 6534.711207] 5dc0: 00000002 c0150e54 c1407f90 c40ea200 c40ea200 c1407f80 6badac43 c010115c
[ 6534.719398] 5de0: f0ec5e58 ef7cbe00 c1367dc0 ef7cbdc0 c0a53fdc 2e464000 c136a140 c14052bc
[ 6534.727590] 5e00: c40ea788 c40ea200 00000000 00000004 c0b00d08 00000000 00000002 cd15b824
[ 6534.735782] 5e20: 00000000 c40ea200 00000000 c40ea200 0001bd4b c1824034 00000000 c02df98c
[ 6534.743974] 5e40: f0ec5e54 c0a53fdc f0ec5ef8 00000000 c182402c c0a5a014 c4134499 00000000
[ 6534.752166] 5e60: ef7cc170 00000000 51654573 000005f1 51638828 000005f1 c01af4e0 ef7cbe00
[ 6534.760358] 5e80: 00000001 00000000 c40ea200 00000000 06cb708d cd15b824 00000051 c1824000
[ 6534.768551] 5ea0: 00000000 c40ea200 f0ec5f0c c0a5a060 00000000 00000001 c02df98c c02e08e8
[ 6534.776743] 5ec0: 00000000 f0ec5f00 00000008 c02df9bc 0327b500 00000400 f0ec5ef8 c3158cc0
[ 6534.784935] 5ee0: c3158cc1 c1406250 000005f1 51638828 0001bd4b 00000000 51638828 000005f1
[ 6534.793127] 5f00: 00000001 c40ea200 c02df98c f0ec5f0c f0ec5f0c cd15b824 0327b500 00000004
[ 6534.801319] 5f20: 0327b500 00000400 f0ec5f58 c01002c4 c40ea200 000000fc 03262a94 c02e2068
[ 6534.809511] 5f40: 357315a8 00000000 00000000 00000000 06cb8080 00000000 00001986 00000000
[ 6534.817703] 5f60: 00a3cc28 c2934480 00001986 00000000 00a3cc28 c2934480 00001985 00000000
[ 6534.825896] 5f80: 357315a8 00000000 c010fcf0 cd15b824 00000001 00000072 00000400 00000000
[ 6534.834088] 5fa0: 000000fc c0100060 00000072 00000400 00000004 0327b500 00000400 00000072
[ 6534.842281] 5fc0: 00000072 00000400 00000000 000000fc 00000004 fffffffd 03262a94 03262a94
[ 6534.850473] 5fe0: 000000fc b6959490 b6c12e6d b6b7d656 80070030 00000004 00000000 00000000
[ 6534.858658] Call trace: 
[ 6534.858682] Code: e1b0f00e e7f001f2 e281c010 e8ac6ff0 (e5924044) 
[ 6534.867328] ---[ end trace 0000000000000000 ]---
[ 6534.871956] note: tokio-runtime-w[1092] exited with irqs disabled

我收集了2次的日志,发给Ai分析,两次都提到了tokio-runtime-w.
https://chat.deepseek.com/share/j1y4mmxd6pmyjip5gk

b) 驱动模块引起的内存损坏
rtl8xxxu 驱动被加载,该驱动用于 Realtek USB 无线网卡。某些 USB 网卡驱动在处理热插拔、电源管理或并发访问时可能触发内存越界或释放后使用(UAF),进而污染内核关键数据结构(如 task_struct),导致后续调度时访问到非法指针。
c) 用户态程序触发
tokio-runtime-w 通常来自使用 Tokio 框架的 Rust 应用(例如异步网络服务)。如果该程序存在缺陷(如大量创建线程、不正确的系统调用参数),可能间接触发内核 bug,或使系统资源耗尽导致不稳定。

根据您提供的最新日志,内核恐慌再次发生,且第二次发生在 __switch_to+0x8,进程依然是 tokio-runtime-w。虽然第一次与 rtl8xxxu 驱动有关,但第二次该模块已卸载,问题仍然出现。
当前状态总结
内核版本:6.18.0(主线内核)
进程:tokio-runtime-w(Rust Tokio 运行时的工作线程)
两次 panic 均发生在进程调度/切换的关键函数中(__schedule、__switch_to)
已卸载 rtl8xxxu 但问题依旧,排除该驱动是唯一诱因
系统启动时存在少量设备树依赖警告,但未直接导致崩溃


我尝试将one-kvm的服务停止,系统不再panic

root@debian-a20:~# systemctl status one-kvm
○ one-kvm.service - One-KVM IP-KVM Service
     Loaded: loaded (/lib/systemd/system/one-kvm.service; enabled; preset: enab>
     Active: inactive (dead)
       Docs: https://github.com/mofeng-git/One-KVM
root@debian-a20:~# 

这是系统bug还是程序的bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions