On Wed, Oct 18, 2023 at 09:23:49AM +0900, Masato Asou wrote:
> Hello tech@ and otto,
>
> Why do only some calling functions store the pinttes in region_info as
> below:
>
> static void *
> malloc_bytes(struct dir_info *d, size_t size, void *f)
> {
> </snip>
> found:
> if (i == 0 && k == 0 && DO_STATS) {
> struct region_info *r = find(d, bp->page);
> STATS_SETF(r, f);
> }
>
> I found following mail from otto:
> https://marc.info/?l=openbsd-tech&m=168171382927798&w=2
> > The null "f" values (call sites) are due to the sampling nature of
> > small allocations. Recording all call sites of all potential leaks
> > introduces too much overhead.
>
> Is this the answer to my question?
> --
> ASOU Masato
Yes.
The reason is that (in the existing code) there's only one pointer per
region_info available to store callers. So for a chunk page (which has
many small alocations) ony slot 0 gets recorded.
But there's a diff I posted last week on tech@ that will change this
so that all call sites are recorded (in a different location and only
if D is used). It will also report more details when a write of a free
chunk is detected. That diff could use some review/testing.
-Otto