]> git.baikalelectronics.ru Git - kernel.git/commit
objtool: Add relocation check for alternative sections
authorJosh Poimboeuf <jpoimboe@redhat.com>
Mon, 10 Feb 2020 18:32:40 +0000 (12:32 -0600)
committerBorislav Petkov <bp@suse.de>
Tue, 11 Feb 2020 12:39:52 +0000 (13:39 +0100)
commita5bd4ef97853580828d3cff5fa730bed4e190e10
treef1cbb0b2024c73a6faba15a7d000b47b1d1ea8f1
parent5614106124b581df31afd2c1509d3ac75ef00f84
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
tools/objtool/check.c