The patch titled Subject: sections: move and rename core_kernel_data() to is_kernel_core_data() has been added to the -mm tree. Its filename is sections-move-and-rename-core_kernel_data-to-is_kernel_core_data.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/sections-move-and-rename-core_kernel_data-to-is_kernel_core_data.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/sections-move-and-rename-core_kernel_data-to-is_kernel_core_data.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Kefeng Wang <wangkefeng.wang@xxxxxxxxxx> Subject: sections: move and rename core_kernel_data() to is_kernel_core_data() Move core_kernel_data() into sections.h and rename it to is_kernel_core_data(), also make it return bool value, then update all the callers. Link: https://lkml.kernel.org/r/20210930071143.63410-4-wangkefeng.wang@xxxxxxxxxx Signed-off-by: Kefeng Wang <wangkefeng.wang@xxxxxxxxxx> Cc: Arnd Bergmann <arnd@xxxxxxxx> Cc: Steven Rostedt <rostedt@xxxxxxxxxxx> Cc: Ingo Molnar <mingo@xxxxxxxxxx> Cc: "David S. Miller" <davem@xxxxxxxxxxxxx> Cc: Alexander Potapenko <glider@xxxxxxxxxx> Cc: Alexei Starovoitov <ast@xxxxxxxxxx> Cc: Andrey Konovalov <andreyknvl@xxxxxxxxx> Cc: Andrey Ryabinin <ryabinin.a.a@xxxxxxxxx> Cc: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx> Cc: Borislav Petkov <bp@xxxxxxxxx> Cc: Christophe Leroy <christophe.leroy@xxxxxxxxxx> Cc: Dmitry Vyukov <dvyukov@xxxxxxxxxx> Cc: Ivan Kokshaysky <ink@xxxxxxxxxxxxxxxxxxxx> Cc: Matt Turner <mattst88@xxxxxxxxx> Cc: Michael Ellerman <mpe@xxxxxxxxxxxxxx> Cc: Michal Simek <monstr@xxxxxxxxx> Cc: Paul Mackerras <paulus@xxxxxxxxx> Cc: Petr Mladek <pmladek@xxxxxxxx> Cc: Richard Henderson <rth@xxxxxxxxxxx> Cc: Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/asm-generic/sections.h | 16 ++++++++++++++++ include/linux/kernel.h | 1 - kernel/extable.c | 18 ------------------ kernel/trace/ftrace.c | 2 +- net/sysctl_net.c | 2 +- 5 files changed, 18 insertions(+), 21 deletions(-) --- a/include/asm-generic/sections.h~sections-move-and-rename-core_kernel_data-to-is_kernel_core_data +++ a/include/asm-generic/sections.h @@ -129,6 +129,22 @@ static inline bool init_section_intersec } /** + * is_kernel_core_data - checks if the pointer address is located in the + * .data section + * + * @addr: address to check + * + * Returns: true if the address is located in .data, false otherwise. + * Note: On some archs it may return true for core RODATA, and false + * for others. But will always be true for core RW data. + */ +static inline bool is_kernel_core_data(unsigned long addr) +{ + return addr >= (unsigned long)_sdata && + addr < (unsigned long)_edata; +} + +/** * is_kernel_rodata - checks if the pointer address is located in the * .rodata section * --- a/include/linux/kernel.h~sections-move-and-rename-core_kernel_data-to-is_kernel_core_data +++ a/include/linux/kernel.h @@ -230,7 +230,6 @@ extern char *next_arg(char *args, char * extern int core_kernel_text(unsigned long addr); extern int init_kernel_text(unsigned long addr); -extern int core_kernel_data(unsigned long addr); extern int __kernel_text_address(unsigned long addr); extern int kernel_text_address(unsigned long addr); extern int func_ptr_is_kernel_text(void *ptr); --- a/kernel/extable.c~sections-move-and-rename-core_kernel_data-to-is_kernel_core_data +++ a/kernel/extable.c @@ -82,24 +82,6 @@ int notrace core_kernel_text(unsigned lo return 0; } -/** - * core_kernel_data - tell if addr points to kernel data - * @addr: address to test - * - * Returns true if @addr passed in is from the core kernel data - * section. - * - * Note: On some archs it may return true for core RODATA, and false - * for others. But will always be true for core RW data. - */ -int core_kernel_data(unsigned long addr) -{ - if (addr >= (unsigned long)_sdata && - addr < (unsigned long)_edata) - return 1; - return 0; -} - int __kernel_text_address(unsigned long addr) { if (kernel_text_address(addr)) --- a/kernel/trace/ftrace.c~sections-move-and-rename-core_kernel_data-to-is_kernel_core_data +++ a/kernel/trace/ftrace.c @@ -323,7 +323,7 @@ int __register_ftrace_function(struct ft if (!ftrace_enabled && (ops->flags & FTRACE_OPS_FL_PERMANENT)) return -EBUSY; - if (!core_kernel_data((unsigned long)ops)) + if (!is_kernel_core_data((unsigned long)ops)) ops->flags |= FTRACE_OPS_FL_DYNAMIC; add_ftrace_ops(&ftrace_ops_list, ops); --- a/net/sysctl_net.c~sections-move-and-rename-core_kernel_data-to-is_kernel_core_data +++ a/net/sysctl_net.c @@ -144,7 +144,7 @@ static void ensure_safe_net_sysctl(struc addr = (unsigned long)ent->data; if (is_module_address(addr)) where = "module"; - else if (core_kernel_data(addr)) + else if (is_kernel_core_data(addr)) where = "kernel"; else continue; _ Patches currently in -mm which might be from wangkefeng.wang@xxxxxxxxxx are slub-add-back-check-for-free-nonslab-objects.patch mm-nommu-kill-arch_get_unmapped_area.patch kallsyms-remove-arch-specific-text-and-data-check.patch kallsyms-fix-address-checks-for-kernel-related-range.patch sections-move-and-rename-core_kernel_data-to-is_kernel_core_data.patch sections-move-is_kernel_inittext-into-sectionsh.patch x86-mm-rename-__is_kernel_text-to-is_x86_32_kernel_text.patch sections-provide-internal-__is_kernel-and-__is_kernel_text-helper.patch mm-kasan-use-is_kernel-helper.patch extable-use-is_kernel_text-helper.patch powerpc-mm-use-core_kernel_text-helper.patch microblaze-use-is_kernel_text-helper.patch alpha-use-is_kernel_text-helper.patch