mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Julien Thierry <jthierry@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: jpoimboe@redhat.com, peterz@infradead.org, mbenes@suse.cz,
	Julien Thierry <jthierry@redhat.com>
Subject: [PATCH 2/3] objtool: check: Ignore unreachable fake jumps
Date: Tue, 15 Sep 2020 08:53:17 +0100	[thread overview]
Message-ID: <20200915075318.7336-3-jthierry@redhat.com> (raw)
In-Reply-To: <20200915075318.7336-1-jthierry@redhat.com>

It is possible for alternative code to unconditionally jump out of the
alternative region. In such a case, if a fake jump is added at the end
of the alternative instructions, the fake jump will never be reached.
Since the fake jump is just a mean to make sure code validation does not
go beyond the set of alternatives, reaching it is not a requirement.

Signed-off-by: Julien Thierry <jthierry@redhat.com>
---
 tools/objtool/check.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index fd2edab8e672..cd7c6698d316 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -2648,6 +2648,9 @@ static bool ignore_unreachable_insn(struct instruction *insn)
 	    !strcmp(insn->sec->name, ".altinstr_aux"))
 		return true;
 
+	if (insn->type == INSN_JUMP_UNCONDITIONAL && insn->offset == FAKE_JUMP_OFFSET)
+		return true;
+
 	if (!insn->func)
 		return false;
 
-- 
2.21.3


  parent reply	other threads:[~2020-09-15  8:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-15  7:53 [PATCH 0/3] objtool: Miscellaneous cleanup/fixes Julien Thierry
2020-09-15  7:53 ` [PATCH 1/3] objtool: check: Remove useless tests Julien Thierry
2020-09-15  7:53 ` Julien Thierry [this message]
2020-09-15  7:53 ` [PATCH 3/3] objtool: check: Handle calling non-function symbols in other sections Julien Thierry
2020-09-18 20:07   ` Josh Poimboeuf
2020-09-21  9:56     ` Julien Thierry
2020-09-21 14:40       ` Josh Poimboeuf
2020-09-18 21:47 ` [PATCH 0/3] objtool: Miscellaneous cleanup/fixes 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=20200915075318.7336-3-jthierry@redhat.com \
    --to=jthierry@redhat.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --cc=peterz@infradead.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®