Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-15601

osd_inode_iteration err ptr dereference, wrong bitmap checks in osd scrub

Details

    • Bug
    • Resolution: Fixed
    • Critical
    • Lustre 2.15.0
    • Lustre 2.15.0
    • None
    • 3
    • 9223372036854775807

    Description

      it looks like osd_inode_iteration and all around code in osd-ldiskfs/osd_scrub.c is incorrect

      osd_inode_iteration:

                      param->bitmap = ldiskfs_read_inode_bitmap(param->sb, param->bg);
                      if (!param->bitmap) {
                              CERROR("%s: fail to read bitmap for %u, "
                                     "scrub will stop, urgent mode\n",
                                     osd_scrub2name(scrub), (__u32)param->bg);
                              RETURN(-EIO);
                      }
       

      But the comment in ldiskfs_read_inode_bitmap() is incorrect:

       * Return buffer_head of bitmap on success or NULL.
       */
      struct buffer_head *
      ldiskfs_read_inode_bitmap(struct super_block *sb, ldiskfs_group_t block_group)
      {
              struct ldiskfs_group_desc *desc;
              struct ldiskfs_sb_info *sbi = LDISKFS_SB(sb);
              struct buffer_head *bh = NULL;
              ldiskfs_fsblk_t bitmap_blk;
              int err;        desc = ldiskfs_get_group_desc(sb, block_group, NULL);
              if (!desc)
                      return ERR_PTR(-EFSCORRUPTED);
      ...
                      return ERR_PTR(-EIO);
       

      and so on.

      this is not the case in centos7, but on rhel8 is already affected

      Attachments

        Activity

          [LU-15601] osd_inode_iteration err ptr dereference, wrong bitmap checks in osd scrub
          pjones Peter Jones made changes -
          Assignee Original: WC Triage [ wc-triage ] New: Andreas Dilger [ adilger ]
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]
          pjones Peter Jones made changes -
          Priority Original: Minor [ 4 ] New: Critical [ 2 ]
          pjones Peter Jones made changes -
          Fix Version/s New: Lustre 2.15.0 [ 14791 ]
          green Oleg Drokin made changes -
          Affects Version/s New: Lustre 2.15.0 [ 14791 ]
          green Oleg Drokin made changes -
          Description Original: it looks like osd_inode_iteration and all around code in osd-ldiskfs/osd_scrub.c is incorrect

          osd_inode_iteration:
          {noformat}
                          param->bitmap = ldiskfs_read_inode_bitmap(param->sb, param->bg);
                          if (!param->bitmap) {
                                  CERROR("%s: fail to read bitmap for %u, "
                                         "scrub will stop, urgent mode\n",
                                         osd_scrub2name(scrub), (__u32)param->bg);
                                  RETURN(-EIO);
                          }
           {noformat}
          But the comment in ldiskfs_read_inode_bitmap() is incorrect:
          {noformat}
           * Return buffer_head of bitmap on success or NULL.
           */
          struct buffer_head *
          ldiskfs_read_inode_bitmap(struct super_block *sb, ldiskfs_group_t block_group)
          {
                  struct ldiskfs_group_desc *desc;
                  struct ldiskfs_sb_info *sbi = LDISKFS_SB(sb);
                  struct buffer_head *bh = NULL;
                  ldiskfs_fsblk_t bitmap_blk;
                  int err;        desc = ldiskfs_get_group_desc(sb, block_group, NULL);
                  if (!desc)
                          return ERR_PTR(-EFSCORRUPTED);
          ...
                          return ERR_PTR(-EIO);
           {noformat}
          and so on
          New: it looks like osd_inode_iteration and all around code in osd-ldiskfs/osd_scrub.c is incorrect

          osd_inode_iteration:
          {noformat}
                          param->bitmap = ldiskfs_read_inode_bitmap(param->sb, param->bg);
                          if (!param->bitmap) {
                                  CERROR("%s: fail to read bitmap for %u, "
                                         "scrub will stop, urgent mode\n",
                                         osd_scrub2name(scrub), (__u32)param->bg);
                                  RETURN(-EIO);
                          }
           {noformat}
          But the comment in ldiskfs_read_inode_bitmap() is incorrect:
          {noformat}
           * Return buffer_head of bitmap on success or NULL.
           */
          struct buffer_head *
          ldiskfs_read_inode_bitmap(struct super_block *sb, ldiskfs_group_t block_group)
          {
                  struct ldiskfs_group_desc *desc;
                  struct ldiskfs_sb_info *sbi = LDISKFS_SB(sb);
                  struct buffer_head *bh = NULL;
                  ldiskfs_fsblk_t bitmap_blk;
                  int err;        desc = ldiskfs_get_group_desc(sb, block_group, NULL);
                  if (!desc)
                          return ERR_PTR(-EFSCORRUPTED);
          ...
                          return ERR_PTR(-EIO);
           {noformat}
          and so on.

          this is not the case in centos7, but on rhel8 is already affected
          green Oleg Drokin created issue -

          People

            adilger Andreas Dilger
            green Oleg Drokin
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: