Re: [PATCH] x86/mm/mem_encrypt: fix a crash with kmemleak_scan

From: Borislav Petkov
Date: Thu Apr 18 2019 - 03:45:20 EST

On Tue, Apr 16, 2019 at 08:38:30PM -0400, Qian Cai wrote:
> kmemleak_init() will register the data/bss sections (only register
> .data..ro_after_init if not within .data) and then kmemleak_scan() will scan
> those address and dereference them looking for pointer referencing. If
> free_init_pages() free and unmap pages in those sections, kmemleak_scan() will
> trigger a crash if referencing one of those addresses.
> I checked other x86 free_init_pages() call sites and don't see anything obvious
> where another place to free an address in those sections.

And why is .bss/.data special and why does it need that special handling
by kmemleak?

There must be some rule or a heuristic why kmemleak does that. Is that
documented somewhere?



Good mailing practices for 400: avoid top-posting and trim the reply.