On Tue, 28 Sep 2021 09:15:35 +0200 Christophe Leroy <christophe.le...@csgroup.eu> wrote:
> Commit 7a5da02de8d6 ("locking/lockdep: check for freed initmem in > static_obj()") added arch_is_kernel_initmem_freed() which is supposed > to report whether an object is part of already freed init memory. > > For the time being, the generic version of arch_is_kernel_initmem_freed() > always reports 'false', allthough free_initmem() is generically called > on all architectures. > > Therefore, change the generic version of arch_is_kernel_initmem_freed() > to check whether free_initmem() has been called. If so, then check > if a given address falls into init memory. > > In order to use function init_section_contains(), the fonction is > moved at the end of asm-generic/section.h i386 allmodconfig: In file included from arch/x86/platform/intel-quark/imr.c:28: ./include/asm-generic/sections.h: In function 'arch_is_kernel_initmem_freed': ./include/asm-generic/sections.h:171:6: error: 'system_state' undeclared (first use in this function) 171 | if (system_state < SYSTEM_FREEING_INITMEM) | ^~~~~~~~~~~~ ./include/asm-generic/sections.h:171:6: note: each undeclared identifier is reported only once for each function it appears in ./include/asm-generic/sections.h:171:21: error: 'SYSTEM_FREEING_INITMEM' undeclared (first use in this function) 171 | if (system_state < SYSTEM_FREEING_INITMEM) | ^~~~~~~~~~~~~~~~~~~~~~ I don't think it would be a good idea to include kernel.h from sections.h - it's unclear to me which is the "innermost" of those two. It would be better to uninline arch_is_kernel_initmem_freed(). Surely there's no real reason for inlining it? Anyway, I'll drop the series for now.