Skip to contentSkip to conversation

objtool: ignore INT3 padding

PATCH In review Alexey Dobriyan 2 participants 2 messages May 14, 2018 – May 15, 2018 objtool

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 objtool: ignore INT3 padding

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

---

 tools/objtool/arch.h            |    3 ++-
 tools/objtool/arch/x86/decode.c |    4 ++++
 tools/objtool/check.c           |    3 +++
 3 files changed, 9 insertions(+), 1 deletion(-)
tools/objtool/arch.h +2 -1
@@ -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,
tools/objtool/arch/x86/decode.c +4 -0
@@ -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;
tools/objtool/check.c +3 -0
@@ -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