From: tip-bot for Josh Poimboeuf <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: jpoimboe@redhat.com, mingo@kernel.org, peterz@infradead.org,
tglx@linutronix.de, linux-kernel@vger.kernel.org,
torvalds@linux-foundation.org, hpa@zytor.com
Subject: [tip:core/urgent] objtool: Don't use ignore flag for fake jumps
Date: Mon, 13 May 2019 11:34:04 -0700 [thread overview]
Message-ID: <tip-e6da9567959e164f82bc81967e0d5b10dee870b4@git.kernel.org> (raw)
In-Reply-To: <71abc072ff48b2feccc197723a9c52859476c068.1557766718.git.jpoimboe@redhat.com>
Commit-ID: e6da9567959e164f82bc81967e0d5b10dee870b4
Gitweb: https://git.kernel.org/tip/e6da9567959e164f82bc81967e0d5b10dee870b4
Author: Josh Poimboeuf <jpoimboe@redhat.com>
AuthorDate: Mon, 13 May 2019 12:01:31 -0500
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 13 May 2019 20:31:17 +0200
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>
---
tools/objtool/check.c | 8 +++++---
1 file 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 @@
#include <linux/hashtable.h>
#include <linux/kernel.h>
+#define FAKE_JUMP_OFFSET -1
+
struct alternative {
struct list_head list;
struct instruction *insn;
@@ -568,7 +570,7 @@ static int add_jump_destinations(struct objtool_file *file)
insn->type != INSN_JUMP_UNCONDITIONAL)
continue;
- if (insn->ignore)
+ if (insn->ignore || insn->offset == FAKE_JUMP_OFFSET)
continue;
rela = find_rela_by_dest_range(insn->sec, insn->offset,
@@ -745,10 +747,10 @@ static int handle_group_alt(struct objtool_file *file,
clear_insn_state(&fake_jump->state);
fake_jump->sec = special_alt->new_sec;
- fake_jump->offset = -1;
+ fake_jump->offset = FAKE_JUMP_OFFSET;
fake_jump->type = INSN_JUMP_UNCONDITIONAL;
fake_jump->jump_dest = list_next_entry(last_orig_insn, list);
- fake_jump->ignore = true;
+ fake_jump->func = orig_insn->func;
}
if (!special_alt->new_len) {
next prev parent reply other threads:[~2019-05-13 18:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-13 17:01 [PATCH 0/2] objtool: Fix function fallthrough detection Josh Poimboeuf
2019-05-13 17:01 ` [PATCH 1/2] objtool: Don't use ignore flag for fake jumps Josh Poimboeuf
2019-05-13 18:34 ` tip-bot for Josh Poimboeuf [this message]
2019-05-13 17:01 ` [PATCH 2/2] objtool: Fix function fallthrough detection Josh Poimboeuf
2019-05-13 18:34 ` [tip:core/urgent] " tip-bot for Josh Poimboeuf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-e6da9567959e164f82bc81967e0d5b10dee870b4@git.kernel.org \
--to=tipbot@zytor.com \
--cc=hpa@zytor.com \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox