(linux 2.6.22 )
kernel panic时候如何进行问题定位?
本文给出一个简单的思路。
如图
注意code:部分,<ff>,这个尖括号指明当前执行的指令(导致panic的地方哦)。
prism2_wep_encrypt+0x19d/0x250d [ieee80211_rtl] 指明是ieee80211_rtl模块的prism2_wep_encrypt函数内部出现问题。
通过以上信息定位到 net/ieee80211/ieee80211_crypt_wep.c
make net/ieee80211/ieee80211_crypt_wep.o
objdump -d ieee80211_crypt_wep.o
或者使用gdb ieee80211_crypt_wep.o
(gdb) disassemble prism2_wep_encrypt
在汇编代码中定位ff 53 08指令00000410 <prism2_wep_encrypt>:
521: 77 7d ja 5a0 <prism2_wep_encrypt+0x190>
523: 8b 44 24 14 mov 0x14(%esp),%eax
527: 8d 54 24 1c lea 0x1c(%esp),%edx
52b: 81 e7 ff 0f 00 00 and $0xfff,%edi
531: f7 d0 not %eax
533: 88 06 mov %al,(%esi)
535: c1 e8 08 shr $0x8,%eax
538: 88 46 01 mov %al,0x1(%esi) //icv[1] = crc >> 8;
53b: c1 e8 08 shr $0x8,%eax
53e: 88 46 02 mov %al,0x2(%esi) //icv[2] = crc >> 16;
541: c1 e8 08 shr $0x8,%eax
544: 88 46 03 mov %al,0x3(%esi) //icv[3] = crc >> 24;
547: 8b 5d 14 mov 0x14(%ebp),%ebx
54a: 0f b6 4c 24 1b movzbl 0x1b(%esp),%ecx
54f: 89 d8 mov %ebx,%eax
551: 83 c1 03 add $0x3,%ecx
554: ff 53 08 call *0x8(%ebx) ---这里
557: 8b 44 24 0c mov 0xc(%esp),%eax
55b: 8b 4c 24 10 mov 0x10(%esp),%ecx
55f: 8b 5c 24 3c mov 0x3c(%esp),%ebx
563: 89 7c 24 30 mov %edi,0x30(%esp)
567: 8d 54 24 2c lea 0x2c(%esp),%edx
56b: 05 04 00 00 40 add $0x40000004,%eax
131 /* Perform WEP encryption on given skb that has at least 4 bytes of headroom
132 * for IV and 4 bytes of tailroom for ICV. Both IV and ICV will be transmitted,
133 * so the payload length increases with 8 bytes.
134 *
135 * WEP frame payload: IV + TX key idx, RC4(data), ICV = RC4(CRC32(data))
136 */
137 static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
138 {
139 struct prism2_wep_data *wep = priv;
140 struct blkcipher_desc desc = { .tfm = wep->tx_tfm };
141 u32 crc, klen, len;
142 u8 *pos, *icv;
143 struct scatterlist sg;
144 u8 key[WEP_KEY_LEN + 3];
……
166 icv = skb_put(skb, 4);
167 icv[0] = crc;
168 icv[1] = crc >> 8;
169 icv[2] = crc >> 16;
170 icv[3] = crc >> 24;
171
172 crypto_blkcipher_setkey(wep->tx_tfm, key, klen); //定位到此函数
……
剩下的问题就是进入crypto_blkcipher_setkey代码解决问题。
Trackback: http://tb.donews.net/TrackBack.aspx?PostId=1222269