Re: [PATCH 2.6.17-rc6 7/9] Remove some of the kmemleak false positives



On 13/06/06, Pekka J Enberg <penberg@xxxxxxxxxxxxxx> wrote:
Hi Catalin,

On Tue, 13 Jun 2006, Catalin Marinas wrote:
> The gc roots are the data and bss sections (and maybe task kernel
> stacks) and all the slab-allocated blocks are scanned if a link to
> them is found from the roots (and all of them are usually scanned). If
> no link is found, they would be reported as memory leaks (and not
> scanned). You can't really avoid the scanning of allocated blocks
> since they may contain pointers to other blocks.

I am not sure you're agreeing or disagreeing :-).

I'm not sure either :-). Doing some quick statistics on an ARM
platform shows that there are plenty of values (almost 15%) in the
scanned memory that look like pointers (i.e. between 3GB and
3GB+128MB) but do not point to any allocated block:

total scanned values = 932102
total detected pointers = 6270
detected by alias (i.e. in-block address) = 2096
looking like pointer = 135675

I'll add a test to see how many of the look-like pointers actually
point to a valid in-block address. If this is considerable larger than
the detected by alias above, it shouldn't be implemented.

As far as I understood, Ingo is worried about:

struct s { /* some fields */; char *buf; };

struct s *p = kmalloc(sizeof(struct s) + BUF_SIZE);
p->buf = p + sizeof(struct s);

Which could lead to false negative due to p->buf pointing to p. However,
for us to even _find_ p->buf, we would need an incoming pointer _to_ p
which makes me think this is not a problem in practice. Hmm?

Not exactly. In the above case, Ingo (and me) is worried about having
a incoming pointer (from other block) equal to p->buf and therefore
inside the block allocated with kmalloc. It doesn't matter whether any
value in a block point to locations inside the block since the actual
block first needs to be accessible on the directed graph starting from
the root.

--
Catalin
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: Brackets in C#
    ... as root references, what prevents the GC from collection local ... Stack - References are only considered as Roots when they are accessed after ... any local variable/parameter object pointers on a thread's ...
    (microsoft.public.dotnet.framework.clr)
  • Re: C#/.NET potential newbie qustions
    ... I couldn't get the concept of pointers so I gave up! ... Bear in mind that C# has its roots more in Java than C, I took a while to appreciate that but it explains, e.g., the lack of #include which would be a very useful addition. ...
    (microsoft.public.dotnet.languages.csharp)
  • answer check relating to complex numbers
    ... Q)Find a polynominal in z with real coefficients whose roots are 5+7i ... Is that the correct answer if not any pointers would be much ... Prev by Date: ...
    (sci.math)
  • Re: Batch malloc
    ... and returns an array of pointers to allocated blocks. ... For example (assuming an array notation ... Assuming you have malloc/free source already and are willing ...
    (comp.programming)