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

obdclass: uninitialized remainder in percent size parsing

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Medium Medium
    • None
    • Lustre 2.17.0
    • 3
    • 9223372036854775807

      Problem

      sysfs_memparse_total() can return a wrong size for a percentage with a zero integer part, such as 0%, 0.5% or .5%. The result depends on stack contents.

      Cause

      scale64_rem() returns early for a zero base and does not set *remp. __string_to_size() then adds this uninitialized remainder before it divides by 100.

      Commit f62e51414712 (LU-18163, review 56334) added this caller. It is in master since 2.16.51 and in 2.17.0.

      Impact

      • llite max_read_ahead_mb, max_read_ahead_per_file_mb, max_read_ahead_whole_mb and max_cached_mb, and lod dom_threshold_free_mb, accept these percentages.
      • obd_init_checks() parses 0%, 0.5% and .5% when obdclass loads. A stale value of 100 or more fails a check, and obdclass does not load.

      Fix

      Set *remp to zero on the zero-base return. The existing obd_init_checks() cases cover these inputs. A new test cannot force the stale value.

      Found while adding percentage support to client_jobstats_max_memory (LU-21060).

            akrause_nvda Andreas Krause
            akrause_nvda Andreas Krause
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: