]>
Commit | Line | Data |
---|---|---|
d50b8c78 SL |
1 | From fb905e7fa732b1df131bebbe01194ae6c0469cbd Mon Sep 17 00:00:00 2001 |
2 | From: Josh Poimboeuf <jpoimboe@redhat.com> | |
3 | Date: Mon, 13 May 2019 12:01:31 -0500 | |
4 | Subject: objtool: Don't use ignore flag for fake jumps | |
5 | ||
6 | [ Upstream commit e6da9567959e164f82bc81967e0d5b10dee870b4 ] | |
7 | ||
8 | The ignore flag is set on fake jumps in order to keep | |
9 | add_jump_destinations() from setting their jump_dest, since it already | |
10 | got set when the fake jump was created. | |
11 | ||
12 | But using the ignore flag is a bit of a hack. It's normally used to | |
13 | skip validation of an instruction, which doesn't really make sense for | |
14 | fake jumps. | |
15 | ||
16 | Also, after the next patch, using the ignore flag for fake jumps can | |
17 | trigger a false "why am I validating an ignored function?" warning. | |
18 | ||
19 | Instead just add an explicit check in add_jump_destinations() to skip | |
20 | fake jumps. | |
21 | ||
22 | Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> | |
23 | Cc: Linus Torvalds <torvalds@linux-foundation.org> | |
24 | Cc: Peter Zijlstra <peterz@infradead.org> | |
25 | Cc: Thomas Gleixner <tglx@linutronix.de> | |
26 | Link: http://lkml.kernel.org/r/71abc072ff48b2feccc197723a9c52859476c068.1557766718.git.jpoimboe@redhat.com | |
27 | Signed-off-by: Ingo Molnar <mingo@kernel.org> | |
28 | Signed-off-by: Sasha Levin <sashal@kernel.org> | |
29 | --- | |
30 | tools/objtool/check.c | 8 +++++--- | |
31 | 1 file changed, 5 insertions(+), 3 deletions(-) | |
32 | ||
33 | diff --git a/tools/objtool/check.c b/tools/objtool/check.c | |
34 | index 2cd57730381b..ecf5fc77f50b 100644 | |
35 | --- a/tools/objtool/check.c | |
36 | +++ b/tools/objtool/check.c | |
37 | @@ -28,6 +28,8 @@ | |
38 | #include <linux/hashtable.h> | |
39 | #include <linux/kernel.h> | |
40 | ||
41 | +#define FAKE_JUMP_OFFSET -1 | |
42 | + | |
43 | struct alternative { | |
44 | struct list_head list; | |
45 | struct instruction *insn; | |
46 | @@ -501,7 +503,7 @@ static int add_jump_destinations(struct objtool_file *file) | |
47 | insn->type != INSN_JUMP_UNCONDITIONAL) | |
48 | continue; | |
49 | ||
50 | - if (insn->ignore) | |
51 | + if (insn->ignore || insn->offset == FAKE_JUMP_OFFSET) | |
52 | continue; | |
53 | ||
54 | rela = find_rela_by_dest_range(insn->sec, insn->offset, | |
55 | @@ -670,10 +672,10 @@ static int handle_group_alt(struct objtool_file *file, | |
56 | clear_insn_state(&fake_jump->state); | |
57 | ||
58 | fake_jump->sec = special_alt->new_sec; | |
59 | - fake_jump->offset = -1; | |
60 | + fake_jump->offset = FAKE_JUMP_OFFSET; | |
61 | fake_jump->type = INSN_JUMP_UNCONDITIONAL; | |
62 | fake_jump->jump_dest = list_next_entry(last_orig_insn, list); | |
63 | - fake_jump->ignore = true; | |
64 | + fake_jump->func = orig_insn->func; | |
65 | } | |
66 | ||
67 | if (!special_alt->new_len) { | |
68 | -- | |
69 | 2.20.1 | |
70 |