我刚刚在ARM平台的Linux 2.6.15中向一个设备驱动程序(驱动程序是内置的)添加了一个56,212字节的数组(声明,未动态分配),并且在发出与进程相关的命令后,总是会出现内核崩溃ID(例如ps或top),即使该设备驱动程序未运行。
这是回溯,
[<c009be04>] (pid_revalidate+0x0/0xa8) from [<c007b934>] (do_lookup+0x18c/0x1b8)
r5 = C5CA9F70 r4 = 00000000
[<c007b7a8>] (do_lookup+0x0/0x1b8) from [<c007c380>] (__link_path_walk+0x8b8/0xd78)
[<c007bac8>] (__link_path_walk+0x0/0xd78) from [<c007c8c4>] (link_path_walk+0x84/0x134)
[<c007c840>] (link_path_walk+0x0/0x134) from [<c007cb10>] (path_lookup+0x19c/0x1a8)
r7 = C48E1000 r6 = 00000000 r5 = C487E000 r4 = C487FF14
[<c007c974>] (path_lookup+0x0/0x1a8) from [<c007cc08>] (__path_lookup_intent_open+0x4c/0x8c)
r7 = 00000001 r6 = C487FF14 r5 = C48E1000 r4 = 00000001
[<c007cbbc>] (__path_lookup_intent_open+0x0/0x8c) from [<c007cc64>] (path_lookup_open+0x1c/0x20)
r7 = 00000005 r6 = 00000004 r5 = C487FF14 r4 = 00000000
[<c007cc48>] (path_lookup_open+0x0/0x20) from [<c007d45c>] (open_namei+0x7c/0x67c)
[<c007d3e0>] (open_namei+0x0/0x67c) from [<c006d28c>] (filp_open+0x2c/0x48)
[<c006d260>] (filp_open+0x0/0x48) from [<c006d55c>] (do_sys_open+0x44/0xd0)
r5 = 00000000 r4 = 00000000
[<c006d518>] (do_sys_open+0x0/0xd0) from [<c006d5f8>] (sys_open+0x10/0x14)
[<c006d5e8>] (sys_open+0x0/0x14) from [<c0020e00>] (ret_fast_syscall+0x0/0x2c)
如果我将数组的容量减少到56,208字节,一切都很好。
56,208字节数组的“ readelf”结果(正常情况下)
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .init PROGBITS c0008000 008000 018000 00 WAX 0 0 32
[ 2] .text PROGBITS c0020000 020000 24c7f4 00 AX 0 0 32
[ 3] .text.init PROGBITS c026c7f4 26c7f4 000078 00 AX 0 0 4
[ 4] .pci_fixup PROGBITS c026c86c 30a700 000000 00 W 0 0 1
[ 5] .rio_route PROGBITS c026c86c 30a700 000000 00 W 0 0 1
[ 6] __ksymtab PROGBITS c026c86c 26c86c 004458 00 A 0 0 4
[ 7] __ksymtab_gpl PROGBITS c0270cc4 270cc4 000898 00 A 0 0 4
[ 8] __kcrctab PROGBITS c027155c 30a700 000000 00 W 0 0 1
[ 9] __kcrctab_gpl PROGBITS c027155c 30a700 000000 00 W 0 0 1
[10] __ksymtab_strings PROGBITS c027155c 27155c 00b288 00 A 0 0 4
[11] __param PROGBITS c027c7e4 27c7e4 000618 00 A 0 0 4
[12] .data PROGBITS c027e000 27e000 08c6f0 00 WA 0 0 32
[13] .bss NOBITS c030a700 30a700 0248e8 00 WA 0 0 32
[14] .comment PROGBITS 00000000 30a700 0028c8 00 0 0 1
[15] .shstrtab STRTAB 00000000 30cfc8 0000a0 00 0 0 1
[16] .symtab SYMTAB 00000000 30d338 07aa50 10 17 25869 4
[17] .strtab STRTAB 00000000 387d88 057629 00 0 0 1
56,212字节数组的“ readelf”结果(NG情况)
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .init PROGBITS c0008000 008000 018000 00 WAX 0 0 32
[ 2] .text PROGBITS c0020000 020000 24c7f4 00 AX 0 0 32
[ 3] .text.init PROGBITS c026c7f4 26c7f4 000078 00 AX 0 0 4
[ 4] .pci_fixup PROGBITS c026c86c 30a700 000000 00 W 0 0 1
[ 5] .rio_route PROGBITS c026c86c 30a700 000000 00 W 0 0 1
[ 6] __ksymtab PROGBITS c026c86c 26c86c 004458 00 A 0 0 4
[ 7] __ksymtab_gpl PROGBITS c0270cc4 270cc4 000898 00 A 0 0 4
[ 8] __kcrctab PROGBITS c027155c 30a700 000000 00 W 0 0 1
[ 9] __kcrctab_gpl PROGBITS c027155c 30a700 000000 00 W 0 0 1
[10] __ksymtab_strings PROGBITS c027155c 27155c 00b288 00 A 0 0 4
[11] __param PROGBITS c027c7e4 27c7e4 000618 00 A 0 0 4
[12] .data PROGBITS c027e000 27e000 08c6f0 00 WA 0 0 32
[13] .bss NOBITS c030a700 30a700 024908 00 WA 0 0 32
[14] .comment PROGBITS 00000000 30a700 0028c8 00 0 0 1
[15] .shstrtab STRTAB 00000000 30cfc8 0000a0 00 0 0 1
[16] .symtab SYMTAB 00000000 30d338 07aa50 10 17 25869 4
[17] .strtab STRTAB 00000000 387d88 057629 00 0 0 1
两种情况之间的区别只是.bss的大小。 (OK情况是248e8; NG情况是24908)
我想知道我是否违反了Linux内核中的某些规则,还是我以错误的方式进行调试?