]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
41333ecb088ee88aa3e258c8bc8840e6bb30abb2
[thirdparty/kernel/stable-queue.git] /
1 From foo@baz Sun Jun 17 12:13:49 CEST 2018
2 From: Ingo Molnar <mingo@kernel.org>
3 Date: Mon, 14 May 2018 10:15:54 +0200
4 Subject: objtool, kprobes/x86: Sync the latest <asm/insn.h> header with tools/objtool/arch/x86/include/asm/insn.h
5
6 From: Ingo Molnar <mingo@kernel.org>
7
8 [ Upstream commit 4fe875e4bd3cae85ae6f6eaf77f63fabe613b66e ]
9
10 The following commit:
11
12 ee6a7354a362: kprobes/x86: Prohibit probing on exception masking instructions
13
14 Modified <asm/insn.h>, adding the insn_masking_exception() function.
15
16 Sync the tooling version of the header to it, to fix this warning:
17
18 Warning: synced file at 'tools/objtool/arch/x86/include/asm/insn.h' differs from latest kernel version at 'arch/x86/include/asm/insn.h'
19
20 Cc: Peter Zijlstra <peterz@infradead.org>
21 Cc: Josh Poimboeuf <jpoimboe@redhat.com>
22 Cc: Masami Hiramatsu <mhiramat@kernel.org>
23 Cc: Thomas Gleixner <tglx@linutronix.de>
24 Cc: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
25 Cc: Francis Deslauriers <francis.deslauriers@efficios.com>
26 Cc: Oleg Nesterov <oleg@redhat.com>
27 Cc: Alexei Starovoitov <ast@kernel.org>
28 Cc: Steven Rostedt <rostedt@goodmis.org>
29 Cc: Andy Lutomirski <luto@kernel.org>
30 Cc: "H . Peter Anvin" <hpa@zytor.com>
31 Cc: Yonghong Song <yhs@fb.com>
32 Cc: Borislav Petkov <bp@suse.de>
33 Cc: Linus Torvalds <torvalds@linux-foundation.org>
34 Cc: "David S . Miller" <davem@davemloft.net>
35 Signed-off-by: Ingo Molnar <mingo@kernel.org>
36 Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
37 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
38 ---
39 tools/objtool/arch/x86/include/asm/insn.h | 18 ++++++++++++++++++
40 1 file changed, 18 insertions(+)
41
42 --- a/tools/objtool/arch/x86/include/asm/insn.h
43 +++ b/tools/objtool/arch/x86/include/asm/insn.h
44 @@ -208,4 +208,22 @@ static inline int insn_offset_immediate(
45 return insn_offset_displacement(insn) + insn->displacement.nbytes;
46 }
47
48 +#define POP_SS_OPCODE 0x1f
49 +#define MOV_SREG_OPCODE 0x8e
50 +
51 +/*
52 + * Intel SDM Vol.3A 6.8.3 states;
53 + * "Any single-step trap that would be delivered following the MOV to SS
54 + * instruction or POP to SS instruction (because EFLAGS.TF is 1) is
55 + * suppressed."
56 + * This function returns true if @insn is MOV SS or POP SS. On these
57 + * instructions, single stepping is suppressed.
58 + */
59 +static inline int insn_masking_exception(struct insn *insn)
60 +{
61 + return insn->opcode.bytes[0] == POP_SS_OPCODE ||
62 + (insn->opcode.bytes[0] == MOV_SREG_OPCODE &&
63 + X86_MODRM_REG(insn->modrm.bytes[0]) == 2);
64 +}
65 +
66 #endif /* _ASM_X86_INSN_H */