Skip to content

Commit

Permalink
extable: Add function to search only kernel exception table
Browse files Browse the repository at this point in the history
Certain architecture specific operating modes (e.g., in powerpc machine
check handler that is unable to access vmalloc memory), the
search_exception_tables cannot be called because it also searches the
module exception tables if entry is not found in the kernel exception
table.

Signed-off-by: Santosh Sivaraj <santosh@fossix.org>
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20190820081352.8641-5-santosh@fossix.org
  • Loading branch information
Santosh Sivaraj authored and Michael Ellerman committed Aug 21, 2019
1 parent 1a1715f commit 49ec917
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions include/linux/extable.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ void trim_init_extable(struct module *m);

/* Given an address, look for it in the exception tables */
const struct exception_table_entry *search_exception_tables(unsigned long add);
const struct exception_table_entry *
search_kernel_exception_table(unsigned long addr);

#ifdef CONFIG_MODULES
/* For extable.c to search modules' exception tables. */
Expand Down
11 changes: 9 additions & 2 deletions kernel/extable.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,20 @@ void __init sort_main_extable(void)
}
}

/* Given an address, look for it in the kernel exception table */
const
struct exception_table_entry *search_kernel_exception_table(unsigned long addr)
{
return search_extable(__start___ex_table,
__stop___ex_table - __start___ex_table, addr);
}

/* Given an address, look for it in the exception tables. */
const struct exception_table_entry *search_exception_tables(unsigned long addr)
{
const struct exception_table_entry *e;

e = search_extable(__start___ex_table,
__stop___ex_table - __start___ex_table, addr);
e = search_kernel_exception_table(addr);
if (!e)
e = search_module_extables(addr);
return e;
Expand Down

0 comments on commit 49ec917

Please sign in to comment.