diff options
author | Josh Poimboeuf <jpoimboe@redhat.com> | 2020-02-10 12:32:40 -0600 |
---|---|---|
committer | Borislav Petkov <bp@suse.de> | 2020-02-11 13:39:52 +0100 |
commit | dc4197236c20e761f2007c641afd193f81a00a74 (patch) | |
tree | f1cbb0b2024c73a6faba15a7d000b47b1d1ea8f1 /tools/objtool/elf.h | |
parent | a22961409c02b93ffa7ed78f67fb57a1ba6c787d (diff) |
objtool: Add relocation check for alternative sections
Relocations in alternative code can be dangerous, because the code is
copy/pasted to the text section after relocations have been resolved,
which can corrupt PC-relative addresses.
However, relocations might be acceptable in some cases, depending on the
architecture. For example, the x86 alternatives code manually fixes up
the target addresses for PC-relative jumps and calls.
So disallow relocations in alternative code, except where the x86 arch
code allows it.
This code may need to be tweaked for other arches when objtool gets
support for them.
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Julien Thierry <jthierry@redhat.com>
Link: https://lkml.kernel.org/r/7b90b68d093311e4e8f6b504a9e1c758fd7e0002.1581359535.git.jpoimboe@redhat.com
Diffstat (limited to 'tools/objtool/elf.h')
0 files changed, 0 insertions, 0 deletions