Skip to content
This repository was archived by the owner on Feb 9, 2023. It is now read-only.

Commit 9fbcc57

Browse files
jpoimboeingomolnar
authored andcommitted
extable: Make init_kernel_text() global
Convert init_kernel_text() to a global function and use it in a few places instead of manually comparing _sinittext and _einittext. Note that kallsyms.h has a very similar function called is_kernel_inittext(), but its end check is inclusive. I'm not sure whether that's intentional behavior, so I didn't touch it. Suggested-by: Jason Baron <[email protected]> Signed-off-by: Josh Poimboeuf <[email protected]> Acked-by: Peter Zijlstra <[email protected]> Acked-by: Steven Rostedt (VMware) <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Thomas Gleixner <[email protected]> Link: http://lkml.kernel.org/r/4335d02be8d45ca7d265d2f174251d0b7ee6c5fd.1519051220.git.jpoimboe@redhat.com Signed-off-by: Ingo Molnar <[email protected]>
1 parent dc1dd18 commit 9fbcc57

4 files changed

Lines changed: 4 additions & 6 deletions

File tree

arch/x86/kernel/unwind_orc.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include <asm/unwind.h>
66
#include <asm/orc_types.h>
77
#include <asm/orc_lookup.h>
8-
#include <asm/sections.h>
98

109
#define orc_warn(fmt, ...) \
1110
printk_deferred_once(KERN_WARNING pr_fmt("WARNING: " fmt), ##__VA_ARGS__)
@@ -148,7 +147,7 @@ static struct orc_entry *orc_find(unsigned long ip)
148147
}
149148

150149
/* vmlinux .init slow lookup: */
151-
if (ip >= (unsigned long)_sinittext && ip < (unsigned long)_einittext)
150+
if (init_kernel_text(ip))
152151
return __orc_find(__start_orc_unwind_ip, __start_orc_unwind,
153152
__stop_orc_unwind_ip - __start_orc_unwind_ip, ip);
154153

include/linux/kernel.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,7 @@ extern bool parse_option_str(const char *str, const char *option);
472472
extern char *next_arg(char *args, char **param, char **val);
473473

474474
extern int core_kernel_text(unsigned long addr);
475+
extern int init_kernel_text(unsigned long addr);
475476
extern int core_kernel_data(unsigned long addr);
476477
extern int __kernel_text_address(unsigned long addr);
477478
extern int kernel_text_address(unsigned long addr);

kernel/extable.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ const struct exception_table_entry *search_exception_tables(unsigned long addr)
6464
return e;
6565
}
6666

67-
static inline int init_kernel_text(unsigned long addr)
67+
int init_kernel_text(unsigned long addr)
6868
{
6969
if (addr >= (unsigned long)_sinittext &&
7070
addr < (unsigned long)_einittext)

kernel/jump_label.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include <linux/jump_label_ratelimit.h>
1717
#include <linux/bug.h>
1818
#include <linux/cpu.h>
19-
#include <asm/sections.h>
2019

2120
#ifdef HAVE_JUMP_LABEL
2221

@@ -429,8 +428,7 @@ void __init jump_label_invalidate_init(void)
429428
struct jump_entry *iter;
430429

431430
for (iter = iter_start; iter < iter_stop; iter++) {
432-
if (iter->code >= (unsigned long)_sinittext &&
433-
iter->code < (unsigned long)_einittext)
431+
if (init_kernel_text(iter->code))
434432
iter->code = 0;
435433
}
436434
}

0 commit comments

Comments
 (0)