免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: sisi8408
打印 上一主题 下一主题

Kernel Bug-Vulnerability-Comment library [复制链接]

论坛徽章:
0
81 [报告]
发表于 2008-01-15 11:54 |只看该作者

  1. localhost test # insmod show_buflow.ko
  2. 段错误
  3. localhost test # lsmod
  4. Module                  Size  Used by
  5. show_buflow             5248  1
  6. pcnet32                31236  0
  7. localhost test # rmmod show_buflow
  8. ERROR: Module show_buflow is in use
  9. localhost test #
复制代码

  1. Jan 15 11:42:15 localhost show_buflow: module license 'unspecified' taints kernel.
  2. Jan 15 11:42:15 localhost aaa
  3. Jan 15 11:42:15 localhost aaa
  4. Jan 15 11:42:15 localhost and what?
  5. Jan 15 11:42:15 localhost BUG: unable to handle kernel paging request at virtual address 74616877
  6. Jan 15 11:42:15 localhost printing eip:
  7. Jan 15 11:42:15 localhost c01e6737
  8. Jan 15 11:42:15 localhost *pde = 00000000
  9. Jan 15 11:42:15 localhost Oops: 0000 [#1]
  10. Jan 15 11:42:15 localhost PREEMPT SMP
  11. Jan 15 11:42:15 localhost Modules linked in: show_buflow(P) pcnet32
  12. Jan 15 11:42:15 localhost CPU:    0
  13. Jan 15 11:42:15 localhost EIP:    0060:[<c01e6737>]    Tainted: P       VLI
  14. Jan 15 11:42:15 localhost EFLAGS: 00010097   (2.6.21-gentoo-r4 #56)
  15. Jan 15 11:42:15 localhost EIP is at vsnprintf+0x2af/0x48c
  16. Jan 15 11:42:15 localhost eax: 74616877   ebx: ffffffff   ecx: 74616877   edx: fffffffe
  17. Jan 15 11:42:15 localhost esi: c04d26c0   edi: c4b63eb0   ebp: ffffffff   esp: c4b63dc4
  18. Jan 15 11:42:15 localhost ds: 007b   es: 007b   fs: 00d8  gs: 0033  ss: 0068
  19. Jan 15 11:42:15 localhost Process insmod (pid: 6658, ti=c4b62000 task=cfeb1580 task.ti=c4b62000)
  20. Jan 15 11:42:15 localhost Stack: 00000000 cfeb7070 cfeb7070 1b41a784 00000109 0000f6d7 00000400 c04d26c0
  21. Jan 15 11:42:15 localhost 0051e0c0 c4b63e0c c04d2ac0 ffffffff 00000000 d0855051 00000400 cf402c00
  22. Jan 15 11:42:15 localhost cf402d98 d0855280 c01e69fd c4b63eb0 00000003 c011e412 c4b63eb0 cf51e0c0
  23. Jan 15 11:42:15 localhost Call Trace:
  24. Jan 15 11:42:15 localhost [<c01e69fd>] vscnprintf+0x14/0x1f
  25. Jan 15 11:42:15 localhost [<c011e412>] vprintk+0xbd/0x2fc
  26. Jan 15 11:42:15 localhost [<c01195f0>] try_to_wake_up+0x393/0x39d
  27. Jan 15 11:42:15 localhost [<c033b0a8>] preempt_schedule+0x46/0x58
  28. Jan 15 11:42:15 localhost [<c01195f0>] try_to_wake_up+0x393/0x39d
  29. Jan 15 11:42:15 localhost [<c033b05a>] wait_for_completion+0x93/0x9b
  30. Jan 15 11:42:15 localhost [<c033c911>] _spin_unlock_irq+0xe/0x22
  31. Jan 15 11:42:15 localhost [<c011e66c>] printk+0x1b/0x1f
  32. Jan 15 11:42:15 localhost [<d0855038>] init_module+0x38/0x40 [show_buflow]
  33. Jan 15 11:42:15 localhost [<c01395e5>] sys_init_module+0x15ac/0x16e3
  34. Jan 15 11:42:15 localhost [<c033c767>] _spin_lock+0xd/0x5a
  35. Jan 15 11:42:15 localhost [<c011e651>] printk+0x0/0x1f
  36. Jan 15 11:42:15 localhost [<c0159fa7>] __fput+0x112/0x13c
  37. Jan 15 11:42:15 localhost [<c016ac25>] mntput_no_expire+0x11/0x5c
  38. Jan 15 11:42:15 localhost [<c0104e20>] sysenter_past_esp+0x5d/0x81
  39. Jan 15 11:42:15 localhost =======================
  40. Jan 15 11:42:15 localhost Code: 74 24 28 73 03 c6 06 20 46 4d 85 ed 7f f1 e9 b9 00 00 00 8b 0f 81 f9 ff 0f 00 00 b8 2e 51 3d c0 0f 46 c8 8b 54 24 2c 89 c8 eb 06 <80> 38 00 74 07 40 4a 83 fa ff 75 f4 29 c8 89 c3 89 e8 f6 44 24
  41. Jan 15 11:42:15 localhost EIP: [<c01e6737>] vsnprintf+0x2af/0x48c SS:ESP 0068:c4b63dc4
  42. Jan 15 11:42:15 localhost note: insmod[6658] exited with preempt_count 2
  43. Jan 15 11:42:15 localhost BUG: scheduling while atomic: insmod/0x10000002/6658
  44. Jan 15 11:42:15 localhost [<c033a806>] __sched_text_start+0x56/0x7c3
  45. Jan 15 11:42:15 localhost [<c02e70f0>] net_rx_action+0x13c/0x181
  46. Jan 15 11:42:15 localhost [<c0119a38>] __cond_resched+0x12/0x2c
  47. Jan 15 11:42:15 localhost [<c033b575>] cond_resched+0x26/0x31
  48. Jan 15 11:42:15 localhost [<c0148961>] unmap_vmas+0x415/0x514
  49. Jan 15 11:42:15 localhost [<c014b307>] exit_mmap+0x7c/0x108
  50. Jan 15 11:42:15 localhost [<c011bcd0>] mmput+0x1d/0x78
  51. Jan 15 11:42:15 localhost [<c0120623>] do_exit+0x1ae/0x6ad
  52. Jan 15 11:42:15 localhost [<c010638b>] die+0x208/0x22d
  53. Jan 15 11:42:15 localhost [<c033e362>] do_page_fault+0x442/0x510
  54. Jan 15 11:42:15 localhost [<c033df20>] do_page_fault+0x0/0x510
  55. Jan 15 11:42:15 localhost [<c033cacc>] error_code+0x7c/0x84
  56. Jan 15 11:42:15 localhost [<c01e6737>] vsnprintf+0x2af/0x48c
  57. Jan 15 11:42:15 localhost [<c01e69fd>] vscnprintf+0x14/0x1f
  58. Jan 15 11:42:15 localhost [<c011e412>] vprintk+0xbd/0x2fc
  59. Jan 15 11:42:15 localhost [<c01195f0>] try_to_wake_up+0x393/0x39d
  60. Jan 15 11:42:15 localhost [<c033b0a8>] preempt_schedule+0x46/0x58
  61. Jan 15 11:42:15 localhost [<c01195f0>] try_to_wake_up+0x393/0x39d
  62. Jan 15 11:42:15 localhost [<c033b05a>] wait_for_completion+0x93/0x9b
  63. Jan 15 11:42:15 localhost [<c033c911>] _spin_unlock_irq+0xe/0x22
  64. Jan 15 11:42:15 localhost [<c011e66c>] printk+0x1b/0x1f
  65. Jan 15 11:42:15 localhost [<d0855038>] init_module+0x38/0x40 [show_buflow]
  66. Jan 15 11:42:15 localhost [<c01395e5>] sys_init_module+0x15ac/0x16e3
  67. Jan 15 11:42:15 localhost [<c033c767>] _spin_lock+0xd/0x5a
  68. Jan 15 11:42:15 localhost [<c011e651>] printk+0x0/0x1f
  69. Jan 15 11:42:15 localhost [<c0159fa7>] __fput+0x112/0x13c
  70. Jan 15 11:42:15 localhost [<c016ac25>] mntput_no_expire+0x11/0x5c
  71. Jan 15 11:42:15 localhost [<c0104e20>] sysenter_past_esp+0x5d/0x81
  72. Jan 15 11:42:15 localhost =======================
复制代码

这样是会溢出的啊
问题是 TCP_CONNTRACK_MAX 和 TCP_CONNTRACK_IGNORE 会不会被取到呢?我不是太了解

[ 本帖最后由 platinum 于 2008-1-15 12:03 编辑 ]

论坛徽章:
0
82 [报告]
发表于 2008-01-15 15:52 |只看该作者
知道了,那两种状态根本就不会进入 conntrack->proto.tcp.state,所以不会出现溢出状况

论坛徽章:
0
83 [报告]
发表于 2008-01-15 20:06 |只看该作者
大脚王,赞一个

tcp_conntrack_names[] overflow 与
tcp_options overflow 不一样,

tcp_options overflow in stack, but
tcp_conntrack_names[] overflow in heap,

module 没法卸载

[ 本帖最后由 sisi8408 于 2008-1-15 20:14 编辑 ]

论坛徽章:
0
84 [报告]
发表于 2008-01-15 22:39 |只看该作者
前两天还在研究 heap 和 stack 之间的关系,今天 sisi8408 大哥这么一说,我更明白了,谢谢你 ^_^

论坛徽章:
0
85 [报告]
发表于 2008-01-18 21:18 |只看该作者

  1. static void add_file(struct super_block *sb, char *name,
  2.         int (*func) (struct seq_file *, struct super_block *))
  3. {
  4.         struct proc_dir_entry *de;

  5.         de = create_proc_entry(name, 0, REISERFS_SB(sb)->procdir);
  6.         if (de) {
  7.                 /*
  8.                  * linux-2.6.23.12/fs/reiserfs
  9.                  * 2008-1-18 21:09
  10.                  * nice play show what is free indeed
  11.                  */
  12.                 de->data = func;
  13.                 de->proc_fops = &r_file_operations;
  14.         }
  15. }

复制代码

论坛徽章:
0
86 [报告]
发表于 2008-01-18 22:31 |只看该作者

  1.                 // make sure, that the node contents look like a node of
  2.                 // certain level
  3.                 if (!is_tree_node(p_s_bh, expected_level)) {
  4.                         reiserfs_warning(p_s_sb, "vs-5150: search_by_key: "
  5.                                          "invalid format found in block %ld. Fsck?",
  6.                                          p_s_bh->b_blocknr);
  7.                         pathrelse(p_s_search_path);
  8.                         /* linux-2.6.23.12
  9.                          * it is not HW err
  10.                          */
  11.                         return IO_ERROR;
  12.                 }

复制代码

论坛徽章:
0
87 [报告]
发表于 2008-01-19 10:30 |只看该作者

  1. struct in_core_key
  2. {
  3.         __u32 k_dir_id;
  4.         __u32 k_objectid;
  5.         __u64 k_offset;
  6.         __u8  k_type;        /* shit and big tail eagle?! */
  7. }; /* shouldbe? __attribute__ ((__packed__)); */
  8. /*linux-2.6.23.12*/
  9. struct cpu_key
  10. {
  11.         struct in_core_key on_disk_key;
  12.         int version;
  13.         int key_length;                /* 3 in all cases but direct2indirect and
  14.                                    indirect2direct conversion */
  15. };

复制代码

论坛徽章:
0
88 [报告]
发表于 2008-01-30 22:02 |只看该作者
potential NULL pointer bug in reiserfs-3.6


  1. static int balance_leaf(struct tree_balance *tb,
  2.                         struct item_head *ih,        /* item header of inserted item (this is on little endian) */
  3.                         const char *body,        /* body  of inserted item or bytes to paste */
  4.                         int flag,        /* i - insert, d - delete, c - cut, p - paste
  5.                                            (see comment to do_balance) */
  6.                         struct item_head *insert_key,        /* in our processing of one level we sometimes determine what
  7.                                                            must be inserted into the next higher level.  This insertion
  8.                                                            consists of a key or two keys and their corresponding
  9.                                                            pointers */
  10.                         struct buffer_head **insert_ptr        /* inserted node-ptrs for the next level */
  11.     )
  12. {
  13.         struct buffer_head *tbS0 = PATH_PLAST_BUFFER(tb->tb_path);
  14.         int item_pos = PATH_LAST_POSITION(tb->tb_path);        /*  index into the array of item headers in S[0]
  15.                                                            of the affected item */
  16.         struct buffer_info bi;
  17.         struct buffer_head *S_new[2];        /* new nodes allocated to hold what could not fit into S */
  18.         int snum[2];                /* number of items that will be placed
  19.                                    into S_new (includes partially shifted
  20.                                    items) */
  21.         int sbytes[2];                /* if an item is partially shifted into S_new then
  22.                                    if it is a directory item
  23.                                    it is the number of entries from the item that are shifted into S_new
  24.                                    else
  25.                                    it is the number of bytes from the item that are shifted into S_new
  26.                                  */
  27.         int n, i;
  28.         int ret_val;
  29.         int pos_in_item;
  30.         int zeros_num;

  31.         PROC_INFO_INC(tb->tb_sb, balance_at[0]);

  32.         /* Make balance in case insert_size[0] < 0 */
  33.         if (tb->insert_size[0] < 0)
  34.                 return balance_leaf_when_delete(tb, flag);

  35.         zeros_num = 0;
  36.         if (flag == M_INSERT && body == 0)
  37.                 /*
  38.                  * 2008-1-30 21:46
  39.                  * linux-2.6.23.12
  40.                  * @@@@@@@@@@@@@@@@@@@@@@@@@@@@
  41.                  * potential ih NULL pointer  @
  42.                  * @@@@@@@@@@@@@@@@@@@@@@@@@@@@
  43.                  */
  44.                 zeros_num = ih_item_len(ih);

  45.         pos_in_item = tb->tb_path->pos_in_item;
  46.         /* for indirect item pos_in_item is measured in unformatted node
  47.            pointers. Recalculate to bytes */
  48.         if (flag != M_INSERT
  49.             && is_indirect_le_ih(B_N_PITEM_HEAD(tbS0, item_pos)))
  50.                 pos_in_item *= UNFM_P_SIZE;
  51. [...]
  52. }

  53. int reiserfs_paste_into_item(struct reiserfs_transaction_handle *th,
  54.                              struct treepath *p_s_search_path,        /* Path to the pasted item */
  55.                              const struct cpu_key *p_s_key,        /* Key to search for the needed item */
  56.                              struct inode *inode,        /* Inode that item belongs to */
  57.                              const char *p_c_body,        /* Pointer to the bytes to paste */
  58.                              int n_pasted_size) /* Size of pasted bytes */
  59. {
  60. [...]
  61.         /* Perform balancing after all resources are collected by fix_nodes, and
  62.          * accessing them will not risk triggering schedule.
  63.          */
  64.         if (retval == CARRY_ON) {
  65.                 /*
  66.                  * source-01
  67.                  */
  68.                 do_balance(&s_paste_balance, NULL, /*ih*/ p_c_body, M_PASTE);
  69.                 return 0;
  70.         }
  71.         retval = (retval == NO_DISK_SPACE) ? -ENOSPC : -EIO;
  72. [...]
  73. }

  74. void do_balance(struct tree_balance *tb,        /* tree_balance structure */
  75.                 struct item_head *ih,        /* item header of inserted item */
  76.                 const char *body,        /* body  of inserted item or bytes to paste */
  77.                 int flag)
  78.                                 /* i - insert, d - delete
  79.                                    c - cut, p - paste

  80.                                    Cut means delete part of an item
  81.                                    (includes removing an entry from a directory).

  82.                                    Delete means delete whole item.

  83.                                    Insert means add a new item into the tree.

  84.                                    Paste means to append to the end of an
  85.                                          existing file or to insert a directory entry.
  86.                                 */
  87. {
  88. [...]
  89.         do_balance_starts(tb);
  90.         /* balance leaf returns 0 except
  91.          * if combining L R and S into one node.
  92.          *
  93.          * see balance_internal() for explanation of this line of code.
  94.          */
  95.         child_pos = PATH_H_B_ITEM_ORDER(tb->tb_path, 0) +
  96.                 /*
  97.                  * source-02
  98.                  */
  99.                 balance_leaf(tb, ih, body, flag, insert_key, insert_ptr);
  100. [...]
  101. }

复制代码

论坛徽章:
0
89 [报告]
发表于 2008-02-03 00:40 |只看该作者

回复 #88 sisi8408 的帖子

It's not a bug since the marked codes are executed only when flag == M_INSERT.

论坛徽章:
0
90 [报告]
发表于 2008-02-03 17:03 |只看该作者
很有意思的帖子,以前还从没看过。
至今为止我只在e100的驱动中发现过一个中断处理的bug。老大让把patch发出去,结果俺到现在还没发。
很想看一下这个帖子,可惜大部分代码都不熟悉,光看片段代码很难知道是不是BUG,必须结合相关子系统上下文一起看。
像大家学习了,关注中
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP