x86: Fix insn decoder for longer instruction
authorMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Fri, 7 Oct 2011 13:31:55 +0000 (22:31 +0900)
committerIngo Molnar <mingo@elte.hu>
Mon, 10 Oct 2011 07:05:51 +0000 (09:05 +0200)
commit53a019a951fae849471e4a620948c5f6886bd1a4
tree3c37f0297b628e263f74f146352f39cd5401134a
parent65112dccf8a113737684366349d7f9ec373ddc47
x86: Fix insn decoder for longer instruction

Fix x86 insn decoder for hardening against invalid length
instructions. This adds length checkings for each byte-read
site and if it exceeds MAX_INSN_SIZE, returns immediately.
This can happen when decoding user-space binary.

Caller can check whether it happened by checking insn.*.got
member is set or not.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Stephane Eranian <eranian@google.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: acme@redhat.com
Cc: ming.m.lin@intel.com
Cc: robert.richter@amd.com
Cc: ravitillo@lbl.gov
Cc: yrl.pp-manager.tt@hitachi.com
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20111007133155.10933.58577.stgit@localhost.localdomain
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/lib/insn.c