]> git.proxmox.com Git - mirror_ubuntu-kernels.git/blobdiff - kernel/locking/lockdep.c
lockdep: fix static memory detection even more
[mirror_ubuntu-kernels.git] / kernel / locking / lockdep.c
index 111607d91489caa3232bf8620a394b5794530d56..e85b5ad3e206987c1a4d82e81f0386627b01b81e 100644 (file)
@@ -819,34 +819,26 @@ static int very_verbose(struct lock_class *class)
  * Is this the address of a static object:
  */
 #ifdef __KERNEL__
-/*
- * Check if an address is part of freed initmem. After initmem is freed,
- * memory can be allocated from it, and such allocations would then have
- * addresses within the range [_stext, _end].
- */
-#ifndef arch_is_kernel_initmem_freed
-static int arch_is_kernel_initmem_freed(unsigned long addr)
-{
-       if (system_state < SYSTEM_FREEING_INITMEM)
-               return 0;
-
-       return init_section_contains((void *)addr, 1);
-}
-#endif
-
 static int static_obj(const void *obj)
 {
-       unsigned long start = (unsigned long) &_stext,
-                     end   = (unsigned long) &_end,
-                     addr  = (unsigned long) obj;
+       unsigned long addr = (unsigned long) obj;
 
-       if (arch_is_kernel_initmem_freed(addr))
-               return 0;
+       if (is_kernel_core_data(addr))
+               return 1;
+
+       /*
+        * keys are allowed in the __ro_after_init section.
+        */
+       if (is_kernel_rodata(addr))
+               return 1;
 
        /*
-        * static variable?
+        * in initdata section and used during bootup only?
+        * NOTE: On some platforms the initdata section is
+        * outside of the _stext ... _end range.
         */
-       if ((addr >= start) && (addr < end))
+       if (system_state < SYSTEM_FREEING_INITMEM &&
+               init_section_contains((void *)addr, 1))
                return 1;
 
        /*