From: "tip-bot2 for Josh Poimboeuf" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Josh Poimboeuf <jpoimboe@redhat.com>,
Borislav Petkov <bp@suse.de>,
Julien Thierry <jthierry@redhat.com>, x86 <x86@kernel.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: [tip: core/objtool] objtool: Add is_static_jump() helper
Date: Tue, 11 Feb 2020 12:47:37 -0000 [thread overview]
Message-ID: <158142525791.411.14762185239829142608.tip-bot2@tip-bot2> (raw)
In-Reply-To: <9b8b438df918276315e4765c60d2587f3c7ad698.1581359535.git.jpoimboe@redhat.com>
The following commit has been merged into the core/objtool branch of tip:
Commit-ID: a22961409c02b93ffa7ed78f67fb57a1ba6c787d
Gitweb: https://git.kernel.org/tip/a22961409c02b93ffa7ed78f67fb57a1ba6c787d
Author: Josh Poimboeuf <jpoimboe@redhat.com>
AuthorDate: Mon, 10 Feb 2020 12:32:39 -06:00
Committer: Borislav Petkov <bp@suse.de>
CommitterDate: Tue, 11 Feb 2020 13:36:01 +01:00
objtool: Add is_static_jump() helper
There are several places where objtool tests for a non-dynamic (aka
direct) jump. Move the check to a helper function.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Julien Thierry <jthierry@redhat.com>
Link: https://lkml.kernel.org/r/9b8b438df918276315e4765c60d2587f3c7ad698.1581359535.git.jpoimboe@redhat.com
---
tools/objtool/check.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 796f6a1..9016ae1 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -97,14 +97,19 @@ static struct instruction *next_insn_same_func(struct objtool_file *file,
for (insn = next_insn_same_sec(file, insn); insn; \
insn = next_insn_same_sec(file, insn))
+static bool is_static_jump(struct instruction *insn)
+{
+ return insn->type == INSN_JUMP_CONDITIONAL ||
+ insn->type == INSN_JUMP_UNCONDITIONAL;
+}
+
static bool is_sibling_call(struct instruction *insn)
{
/* An indirect jump is either a sibling call or a jump to a table. */
if (insn->type == INSN_JUMP_DYNAMIC)
return list_empty(&insn->alts);
- if (insn->type != INSN_JUMP_CONDITIONAL &&
- insn->type != INSN_JUMP_UNCONDITIONAL)
+ if (!is_static_jump(insn))
return false;
/* add_jump_destinations() sets insn->call_dest for sibling calls. */
@@ -553,8 +558,7 @@ static int add_jump_destinations(struct objtool_file *file)
unsigned long dest_off;
for_each_insn(file, insn) {
- if (insn->type != INSN_JUMP_CONDITIONAL &&
- insn->type != INSN_JUMP_UNCONDITIONAL)
+ if (!is_static_jump(insn))
continue;
if (insn->ignore || insn->offset == FAKE_JUMP_OFFSET)
@@ -764,8 +768,7 @@ static int handle_group_alt(struct objtool_file *file,
insn->ignore = orig_insn->ignore_alts;
insn->func = orig_insn->func;
- if (insn->type != INSN_JUMP_CONDITIONAL &&
- insn->type != INSN_JUMP_UNCONDITIONAL)
+ if (!is_static_jump(insn))
continue;
if (!insn->immediate)
next prev parent reply other threads:[~2020-02-11 12:47 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-10 18:32 [PATCH 0/3] objtool: Relocation sanity check for alternatives Josh Poimboeuf
2020-02-10 18:32 ` [PATCH 1/3] objtool: Fail the kernel build on fatal errors Josh Poimboeuf
2020-02-11 7:51 ` Julien Thierry
2020-02-11 12:47 ` [tip: core/objtool] " tip-bot2 for Josh Poimboeuf
2020-02-13 22:11 ` Josh Poimboeuf
2020-02-14 0:10 ` Thomas Gleixner
2020-02-14 17:57 ` Josh Poimboeuf
2020-02-19 22:43 ` Nick Desaulniers
2020-02-20 0:44 ` Philip Li
2020-02-20 19:09 ` Nick Desaulniers
2020-02-10 18:32 ` [PATCH 2/3] objtool: Add is_static_jump() helper Josh Poimboeuf
2020-02-11 7:52 ` Julien Thierry
2020-02-11 12:47 ` tip-bot2 for Josh Poimboeuf [this message]
2020-02-10 18:32 ` [PATCH 3/3] objtool: Add relocation check for alternative sections Josh Poimboeuf
2020-02-11 1:51 ` Linus Torvalds
2020-02-11 8:47 ` Borislav Petkov
2020-02-11 8:16 ` Julien Thierry
2020-02-11 12:47 ` [tip: core/objtool] " tip-bot2 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=158142525791.411.14762185239829142608.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=bp@suse.de \
--cc=jpoimboe@redhat.com \
--cc=jthierry@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=x86@kernel.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
all inboxes | Powered by JetHome®