Revert "kprobes/x86: Disable optimizing on the function jumps to indirect thunk"
authorSasha Levin <alexander.levin@microsoft.com>
Tue, 20 Mar 2018 20:44:13 +0000 (16:44 -0400)
committerSasha Levin <alexander.levin@microsoft.com>
Wed, 21 Mar 2018 03:49:54 +0000 (23:49 -0400)
This reverts commit 3e50641bf84d702a7f82018b07f58cbbdcd3cea5.

Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
arch/x86/kernel/kprobes/opt.c

index ea8e2b846101d985451746d5c8a06ab971e19dcf..c9d488f3e4cd416ddaeeb0e61fff1cf0b34d1041 100644 (file)
@@ -36,7 +36,6 @@
 #include <asm/alternative.h>
 #include <asm/insn.h>
 #include <asm/debugreg.h>
-#include <asm/nospec-branch.h>
 
 #include "common.h"
 
@@ -192,7 +191,7 @@ static int copy_optimized_instructions(u8 *dest, u8 *src)
 }
 
 /* Check whether insn is indirect jump */
-static int __insn_is_indirect_jump(struct insn *insn)
+static int insn_is_indirect_jump(struct insn *insn)
 {
        return ((insn->opcode.bytes[0] == 0xff &&
                (X86_MODRM_REG(insn->modrm.value) & 6) == 4) || /* Jump */
@@ -226,26 +225,6 @@ static int insn_jump_into_range(struct insn *insn, unsigned long start, int len)
        return (start <= target && target <= start + len);
 }
 
-static int insn_is_indirect_jump(struct insn *insn)
-{
-       int ret = __insn_is_indirect_jump(insn);
-
-#ifdef CONFIG_RETPOLINE
-       /*
-        * Jump to x86_indirect_thunk_* is treated as an indirect jump.
-        * Note that even with CONFIG_RETPOLINE=y, the kernel compiled with
-        * older gcc may use indirect jump. So we add this check instead of
-        * replace indirect-jump check.
-        */
-       if (!ret)
-               ret = insn_jump_into_range(insn,
-                               (unsigned long)__indirect_thunk_start,
-                               (unsigned long)__indirect_thunk_end -
-                               (unsigned long)__indirect_thunk_start);
-#endif
-       return ret;
-}
-
 /* Decode whole function to ensure any instructions don't jump into target */
 static int can_optimize(unsigned long paddr)
 {