428 Star 1.6K Fork 1.6K

GVPopenEuler/kernel

 / 详情

[Backport] ext4: fix uninitialized ratelimit_state->lock access in __ext4_fill_super()

已完成
任务
创建于  
2024-01-04 15:43

评论 (3)

LiBaokun 创建了任务 1年前

Hi cool-water, welcome to the openEuler Community.
I'm the Bot here serving you. You can find the instructions on how to interact with me at Here.
If you have any questions, please contact the SIG: Kernel, and any of the maintainers.

openeuler-ci-bot 添加了
 
sig/Kernel
标签
1年前
LiBaokun 修改了标题 1年前
LiBaokun 修改了描述 1年前

【openEuler-1.0-LTS】【OLK-5.10】 需回合补丁 ext4: fix uninitialized ratelimit_state->lock access in __ext4_fill_super()

正常情况下 interval 一直 0 直到 s_msg_ratelimit_state 被初始化,因此 ___ratelimit() 什么都不会做。但是注册 sysfs 比 初始化 rs->lock 更早,因此可以在 rs->lock 未被初始化时通过 sysfs 的 msg_ratelimit_interval_ms 接口将 rs->interval 修改为非零值,此时调用 ext4_msg 就会因为访问未初始化的 rs->lock 而触发该问题。并发时序如下:

ext4_fill_super
  ext4_register_sysfs
   // sysfs registered msg_ratelimit_interval_ms
                             // Other processes modify rs->interval to
                             // non-zero via msg_ratelimit_interval_ms
  ext4_orphan_cleanup
    ext4_msg(sb, KERN_INFO, "Errors on filesystem, "
      __ext4_msg
        ___ratelimit(&(EXT4_SB(sb)->s_msg_ratelimit_state)
          if (!rs->interval)  // do nothing if interval is 0
            return 1;
          raw_spin_trylock_irqsave(&rs->lock, flags)
            raw_spin_trylock(lock)
              _raw_spin_trylock
                __raw_spin_trylock
                  spin_acquire(&lock->dep_map, 0, 1, _RET_IP_)
                    lock_acquire
                      __lock_acquire
                        register_lock_class
                          assign_lock_key
                            dump_stack();
  ratelimit_state_init(&sbi->s_msg_ratelimit_state, 5 * HZ, 10);
    raw_spin_lock_init(&rs->lock);
    // init rs->lock here

登录 后才可以发表评论

状态
负责人
项目
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
预计工期 (小时)
开始日期   -   截止日期
-
置顶选项
优先级
分支
参与者(2)
5329419 openeuler ci bot 1632792936 LiBaokun-cool-water
C
1
https://gitee.com/openeuler/kernel.git
git@gitee.com:openeuler/kernel.git
openeuler
kernel
kernel

搜索帮助