linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: jpoimboe@redhat.com, peterz@infradead.org, mingo@kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] objtool: ignore INT3 padding
Date: Tue, 15 May 2018 01:35:04 +0300	[thread overview]
Message-ID: <20180514223504.GA14804@avx2> (raw)

NOP padding doesn't count as unreachable instruction
neither should INT3.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

 tools/objtool/arch.h            |    3 ++-
 tools/objtool/arch/x86/decode.c |    4 ++++
 tools/objtool/check.c           |    3 +++
 3 files changed, 9 insertions(+), 1 deletion(-)

--- a/tools/objtool/arch.h
+++ b/tools/objtool/arch.h
@@ -34,7 +34,8 @@
 #define INSN_BUG		9
 #define INSN_NOP		10
 #define INSN_OTHER		11
-#define INSN_LAST		INSN_OTHER
+#define INSN_INT3		12
+#define INSN_LAST		INSN_INT3
 
 enum op_dest_type {
 	OP_DEST_REG,
--- a/tools/objtool/arch/x86/decode.c
+++ b/tools/objtool/arch/x86/decode.c
@@ -440,6 +440,10 @@ int arch_decode_instruction(struct elf *elf, struct section *sec,
 		*type = INSN_CONTEXT_SWITCH;
 		break;
 
+	case 0xcc:
+		*type = INSN_INT3;
+		break;
+
 	case 0xe8:
 		*type = INSN_CALL;
 		break;
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -1998,6 +1998,9 @@ static bool ignore_unreachable_insn(struct instruction *insn)
 
 	if (insn->ignore || insn->type == INSN_NOP)
 		return true;
+	/* Inter-function padding. */
+	if (insn->type == INSN_INT3)
+		return true;
 
 	/*
 	 * Ignore any unused exceptions.  This can happen when a whitelisted

             reply	other threads:[~2018-05-14 22:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-14 22:35 Alexey Dobriyan [this message]
2018-05-15  8:02 ` [PATCH] objtool: ignore INT3 padding Peter Zijlstra

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=20180514223504.GA14804@avx2 \
    --to=adobriyan@gmail.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).