Bug 17039 - malloc_info should use chunksize() for normal bins stats too
Summary: malloc_info should use chunksize() for normal bins stats too
Status: NEW
Alias: None
Product: glibc
Classification: Unclassified
Component: malloc (show other bugs)
Version: 2.21
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-08 09:06 UTC by Jipan Yang
Modified: 2014-06-17 17:35 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jipan Yang 2014-06-08 09:06:38 UTC
Fast bin is using  "size_t thissize = chunksize (p);".  
Using r->size directly gives wrong total and avail size data.

       if (r != NULL)
          while (r != bin)
            {
              ++sizes[NFASTBINS - 1 + i].count;
              sizes[NFASTBINS - 1 + i].total += r->size;
              sizes[NFASTBINS - 1 + i].from
                = MIN (sizes[NFASTBINS - 1 + i].from, r->size);
              sizes[NFASTBINS - 1 + i].to = MAX (sizes[NFASTBINS - 1 + i].to,
                                                 r->size);

              r = r->fd;
            }
Comment 1 Jipan Yang 2014-06-08 20:01:59 UTC
Probably it'll be good to have top chunk data shown for each arena. Not sure about last remainder since it is already in the unsorted bin.