mirror of
https://github.com/torvalds/linux.git
synced 2024-11-15 16:41:58 +00:00
6c94f27ac8
Instead of using absolute addresses for both the exception location and the fixup, use offsets relative to the exception table entry values. Not only does this cut the size of the exception table in half, it is also a prerequisite for KASLR, since absolute exception table entries are subject to dynamic relocation, which is incompatible with the sorting of the exception table that occurs at build time. This patch also introduces the _ASM_EXTABLE preprocessor macro (which exists on x86 as well) and its _asm_extable assembly counterpart, as shorthands to emit exception table entries. Acked-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
18 lines
342 B
C
18 lines
342 B
C
/*
|
|
* Based on arch/arm/mm/extable.c
|
|
*/
|
|
|
|
#include <linux/module.h>
|
|
#include <linux/uaccess.h>
|
|
|
|
int fixup_exception(struct pt_regs *regs)
|
|
{
|
|
const struct exception_table_entry *fixup;
|
|
|
|
fixup = search_exception_tables(instruction_pointer(regs));
|
|
if (fixup)
|
|
regs->pc = (unsigned long)&fixup->fixup + fixup->fixup;
|
|
|
|
return fixup != NULL;
|
|
}
|