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

Integer overflow in LL_IOC_HSM_REQUEST handler

Details

    • Bug
    • Resolution: Fixed
    • Critical
    • Lustre 2.6.0
    • Lustre 2.5.0, Lustre 2.6.0
    • 3
    • 13804

    Description

      There's an integer overflow in LL_IOC_HSM_REQUEST handler

              case LL_IOC_HSM_REQUEST: {
                      struct hsm_user_request *hur;
                      int                      totalsize;
      
                      OBD_ALLOC_PTR(hur);
                      if (hur == NULL)
                              RETURN(-ENOMEM);
      
                      /* We don't know the true size yet; copy the fixed-size part */
                      if (copy_from_user(hur, (void *)arg, sizeof(*hur))) {
                              OBD_FREE_PTR(hur);
                              RETURN(-EFAULT);
                      }
      
                      /* Compute the whole struct size */
                      totalsize = hur_len(hur);
                      OBD_FREE_PTR(hur);
      
                      /* Make sure the size is reasonable */
                      if (totalsize >= MDS_MAXREQSIZE)
                              RETURN(-E2BIG);
      

      Instead of checking totalsize which is past multiplication and is subject to overflow already, what we must do is we must ensure hur->hur_request.hr_itemcount is safe first.
      Then it's safe to call hur_len

      Attachments

        Issue Links

          Activity

            [LU-4984] Integer overflow in LL_IOC_HSM_REQUEST handler
            green Oleg Drokin added a comment -

            The leak is in a short-lived lfs tool, not any sort of a library that can for extended periods of time, so I don't see this is a very important leak (still a bug, of course).

            Please open a separate ticket about it so that it's not forgotten.

            green Oleg Drokin added a comment - The leak is in a short-lived lfs tool, not any sort of a library that can for extended periods of time, so I don't see this is a very important leak (still a bug, of course). Please open a separate ticket about it so that it's not forgotten.

            The committed patch still has the memory leak mentioned here: http://review.whamcloud.com/#/c/10615/5/lustre/utils/lfs.c,cm

            fzago Frank Zago (Inactive) added a comment - The committed patch still has the memory leak mentioned here: http://review.whamcloud.com/#/c/10615/5/lustre/utils/lfs.c,cm
            pjones Peter Jones added a comment -

            Landed for 2.6

            pjones Peter Jones added a comment - Landed for 2.6
            utopiabound Nathaniel Clark added a comment - http://review.whamcloud.com/10615

            John,
            is there any chance you would have time to look at this?

            adilger Andreas Dilger added a comment - John, is there any chance you would have time to look at this?

            John, I suspect we should also annotate some of these fields with __user as well, could you please comment.

            adilger Andreas Dilger added a comment - John, I suspect we should also annotate some of these fields with __user as well, could you please comment.

            James,
            Could you please take this one?
            Thank you!

            jlevi Jodi Levi (Inactive) added a comment - James, Could you please take this one? Thank you!

            People

              utopiabound Nathaniel Clark
              green Oleg Drokin
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: