arm64: switch to relative exception tables
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>
This commit is contained in:

committed by
Catalin Marinas

parent
a272858a3c
commit
6c94f27ac8
@@ -16,6 +16,8 @@
|
||||
#ifndef __ASM_WORD_AT_A_TIME_H
|
||||
#define __ASM_WORD_AT_A_TIME_H
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
|
||||
#ifndef __AARCH64EB__
|
||||
|
||||
#include <linux/kernel.h>
|
||||
@@ -81,10 +83,7 @@ static inline unsigned long load_unaligned_zeropad(const void *addr)
|
||||
#endif
|
||||
" b 2b\n"
|
||||
" .popsection\n"
|
||||
" .pushsection __ex_table,\"a\"\n"
|
||||
" .align 3\n"
|
||||
" .quad 1b, 3b\n"
|
||||
" .popsection"
|
||||
_ASM_EXTABLE(1b, 3b)
|
||||
: "=&r" (ret), "=&r" (offset)
|
||||
: "r" (addr), "Q" (*(unsigned long *)addr));
|
||||
|
||||
|
Reference in New Issue
Block a user