0135-x86-decoder-Add-new-TEST-instruction-pattern.patch 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. From 73c945c5114ca89d182b9fbab0b38c8afd2da375 Mon Sep 17 00:00:00 2001
  2. From: Masami Hiramatsu <[email protected]>
  3. Date: Fri, 24 Nov 2017 13:56:30 +0900
  4. Subject: [PATCH 135/242] x86/decoder: Add new TEST instruction pattern
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. CVE-2017-5754
  9. The kbuild test robot reported this build warning:
  10. Warning: arch/x86/tools/test_get_len found difference at <jump_table>:ffffffff8103dd2c
  11. Warning: ffffffff8103dd82: f6 09 d8 testb $0xd8,(%rcx)
  12. Warning: objdump says 3 bytes, but insn_get_length() says 2
  13. Warning: decoded and checked 1569014 instructions with 1 warnings
  14. This sequence seems to be a new instruction not in the opcode map in the Intel SDM.
  15. The instruction sequence is "F6 09 d8", means Group3(F6), MOD(00)REG(001)RM(001), and 0xd8.
  16. Intel SDM vol2 A.4 Table A-6 said the table index in the group is "Encoding of Bits 5,4,3 of
  17. the ModR/M Byte (bits 2,1,0 in parenthesis)"
  18. In that table, opcodes listed by the index REG bits as:
  19. 000 001 010 011 100 101 110 111
  20. TEST Ib/Iz,(undefined),NOT,NEG,MUL AL/rAX,IMUL AL/rAX,DIV AL/rAX,IDIV AL/rAX
  21. So, it seems TEST Ib is assigned to 001.
  22. Add the new pattern.
  23. Reported-by: kbuild test robot <[email protected]>
  24. Signed-off-by: Masami Hiramatsu <[email protected]>
  25. Cc: Greg Kroah-Hartman <[email protected]>
  26. Cc: <[email protected]>
  27. Cc: H. Peter Anvin <[email protected]>
  28. Cc: Linus Torvalds <[email protected]>
  29. Cc: Peter Zijlstra <[email protected]>
  30. Cc: Thomas Gleixner <[email protected]>
  31. Cc: [email protected]
  32. Signed-off-by: Ingo Molnar <[email protected]>
  33. (cherry picked from commit 2cf68f74af0a6cf808ad03f0d528c72b03c89cc7)
  34. Signed-off-by: Andy Whitcroft <[email protected]>
  35. Signed-off-by: Kleber Sacilotto de Souza <[email protected]>
  36. (cherry picked from commit 8896d68f8ff2a97b91279221ddaba73664c5161d)
  37. Signed-off-by: Fabian Grünbichler <[email protected]>
  38. ---
  39. arch/x86/lib/x86-opcode-map.txt | 2 +-
  40. 1 file changed, 1 insertion(+), 1 deletion(-)
  41. diff --git a/arch/x86/lib/x86-opcode-map.txt b/arch/x86/lib/x86-opcode-map.txt
  42. index aa2270dc9e87..e0b85930dd77 100644
  43. --- a/arch/x86/lib/x86-opcode-map.txt
  44. +++ b/arch/x86/lib/x86-opcode-map.txt
  45. @@ -896,7 +896,7 @@ EndTable
  46. GrpTable: Grp3_1
  47. 0: TEST Eb,Ib
  48. -1:
  49. +1: TEST Eb,Ib
  50. 2: NOT Eb
  51. 3: NEG Eb
  52. 4: MUL AL,Eb
  53. --
  54. 2.14.2