x86: xen: insn: Decode Xen and KVM emulate-prefix signature
authorMasami Hiramatsu <mhiramat@kernel.org>
Fri, 6 Sep 2019 13:14:10 +0000 (22:14 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 15 May 2022 17:54:47 +0000 (19:54 +0200)
commit6af6427a960000428a783e373d59a213253c5fb0
tree1f5cfec69bf035d2e8af4c4b4eac42b363218f5a
parentc67a4a91f5e140c1ba313b03e7baf907a03de788
x86: xen: insn: Decode Xen and KVM emulate-prefix signature

commit 4d65adfcd1196818659d3bd9b42dccab291e1751 upstream.

Decode Xen and KVM's emulate-prefix signature by x86 insn decoder.
It is called "prefix" but actually not x86 instruction prefix, so
this adds insn.emulate_prefix_size field instead of reusing
insn.prefixes.

If x86 decoder finds a special sequence of instructions of
XEN_EMULATE_PREFIX and 'ud2a; .ascii "kvm"', it just counts the
length, set insn.emulate_prefix_size and fold it with the next
instruction. In other words, the signature and the next instruction
is treated as a single instruction.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: x86@kernel.org
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: xen-devel@lists.xenproject.org
Cc: Randy Dunlap <rdunlap@infradead.org>
Link: https://lkml.kernel.org/r/156777564986.25081.4964537658500952557.stgit@devnote2
[mheyne: resolved contextual conflict in tools/objtools/sync-check.sh]
Signed-off-by: Maximilian Heyne <mheyne@amazon.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/include/asm/insn.h
arch/x86/lib/insn.c
tools/arch/x86/include/asm/emulate_prefix.h [new file with mode: 0644]
tools/arch/x86/include/asm/insn.h
tools/arch/x86/lib/insn.c
tools/objtool/sync-check.sh
tools/perf/check-headers.sh