• Helge Deller's avatar
    lockdep: fix static memory detection even more · 0a6b58c5
    Helge Deller authored
    On the parisc architecture, lockdep reports for all static objects which
    are in the __initdata section (e.g. "setup_done" in devtmpfs,
    "kthreadd_done" in init/main.c) this warning:
    
    	INFO: trying to register non-static key.
    
    The warning itself is wrong, because those objects are in the __initdata
    section, but the section itself is on parisc outside of range from
    _stext to _end, which is why the static_obj() functions returns a wrong
    answer.
    
    While fixing this issue, I noticed that the whole existing check can
    be simplified a lot.
    Instead of checking against the _stext and _end symbols (which include
    code areas too) just check for the .data and .bss segments (since we check a
    data object). This can be done with the existing is_kernel_core_data()
    macro.
    
    In addition objects in the __initdata section can be checked with
    init_section_contains(), and is_kernel_rodata() allows keys to be in the
    _ro_after_init section.
    
    This partly reverts and simplifies commit bac59d18 ("x86/setup: Fix static
    memory detection").
    
    Link: https://lkml.kernel.org/r/ZNqrLRaOi/3wPAdp@p100
    Fixes: bac59d18 ("x86/setup: Fix static memory detection")
    Signed-off-by: default avatarHelge Deller <deller@gmx.de>
    Cc: Borislav Petkov <bp@suse.de>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Cc: Guenter Roeck <linux@roeck-us.net>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: "Rafael J. Wysocki" <rafael@kernel.org>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    0a6b58c5
lockdep.c 171 KB