aboutsummaryrefslogtreecommitdiff
path: root/tools/objtool/builtin-check.c
diff options
context:
space:
mode:
authorGravatar Peter Zijlstra <peterz@infradead.org> 2022-03-08 16:30:54 +0100
committerGravatar Peter Zijlstra <peterz@infradead.org> 2022-03-15 10:32:46 +0100
commit08f87a93c8ec709698edba66a5167077181fc978 (patch)
treec661600616cc6d3ffc329ed3fbdf30fcc05dc946 /tools/objtool/builtin-check.c
parentobjtool: Add IBT/ENDBR decoding (diff)
downloadlinux-08f87a93c8ec709698edba66a5167077181fc978.tar.gz
linux-08f87a93c8ec709698edba66a5167077181fc978.tar.bz2
linux-08f87a93c8ec709698edba66a5167077181fc978.zip
objtool: Validate IBT assumptions
Intel IBT requires that every indirect JMP/CALL targets an ENDBR instructions, failing this #CP happens and we die. Similarly, all exception entries should be ENDBR. Find all code relocations and ensure they're either an ENDBR instruction or ANNOTATE_NOENDBR. For the exceptions look for UNWIND_HINT_IRET_REGS at sym+0 not being ENDBR. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Josh Poimboeuf <jpoimboe@redhat.com> Link: https://lore.kernel.org/r/20220308154319.705110141@infradead.org
Diffstat (limited to 'tools/objtool/builtin-check.c')
-rw-r--r--tools/objtool/builtin-check.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c
index 5c2fcaa2c260..fc6975ab8b06 100644
--- a/tools/objtool/builtin-check.c
+++ b/tools/objtool/builtin-check.c
@@ -20,7 +20,8 @@
#include <objtool/objtool.h>
bool no_fp, no_unreachable, retpoline, module, backtrace, uaccess, stats,
- lto, vmlinux, mcount, noinstr, backup, sls, dryrun;
+ lto, vmlinux, mcount, noinstr, backup, sls, dryrun,
+ ibt;
static const char * const check_usage[] = {
"objtool check [<options>] file.o",
@@ -47,6 +48,7 @@ const struct option check_options[] = {
OPT_BOOLEAN('B', "backup", &backup, "create .orig files before modification"),
OPT_BOOLEAN('S', "sls", &sls, "validate straight-line-speculation"),
OPT_BOOLEAN(0, "dry-run", &dryrun, "don't write the modifications"),
+ OPT_BOOLEAN(0, "ibt", &ibt, "validate ENDBR placement"),
OPT_END(),
};