(catching up with emails) On Wed, 11 Jul 2018 at 00:40, Benjamin Herrenschmidt <b...@kernel.crashing.org> wrote: > On Tue, 2018-07-10 at 17:17 +0200, Paul Menzel wrote: > > On a the IBM S822LC (8335-GTA) with Ubuntu 18.04 I built Linux master > > – 4.18-rc4+, commit 092150a2 (Merge branch 'for-linus' > > of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid) – with > > kmemleak. Several issues are found. > > Some of these are completely uninteresting though and look like > kmemleak bugs to me :-) > > > [<00000000bc285bbf>] __pud_alloc+0x80/0x270 > > [<0000000007135d64>] hash__map_kernel_page+0x30c/0x4d0 > > [<0000000071677858>] __ioremap_at+0x108/0x140 > > [<000000000023e921>] __ioremap_caller+0x130/0x180 > > [<000000009dbc3923>] icp_native_init_one_node+0x5cc/0x760 > > [<0000000015f3168a>] icp_native_init+0x70/0x13c > > [<00000000655550ed>] xics_init+0x38/0x1ac > > [<0000000088dbf9d1>] pnv_init_IRQ+0x30/0x5c > > This is the interrupt controller mapping its registers, why on earth > would that be considered a leak ? kmemleak needs to learn to ignore > kernel page tables allocations.
Indeed, that's just a false positive for powerpc. Kmemleak ignores page allocations and most architectures use __get_free_pages() for the page table. In this particular case, the powerpc code uses kmem_cache_alloc() and that's tracked by kmemleak. Since the pgd stores the __pa(pud), kmemleak doesn't detect this pointer and reports it as a leak. To work around this, you can pass SLAB_NOLEAKTRACE to kmem_cache_create() in pgtable_cache_add() (arch/powerpc/mm/init-common.c). -- Catalin