diff options
| author | Josh Poimboeuf <jpoimboe@redhat.com> | 2019-05-13 13:01:31 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2019-05-13 14:31:17 -0400 |
| commit | e6da9567959e164f82bc81967e0d5b10dee870b4 (patch) | |
| tree | ff37fe29d3446f220a9a8fb5623dccf962670d53 | |
| parent | 82045dd85566d87128dcc66277cf1177d9930a4a (diff) | |
objtool: Don't use ignore flag for fake jumps
The ignore flag is set on fake jumps in order to keep
add_jump_destinations() from setting their jump_dest, since it already
got set when the fake jump was created.
But using the ignore flag is a bit of a hack. It's normally used to
skip validation of an instruction, which doesn't really make sense for
fake jumps.
Also, after the next patch, using the ignore flag for fake jumps can
trigger a false "why am I validating an ignored function?" warning.
Instead just add an explicit check in add_jump_destinations() to skip
fake jumps.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/71abc072ff48b2feccc197723a9c52859476c068.1557766718.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
| -rw-r--r-- | tools/objtool/check.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tools/objtool/check.c b/tools/objtool/check.c index ac743a1d53ab..90226791df6b 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c | |||
| @@ -28,6 +28,8 @@ | |||
| 28 | #include <linux/hashtable.h> | 28 | #include <linux/hashtable.h> |
| 29 | #include <linux/kernel.h> | 29 | #include <linux/kernel.h> |
| 30 | 30 | ||
| 31 | #define FAKE_JUMP_OFFSET -1 | ||
| 32 | |||
| 31 | struct alternative { | 33 | struct alternative { |
| 32 | struct list_head list; | 34 | struct list_head list; |
| 33 | struct instruction *insn; | 35 | struct instruction *insn; |
| @@ -568,7 +570,7 @@ static int add_jump_destinations(struct objtool_file *file) | |||
| 568 | insn->type != INSN_JUMP_UNCONDITIONAL) | 570 | insn->type != INSN_JUMP_UNCONDITIONAL) |
| 569 | continue; | 571 | continue; |
| 570 | 572 | ||
| 571 | if (insn->ignore) | 573 | if (insn->ignore || insn->offset == FAKE_JUMP_OFFSET) |
| 572 | continue; | 574 | continue; |
| 573 | 575 | ||
| 574 | rela = find_rela_by_dest_range(insn->sec, insn->offset, | 576 | rela = find_rela_by_dest_range(insn->sec, insn->offset, |
| @@ -745,10 +747,10 @@ static int handle_group_alt(struct objtool_file *file, | |||
| 745 | clear_insn_state(&fake_jump->state); | 747 | clear_insn_state(&fake_jump->state); |
| 746 | 748 | ||
| 747 | fake_jump->sec = special_alt->new_sec; | 749 | fake_jump->sec = special_alt->new_sec; |
| 748 | fake_jump->offset = -1; | 750 | fake_jump->offset = FAKE_JUMP_OFFSET; |
| 749 | fake_jump->type = INSN_JUMP_UNCONDITIONAL; | 751 | fake_jump->type = INSN_JUMP_UNCONDITIONAL; |
| 750 | fake_jump->jump_dest = list_next_entry(last_orig_insn, list); | 752 | fake_jump->jump_dest = list_next_entry(last_orig_insn, list); |
| 751 | fake_jump->ignore = true; | 753 | fake_jump->func = orig_insn->func; |
| 752 | } | 754 | } |
| 753 | 755 | ||
| 754 | if (!special_alt->new_len) { | 756 | if (!special_alt->new_len) { |
