Commit 5154d4f2 authored by Denys Vlasenko's avatar Denys Vlasenko Committed by Ingo Molnar

uprobes/x86: Fix 2-byte opcode table

Enabled probing of lar, lsl, popcnt, lddqu, prefetch insns.
They should be safe to probe, they throw no exceptions.

Enabled probing of 3-byte opcodes 0f 38-3f xx - these are
vector isns, so should be safe.

Enabled probing of many currently undefined 0f xx insns.
At the rate new vector instructions are getting added,
we don't want to constantly enable more bits.
We want to only occasionally *disable* ones which
for some reason can't be probed.
This includes 0f 24,26 opcodes, which are undefined
since Pentium. On 486, they were "mov to/from test register".

Explained more fully what 0f 78,79 opcodes are.

Explained what 0f ae opcode is. (It's unclear why we don't allow
probing it, but let's not change it for now).
Signed-off-by: default avatarDenys Vlasenko <dvlasenk@redhat.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Jim Keniston <jkenisto@us.ibm.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/1423768732-32194-3-git-send-email-dvlasenk@redhat.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 67fc8092
...@@ -189,61 +189,43 @@ static volatile u32 good_insns_64[256 / 32] = { ...@@ -189,61 +189,43 @@ static volatile u32 good_insns_64[256 / 32] = {
* 0f 01 - SGDT/SIDT/LGDT/LIDT/SMSW/-/LMSW/INVLPG group. * 0f 01 - SGDT/SIDT/LGDT/LIDT/SMSW/-/LMSW/INVLPG group.
* Also encodes tons of other system insns if mod=11. * Also encodes tons of other system insns if mod=11.
* Some are in fact non-system: xend, xtest, rdtscp, maybe more * Some are in fact non-system: xend, xtest, rdtscp, maybe more
* 0f 02 - lar (why? should be safe, it throws no exceptipons)
* 0f 03 - lsl (why? should be safe, it throws no exceptipons)
* 0f 04 - undefined
* 0f 05 - syscall * 0f 05 - syscall
* 0f 06 - clts (CPL0 insn) * 0f 06 - clts (CPL0 insn)
* 0f 07 - sysret * 0f 07 - sysret
* 0f 08 - invd (CPL0 insn) * 0f 08 - invd (CPL0 insn)
* 0f 09 - wbinvd (CPL0 insn) * 0f 09 - wbinvd (CPL0 insn)
* 0f 0a - undefined
* 0f 0b - ud2 * 0f 0b - ud2
* 0f 0c - undefined * 0f 30 - wrmsr (CPL0 insn) (then why rdmsr is allowed, it's also CPL0 insn?)
* 0f 0d - prefetchFOO (amd prefetch insns)
* 0f 18 - prefetchBAR (intel prefetch insns)
* 0f 24 - mov from test regs (perhaps entire 20-27 area can be disabled (special reg ops))
* 0f 25 - undefined
* 0f 26 - mov to test regs
* 0f 27 - undefined
* 0f 30 - wrmsr (CPL0 insn)
* 0f 34 - sysenter * 0f 34 - sysenter
* 0f 35 - sysexit * 0f 35 - sysexit
* 0f 36 - undefined
* 0f 37 - getsec * 0f 37 - getsec
* 0f 38-3f - 3-byte opcodes (why?? all look safe) * 0f 78 - vmread (Intel VMX. CPL0 insn)
* 0f 78 - vmread * 0f 79 - vmwrite (Intel VMX. CPL0 insn)
* 0f 79 - vmwrite * Note: with prefixes, these two opcodes are
* 0f 7a - undefined * extrq/insertq/AVX512 convert vector ops.
* 0f 7b - undefined * 0f ae - group15: [f]xsave,[f]xrstor,[v]{ld,st}mxcsr,clflush[opt],
* 0f 7c - undefined * {rd,wr}{fs,gs}base,{s,l,m}fence.
* 0f 7d - undefined * Why? They are all user-executable.
* 0f a6 - undefined
* 0f a7 - undefined
* 0f b8 - popcnt (why?? it's an ordinary ALU op)
* 0f d0 - undefined
* 0f f0 - lddqu (why?? it's an ordinary vector load op)
* 0f ff - undefined
*/ */
static volatile u32 good_2byte_insns[256 / 32] = { static volatile u32 good_2byte_insns[256 / 32] = {
/* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
/* ---------------------------------------------- */ /* ---------------------------------------------- */
W(0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1)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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) | /* 80 */
W(0x90, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) , /* 90 */ W(0x90, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) , /* 90 */
W(0xa0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1) | /* a0 */ W(0xa0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1) | /* a0 */
W(0xb0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1) , /* b0 */ W(0xb0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) , /* b0 */
W(0xc0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) | /* c0 */ W(0xc0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) | /* c0 */
W(0xd0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) , /* d0 */ W(0xd0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) , /* d0 */
W(0xe0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) | /* e0 */ W(0xe0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) | /* e0 */
W(0xf0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0) /* f0 */ W(0xf0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) /* f0 */
/* ---------------------------------------------- */ /* ---------------------------------------------- */
/* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment