Menu

#2749 gatherer buffer size exceeded on file read in metric plugin

Function
pending
None
gather
5
2015-08-21
2015-08-20
Dave Heller
No

Discussion

  • Dave Heller

    Dave Heller - 2015-08-20

    Some metric plugin functions read data from /proc/stat, and on systems with many cpus this file can exceed the size (30kB) of the buffer allocated to handle it. This isn't exactly a buffer overrun since the fread() is coded to not exceed the buffer size. What happens is, the read is truncated, and if the data we're looking for is in the truncated part it will cause a bug.

    There are several functions affect, all in metricOperatingSystem.c. There are also functions that access this file in metricProcessor.c and metricUnixProcess.c but in one case the buffer is already big enough and in the other only the first line of the file is read, so these don't need to be touched.

    I don't really like the idea of increasing the buffer size here (these functions could use a more efficient algorithm that doesn't require such a large buffer). But since it's stack space at least it won't accumulate, and will only increase the memory footprint during the data collection cycle.

     
  • Dave Heller

    Dave Heller - 2015-08-21

    Commit [62137d] for gather 2.2

     

    Related

    Commit: [62137d]

  • Dave Heller

    Dave Heller - 2015-08-21
    • status: open --> pending
     

Log in to post a comment.