diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-07-09 12:58:44 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-07-09 12:58:44 -0400 |
commit | 19bf2e0ef18ec8a7284ecc83459a2664cb885cd5 (patch) | |
tree | cc3e190be6bc774f0640982e3a051551b35b7c8c | |
parent | bc2c6421cbb420677c4bb56adaf434414770ce8a (diff) | |
parent | 4855022a52262411ce38c93dec4cb1470705c0a0 (diff) |
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
-rw-r--r-- | tools/objtool/check.c | 13 |
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, | |||
1371 | 1371 | ||
1372 | func = insn->func; | 1372 | func = insn->func; |
1373 | 1373 | ||
1374 | if (func && insn->ignore) { | ||
1375 | WARN_FUNC("BUG: why am I validating an ignored function?", | ||
1376 | sec, insn->offset); | ||
1377 | return -1; | ||
1378 | } | ||
1379 | |||
1374 | if (insn->visited) { | 1380 | if (insn->visited) { |
1375 | if (!!insn_state_match(insn, &state)) | 1381 | if (!!insn_state_match(insn, &state)) |
1376 | return 1; | 1382 | return 1; |
@@ -1426,16 +1432,19 @@ static int validate_branch(struct objtool_file *file, struct instruction *first, | |||
1426 | 1432 | ||
1427 | case INSN_JUMP_CONDITIONAL: | 1433 | case INSN_JUMP_CONDITIONAL: |
1428 | case INSN_JUMP_UNCONDITIONAL: | 1434 | case INSN_JUMP_UNCONDITIONAL: |
1429 | if (insn->jump_dest) { | 1435 | if (insn->jump_dest && |
1436 | (!func || !insn->jump_dest->func || | ||
1437 | func == insn->jump_dest->func)) { | ||
1430 | ret = validate_branch(file, insn->jump_dest, | 1438 | ret = validate_branch(file, insn->jump_dest, |
1431 | state); | 1439 | state); |
1432 | if (ret) | 1440 | if (ret) |
1433 | return 1; | 1441 | return 1; |
1442 | |||
1434 | } else if (func && has_modified_stack_frame(&state)) { | 1443 | } else if (func && has_modified_stack_frame(&state)) { |
1435 | WARN_FUNC("sibling call from callable instruction with modified stack frame", | 1444 | WARN_FUNC("sibling call from callable instruction with modified stack frame", |
1436 | sec, insn->offset); | 1445 | sec, insn->offset); |
1437 | return 1; | 1446 | return 1; |
1438 | } /* else it's a sibling call */ | 1447 | } |
1439 | 1448 | ||
1440 | if (insn->type == INSN_JUMP_UNCONDITIONAL) | 1449 | if (insn->type == INSN_JUMP_UNCONDITIONAL) |
1441 | return 0; | 1450 | return 0; |