免费注册 查看新帖 |

Chinaunix

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

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

论坛徽章:
0
1 [报告]
发表于 2007-08-23 20:45 |显示全部楼层
你说的这里有什么问题? 能否详细说一下?

原帖由 sisi8408 于 2007-8-23 11:37 发表 [url=http://linux.chinaunix.net/bbs/redirect.php?goto=findpost&&

void shrink_dcache_sb(struct super_block * sb)
{
        struct list_head *tmp, *next;
        struct dentry *dentry;

        /*
         * Pass one ... move the dentries for the specified
         * superblock to the most recent end of the unused list.
         */
        spin_lock(&dcache_lock);
        list_for_each_safe(tmp, next, &dentry_unused) {
                dentry = list_entry(tmp, struct dentry, d_lru);
                if (dentry->d_sb != sb)
                        continue;
                list_move(tmp, &dentry_unused);
        }

        /*
         * Pass two ... free the dentries for this superblock.
         */
repeat:
        list_for_each_safe(tmp, next, &dentry_unused) {
                dentry = list_entry(tmp, struct dentry, d_lru);
                if (dentry->d_sb != sb)
                        continue;
                dentry_stat.nr_unused--;
                list_del_init(tmp);
                spin_lock(&dentry->d_lock);
                if (atomic_read(&dentry->d_count)) {
                        /*
                         * linux-2.6.20.7/fs/dcache.c
                         *
                         * ¥3
                         * how can i get dentry on lru later?
                         * where u go on earth?
                         */
                        spin_unlock(&dentry->d_lock);
                        continue;
                }
                prune_one_dentry(dentry);
                cond_resched_lock(&dcache_lock);
                goto repeat;
        }
        spin_unlock(&dcache_lock);
}

论坛徽章:
0
2 [报告]
发表于 2007-08-24 10:45 |显示全部楼层
你说的问题(BUG)怎么存在了?请详细解释好吗。


  1. void dput(struct dentry *dentry)
  2. {
  3.         if (!dentry)
  4.                 return;

  5. repeat:
  6.         if (atomic_read(&dentry->d_count) == 1)
  7.                 might_sleep();
  8.       
  9.         if (!atomic_dec_and_lock(&dentry->d_count, &dcache_lock))
  10.                 return;

  11. /*
  12. * linux-2.6.20.7/fs/dcache.c
  13. *
  14. * ¥6
  15. * potentially race @ here
  16. */
  17.         spin_lock(&dentry->d_lock);
  18.       
  19.         if (atomic_read(&dentry->d_count)) {
  20.                 spin_unlock(&dentry->d_lock);
  21.                 spin_unlock(&dcache_lock);
  22.                 return;
  23.         }

  24.         /*
  25.          * AV: ->d_delete() is _NOT_ allowed to block now.
  26.          */
  27.         if (dentry->d_op && dentry->d_op->d_delete) {
  28.                 if (dentry->d_op->d_delete(dentry))
  29.                         goto unhash_it;
  30.         }

  31.         /* Unreachable? Get rid of it */
  32.         if (d_unhashed(dentry))
  33.                 goto kill_it;
  34.       
  35.         if (list_empty(&dentry->d_lru)) {
  36.                   dentry->d_flags |= DCACHE_REFERENCED;
  37.                   list_add(&dentry->d_lru, &dentry_unused);
  38.                   dentry_stat.nr_unused++;
  39.           }
  40.         spin_unlock(&dentry->d_lock);
  41.         spin_unlock(&dcache_lock);
  42.         return;

  43. unhash_it:
  44.         __d_drop(dentry);

  45. kill_it: {
  46.                 struct dentry *parent;

  47.                 /* If dentry was on d_lru list,
  48.                  * delete it from there
  49.                  */
  50.                   if (!list_empty(&dentry->d_lru)) {
  51.                           list_del(&dentry->d_lru);
  52.                           dentry_stat.nr_unused--;
  53.                   }
  54.                   list_del(&dentry->d_u.d_child);
  55.                 dentry_stat.nr_dentry--;        /* For d_free, below */
  56.                
  57.                 /* drops the locks,
  58.                  * at that point nobody can reach this dentry
  59.                  */
  60.                 dentry_iput(dentry);
  61.                
  62.                 parent = dentry->d_parent;
  63.                 d_free(dentry);
  64.                
  65.                 if (dentry == parent)
  66.                         return;
  67.                 dentry = parent;
  68.                 goto repeat;
  69.         }
  70. }
复制代码

论坛徽章:
0
3 [报告]
发表于 2007-08-24 11:46 |显示全部楼层
你怎么知道d_delete return potentially without releasing dcache_lock & dentry->d_lock?

我看的是2。6。13版本。和你的应该差不多。

原帖由 sisi8408 于 2007-8-24 11:22 发表

        if (!error) {
                d_delete(dentry);
/*
*  d_delete return potentially without releasing dcache_lock & dentry->d_lock
*/
        }
/*
* however dput at least try to ...

论坛徽章:
0
4 [报告]
发表于 2007-08-24 11:57 |显示全部楼层
我觉得你提出的BUG中的大多数都是不存在的。尤其是在各版本都稳定了的代码中。


原帖由 思一克 于 2007-8-24 11:46 发表
你怎么知道d_delete return potentially without releasing dcache_lock & dentry->d_lock?

我看的是2。6。13版本。和你的应该差不多。

论坛徽章:
0
5 [报告]
发表于 2007-08-24 13:00 |显示全部楼层
没有当真。

d_delete中的dentry_iput()会spin_unlock ( ... d_lock)的。

还有,我说的是在版本稳定的代码中不大可能有你说的BUG。但是在驱动中,htimer中你你说的可能是有的。我的6.2.13中没有你贴出的那部分代码,所以没有法看。driver中的我又不懂。

原帖由 sisi8408 于 2007-8-24 12:56 发表
天太热,BUG可能躲荫了。
喝杯清茶,回头再看,随手写来,表达个想法,不必当真,呵呵。

论坛徽章:
0
6 [报告]
发表于 2007-08-24 13:22 |显示全部楼层
现在都到2。6。2X了,那么2.6.1X的就是稳定的。
还有,许多内河代码(函数)在版本升级后并没有变化。这部分也是稳定的。要找出其中的BUG是很难的。否则系统就不会运行的那样稳定可靠了。

驱动中BUG应该多些。

原帖由 sisi8408 于 2007-8-24 13:11 发表
如果skipjack用的版本疮上了,这里提个醒,不算太罗唆。

哪个版本稳定呐?不好说,看的人多一点,可能稍好吧。

BUG,俺叫他八哥,一种好听的鸟,养着乐的。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP