From patchwork Sat May 21 04:06:39 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takuya Yoshikawa X-Patchwork-Id: 805182 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p4L4BaRA024297 for ; Sat, 21 May 2011 04:11:40 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750726Ab1EUEGp (ORCPT ); Sat, 21 May 2011 00:06:45 -0400 Received: from mail-pw0-f46.google.com ([209.85.160.46]:61350 "EHLO mail-pw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750699Ab1EUEGo (ORCPT ); Sat, 21 May 2011 00:06:44 -0400 Received: by pwi15 with SMTP id 15so1957007pwi.19 for ; Fri, 20 May 2011 21:06:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:date:from:to:cc:subject:message-id:x-mailer :mime-version:content-type:content-transfer-encoding; bh=51QZ6YeqjtPaa4wySQW9aL/XWlNbikM8QiaT7kdFoNo=; b=tY1fRQF9S0/kFRqq31nu0WPAjujFJDfzqBfen1kSj9FmnsbbNJKNovy6NDRm3c+9ov 03sHy3mNBJqf31v+VG+mmrrWNeHE0s6Uc9AUNcpPSvc8EJGd0PEBt9tAJ+pJTrk5uav6 AnK5jsJ5WQ0n9rgAT8QsSI4TOcn5q3iuQ7zv0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:x-mailer:mime-version :content-type:content-transfer-encoding; b=PCDXmxfHOj8DMarid3/psapurO9ytVurzImz0FToAN1GiuH3v1YhKFPN/BxemsIIbI Y6vB3anVM21OWAB5NbQe6fbWhvdusFv8mlmQ5jWi0Yk8G5+olwKLZFiFqACTeiFUVL39 qEWidOZwG8l2fcPzl1UPm6ePcz62dQBumhoas= Received: by 10.68.68.111 with SMTP id v15mr199905pbt.310.1305950804234; Fri, 20 May 2011 21:06:44 -0700 (PDT) Received: from amd (s198099.dynamic.ppp.asahi-net.or.jp [220.157.198.99]) by mx.google.com with ESMTPS id d3sm2861210pbh.73.2011.05.20.21.06.41 (version=SSLv3 cipher=OTHER); Fri, 20 May 2011 21:06:42 -0700 (PDT) Date: Sat, 21 May 2011 13:06:39 +0900 From: Takuya Yoshikawa To: avi@redhat.com, mtosatti@redhat.com Cc: kvm@vger.kernel.org, yoshikawa.takuya@oss.ntt.co.jp Subject: [PATCH] KVM: x86 emulator: Fix unconditional return from get_descriptor_table_ptr() Message-Id: <20110521130639.d4615ee1.takuya.yoshikawa@gmail.com> X-Mailer: Sylpheed 3.1.0 (GTK+ 2.24.4; x86_64-pc-linux-gnu) Mime-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sat, 21 May 2011 04:11:41 +0000 (UTC) From: Takuya Yoshikawa A trivial typo was found in the following commit: commit 7753ed6043bfce55dc0c407490896632014b677e KVM: x86 emulator: drop vcpu argument from segment/gdt/idt callbacks When the table indicator flag is set, when the selector selects the current LDT, get_descriptor_table_ptr() returns without setting the size and address of the table. Guests will see #GP if this happens. Signed-off-by: Takuya Yoshikawa --- Is this stable material? -- IIRC, someone reported a suspicous emulator bug recently. arch/x86/kvm/emulate.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 3bc6b7a..b8b9748 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -1158,7 +1158,7 @@ static void get_descriptor_table_ptr(struct x86_emulate_ctxt *ctxt, u16 sel; memset (dt, 0, sizeof *dt); - if (!ops->get_segment(ctxt, &sel, &desc, NULL, VCPU_SREG_LDTR)); + if (!ops->get_segment(ctxt, &sel, &desc, NULL, VCPU_SREG_LDTR)) return; dt->size = desc_limit_scaled(&desc); /* what if limit > 65535? */