Skip to content
Browse files

kvm: x86: Check memopp before dereference (CVE-2016-8630)

Commit 41061cd ("KVM: emulate: do not initialize memopp") removes a
check for non-NULL under incorrect assumptions. An undefined instruction
with a ModR/M byte with Mod=0 and R/M-5 (e.g. 0xc7 0x15) will attempt
to dereference a null pointer here.

Fixes: 41061cd
Message-Id: <>
Signed-off-by: Owen Hofmann <>
Signed-off-by: Paolo Bonzini <>
  • Loading branch information...
oshofmann authored and bonzini committed Oct 27, 2016
1 parent 355f4fb commit d9092f52d7e61dd1557f2db2400ddb430e85937e
Showing with 1 addition and 1 deletion.
  1. +1 −1 arch/x86/kvm/emulate.c
@@ -5045,7 +5045,7 @@ int x86_decode_insn(struct x86_emulate_ctxt *ctxt, void *insn, int insn_len)
/* Decode and fetch the destination operand: register or memory. */
rc = decode_operand(ctxt, &ctxt->dst, (ctxt->d >> DstShift) & OpMask);
if (ctxt->rip_relative)
if (ctxt->rip_relative && likely(ctxt->memopp))
ctxt->memopp->addr.mem.ea = address_mask(ctxt,
ctxt->memopp->addr.mem.ea + ctxt->_eip);

0 comments on commit d9092f5

Please sign in to comment.
You can’t perform that action at this time.