Re: [PATCH v4 3/4] mm: kmemleak: add rbtree and store physical address for objects allocated with PA

From: Catalin Marinas
Date: Fri Jun 24 2022 - 06:18:56 EST


On Thu, Jun 23, 2022 at 07:25:15PM +0800, Yee Lee wrote:
> On Thu, 2022-06-23 at 16:45 +0800, Yee Lee wrote:
> > Now we have seperated rb_tree for phys and virts addresses. But why
> > can't we have kmemleak_free_phys()? It may apply the same format to
> > delete_object_full().
> >
> > Some users would request to remove the kmemleak object from the phys
> > tree but we don't have this one.
>
> Please check this, an issue happened at kfence with the latest kmemleak
> patches. kfence pool allocated memory from memblock but have no way to
> free it from the phys tree.
> https://lkml.org/lkml/2022/6/23/486

I don't think I was cc'ed on the other thread but at a quick look, what
you probably want is:

kmemleak_ignore_phys(__kfence_pool);

instead of the current kmemleak_free(). With Patrick's changes, you can
no longer tell kmemleak about an object with a physical address and free
it with the virtual one.

--
Catalin