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

From: Patrick Wang
Date: Sat Jun 25 2022 - 02:38:40 EST




On 2022/6/23 19:25, 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

Hi Yee,

Thanks for your information. Similar situation appears in
percpu.c (address allocated with memblock, object freed with
kmemleak_free(), if I didn't miss others). Kmemleak_ignore_phys()
could replace kmemleak_free() for physical objects like Catalin said.
And adding kmemleak_free_phys() might not be essential, because
there are few places that meet the above situation.

Thanks,
Patrick