summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-07-09 18:58:44 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2017-07-09 18:58:44 +0200
commit19bf2e0ef18ec8a7284ecc83459a2664cb885cd5 (patch)
treecc3e190be6bc774f0640982e3a051551b35b7c8c /tools
parentMerge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/t... (diff)
parentobjtool: Fix sibling call detection logic (diff)
downloadlinux-19bf2e0ef18ec8a7284ecc83459a2664cb885cd5.tar.xz
linux-19bf2e0ef18ec8a7284ecc83459a2664cb885cd5.zip
Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull objtool fix from Thomas Gleixner: "A fix to the objtool sibling call detection logic to distinguish normal jumps inside a function from a real sibling call" * 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: objtool: Fix sibling call detection logic
Diffstat (limited to 'tools')
-rw-r--r--tools/objtool/check.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index fea222192c57..2c6d74880403 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -1371,6 +1371,12 @@ static int validate_branch(struct objtool_file *file, struct instruction *first,
func = insn->func;
+ if (func && insn->ignore) {
+ WARN_FUNC("BUG: why am I validating an ignored function?",
+ sec, insn->offset);
+ return -1;
+ }
+
if (insn->visited) {
if (!!insn_state_match(insn, &state))
return 1;
@@ -1426,16 +1432,19 @@ static int validate_branch(struct objtool_file *file, struct instruction *first,
case INSN_JUMP_CONDITIONAL:
case INSN_JUMP_UNCONDITIONAL:
- if (insn->jump_dest) {
+ if (insn->jump_dest &&
+ (!func || !insn->jump_dest->func ||
+ func == insn->jump_dest->func)) {
ret = validate_branch(file, insn->jump_dest,
state);
if (ret)
return 1;
+
} else if (func && has_modified_stack_frame(&state)) {
WARN_FUNC("sibling call from callable instruction with modified stack frame",
sec, insn->offset);
return 1;
- } /* else it's a sibling call */
+ }
if (insn->type == INSN_JUMP_UNCONDITIONAL)
return 0;