linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] objtool: ignore INT3 padding
@ 2018-05-14 22:35 Alexey Dobriyan
  2018-05-15  8:02 ` Peter Zijlstra
  0 siblings, 1 reply; 2+ messages in thread
From: Alexey Dobriyan @ 2018-05-14 22:35 UTC (permalink / raw)
  To: jpoimboe, peterz, mingo; +Cc: linux-kernel

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] objtool: ignore INT3 padding
  2018-05-14 22:35 [PATCH] objtool: ignore INT3 padding Alexey Dobriyan
@ 2018-05-15  8:02 ` Peter Zijlstra
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Zijlstra @ 2018-05-15  8:02 UTC (permalink / raw)
  To: Alexey Dobriyan; +Cc: jpoimboe, mingo, linux-kernel

On Tue, May 15, 2018 at 01:35:04AM +0300, Alexey Dobriyan wrote:
> NOP padding doesn't count as unreachable instruction
> neither should INT3.

Josh already did a patch for that, but I now realize that never hit
lkml.

  https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=158754d60cdb824383c44a79d2166d5344c7a395

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-05-15  8:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-14 22:35 [PATCH] objtool: ignore INT3 padding Alexey Dobriyan
2018-05-15  8:02 ` Peter Zijlstra

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).