Skip to content

Commit 4ba76bf

Browse files
jpoimboegregkh
authored andcommitted
objtool: Don't use ignore flag for fake jumps
[ Upstream commit e6da956 ] 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 <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Link: http://lkml.kernel.org/r/71abc072ff48b2feccc197723a9c52859476c068.1557766718.git.jpoimboe@redhat.com Signed-off-by: Ingo Molnar <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent ad067e4 commit 4ba76bf

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tools/objtool/check.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
#include <linux/hashtable.h>
2929
#include <linux/kernel.h>
3030

31+
#define FAKE_JUMP_OFFSET -1
32+
3133
struct alternative {
3234
struct list_head list;
3335
struct instruction *insn;
@@ -498,7 +500,7 @@ static int add_jump_destinations(struct objtool_file *file)
498500
insn->type != INSN_JUMP_UNCONDITIONAL)
499501
continue;
500502

501-
if (insn->ignore)
503+
if (insn->ignore || insn->offset == FAKE_JUMP_OFFSET)
502504
continue;
503505

504506
rela = find_rela_by_dest_range(insn->sec, insn->offset,
@@ -645,10 +647,10 @@ static int handle_group_alt(struct objtool_file *file,
645647
clear_insn_state(&fake_jump->state);
646648

647649
fake_jump->sec = special_alt->new_sec;
648-
fake_jump->offset = -1;
650+
fake_jump->offset = FAKE_JUMP_OFFSET;
649651
fake_jump->type = INSN_JUMP_UNCONDITIONAL;
650652
fake_jump->jump_dest = list_next_entry(last_orig_insn, list);
651-
fake_jump->ignore = true;
653+
fake_jump->func = orig_insn->func;
652654
}
653655

654656
if (!special_alt->new_len) {

0 commit comments

Comments
 (0)