[tip:x86/pti] objtool: Detect INT3 function padding

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit-ID:  158754d60cdb824383c44a79d2166d5344c7a395
Gitweb:     https://git.kernel.org/tip/158754d60cdb824383c44a79d2166d5344c7a395
Author:     Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
AuthorDate: Mon, 14 May 2018 08:28:49 -0500
Committer:  Ingo Molnar <mingo@xxxxxxxxxx>
CommitDate: Tue, 15 May 2018 07:34:58 +0200

objtool: Detect INT3 function padding

With the following commit:

  51bad67ffbce ("x86/asm: Pad assembly functions with INT3 instructions")

... assembly functions are now padded with INT3s instead of NOPs, which
confuses objtool.  Treat INT3s like NOPs.

This fixes the following warnings:

  arch/x86/entry/entry_64.o: warning: objtool: .entry.text+0x6: unreachable instruction
  arch/x86/lib/msr-reg.o: warning: objtool: .text+0x4a: unreachable instruction
  arch/x86/lib/hweight.o: warning: objtool: .text+0x38: unreachable instruction
  arch/x86/lib/clear_page_64.o: warning: objtool: .text+0xb: unreachable instruction
  arch/x86/lib/copy_page_64.o: warning: objtool: .text+0xe: unreachable instruction
  arch/x86/lib/copy_user_64.o: warning: objtool: .text+0xb2: unreachable instruction
  arch/x86/lib/getuser.o: warning: objtool: .text+0x28: unreachable instruction
  arch/x86/lib/memcpy_64.o: warning: objtool: .text+0x1a: unreachable instruction
  arch/x86/lib/memset_64.o: warning: objtool: .text+0x2f: unreachable instruction
  arch/x86/lib/putuser.o: warning: objtool: .text+0x21: unreachable instruction
  arch/x86/lib/rwsem.o: warning: objtool: .text+0x21: unreachable instruction
  arch/x86/lib/retpoline.o: warning: objtool: .text.__x86.indirect_thunk+0x11: unreachable instruction

Reported-by: Ingo Molnar <mingo@xxxxxxxxxx>
Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
Cc: Alexey Dobriyan <adobriyan@xxxxxxxxx>
Cc: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx
Fixes: 51bad67ffbce ("x86/asm: Pad assembly functions with INT3 instructions")
Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx>
---
 tools/objtool/arch/x86/decode.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/objtool/arch/x86/decode.c b/tools/objtool/arch/x86/decode.c
index 540a209b78ab..7e86a743f851 100644
--- a/tools/objtool/arch/x86/decode.c
+++ b/tools/objtool/arch/x86/decode.c
@@ -419,6 +419,11 @@ int arch_decode_instruction(struct elf *elf, struct section *sec,
 
 		break;
 
+	case 0xcc:
+		/* int3: used for asm function padding by the __ALIGN macro */
+		*type = INSN_NOP;
+		break;
+
 	case 0xe3:
 		/* jecxz/jrcxz */
 		*type = INSN_JUMP_CONDITIONAL;
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux