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

Potential buffer overflow in lfs_setdirstripe

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not a Bug
    • Minor
    • None
    • Lustre 2.11.0
    • None
    • 3
    • 9223372036854775807

    Description

      When we have more than 4000 MDTs, the code in lfs_setdirstripe will break:

                              if (auto_distributed) {
                                      int r;
                                      int nr = MAX(param->lsp_stripe_count,
                                                   lsb->sb_count / 2);
      
                                      /* don't use server whose usage is above 90% */
                                      while (nr != param->lsp_stripe_count &&
                                             obd_statfs_ratio(&lsb->sb_buf[nr].sd_st)
                                             > 90)
                                              nr = MAX(param->lsp_stripe_count,
                                                       nr / 2);
      
                                      /* get \a r between [0, nr) */
                                      r = rand() % nr;
      
                                      param->lsp_stripe_offset =
                                              lsb->sb_buf[r].sd_index;
      

      but lsb->sb_buf is defined as 2000 elements (LL_STATFS_MAX->LOV_MAX_STRIPE_COUNT->2000)

      This was introduced by https://review.whamcloud.com/30598

      Attachments

        Issue Links

          Activity

            People

              wc-triage WC Triage
              green Oleg Drokin
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: