]> git.baikalelectronics.ru Git - kernel.git/commitdiff
kallsyms: remove arch specific text and data check
authorKefeng Wang <wangkefeng.wang@huawei.com>
Tue, 9 Nov 2021 02:33:43 +0000 (18:33 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 9 Nov 2021 18:02:50 +0000 (10:02 -0800)
Patch series "sections: Unify kernel sections range check and use", v4.

There are three head files(kallsyms.h, kernel.h and sections.h) which
include the kernel sections range check, let's make some cleanup and unify
them.

1. cleanup arch specific text/data check and fix address boundary check
   in kallsyms.h

2. make all the basic/core kernel range check function into sections.h

3. update all the callers, and use the helper in sections.h to simplify
   the code

After this series, we have 5 APIs about kernel sections range check in
sections.h

 * is_kernel_rodata() --- already in sections.h
 * is_kernel_core_data() --- come from core_kernel_data() in kernel.h
 * is_kernel_inittext() --- come from kernel.h and kallsyms.h
 * __is_kernel_text() --- add new internal helper
 * __is_kernel() --- add new internal helper

Note: For the last two helpers, people should not use directly, consider to
      use corresponding function in kallsyms.h.

This patch (of 11):

Remove arch specific text and data check after commit 1f631485121d ("arch:
remove blackfin port"), no need arch-specific text/data check.

Link: https://lkml.kernel.org/r/20210930071143.63410-1-wangkefeng.wang@huawei.com
Link: https://lkml.kernel.org/r/20210930071143.63410-2-wangkefeng.wang@huawei.com
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Andrey Konovalov <andreyknvl@gmail.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/asm-generic/sections.h
include/linux/kallsyms.h
kernel/locking/lockdep.c

index 596ab20922892046de8d38fd8db83dab68ce4aba..614fc809de34cc9aab55a950c389b45edd4e366e 100644 (file)
@@ -64,22 +64,6 @@ extern __visible const void __nosave_begin, __nosave_end;
 #define dereference_kernel_function_descriptor(p) ((void *)(p))
 #endif
 
-/* random extra sections (if any).  Override
- * in asm/sections.h */
-#ifndef arch_is_kernel_text
-static inline int arch_is_kernel_text(unsigned long addr)
-{
-       return 0;
-}
-#endif
-
-#ifndef arch_is_kernel_data
-static inline int arch_is_kernel_data(unsigned long addr)
-{
-       return 0;
-}
-#endif
-
 /**
  * memory_contains - checks if an object is contained within a memory region
  * @begin: virtual address of the beginning of the memory region
index a1d6fc82d7f0649884f7a098870dd7fdb07f09a1..bac34097267084d05d55fe827d59368dc8f7ed98 100644 (file)
@@ -34,8 +34,7 @@ static inline int is_kernel_inittext(unsigned long addr)
 
 static inline int is_kernel_text(unsigned long addr)
 {
-       if ((addr >= (unsigned long)_stext && addr <= (unsigned long)_etext) ||
-           arch_is_kernel_text(addr))
+       if ((addr >= (unsigned long)_stext && addr <= (unsigned long)_etext))
                return 1;
        return in_gate_area_no_mm(addr);
 }
index 8e118caf835e0f5066f951c5218cdd1ac634d007..f2d3bf4960f46f43f1179c3f5b7018b8c12181f5 100644 (file)
@@ -818,9 +818,6 @@ static int static_obj(const void *obj)
        if ((addr >= start) && (addr < end))
                return 1;
 
-       if (arch_is_kernel_data(addr))
-               return 1;
-
        /*
         * in-kernel percpu var?
         */