From patchwork Wed Aug 20 11:24:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 4749281 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CB1379F375 for ; Wed, 20 Aug 2014 11:24:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1484920172 for ; Wed, 20 Aug 2014 11:24:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9838C20179 for ; Wed, 20 Aug 2014 11:24:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752726AbaHTLYN (ORCPT ); Wed, 20 Aug 2014 07:24:13 -0400 Received: from mail-wi0-f178.google.com ([209.85.212.178]:33990 "EHLO mail-wi0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751451AbaHTLYM (ORCPT ); Wed, 20 Aug 2014 07:24:12 -0400 Received: by mail-wi0-f178.google.com with SMTP id hi2so6741660wib.5 for ; Wed, 20 Aug 2014 04:24:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=yfLqI7aGwVmMbiPnH/vEXYUXy2rW11SxLJZB3mChIKU=; b=lLpWSeVgQG8xlkUyC3jq7ezlJhXMEBKYNjNkH0/yvWy3a/jy2nn9BkCkkY7T3yoQf6 twIX1o+J6P0yCDRN65c0YZswLP5GMQwOcb0oNWps+Q8IGQ9gmltDJBo7hQdFPTZrorYY mQCxANU6VN908DAeHHLUwd0et2tf5bUd0QICF0/r6qiLW3ObH/4bMv6hXwAmag3kZuni R4h9cEPUk0U297lw4lBpctHmXXkfOkE7/aDnRqE5c2nJyFoZ4mZ0uMrue7J5f80Er8CC bXwOjOySPVbV+PQcBAkRgXLspsyRrhvpXpObHNSjjZJDMrpK3nxlhYcQWfirdD0G+ALf BVVQ== X-Received: by 10.180.37.16 with SMTP id u16mr14613941wij.72.1408533851113; Wed, 20 Aug 2014 04:24:11 -0700 (PDT) Received: from playground.station (net-37-117-135-145.cust.vodafonedsl.it. [37.117.135.145]) by mx.google.com with ESMTPSA id el3sm8292243wib.24.2014.08.20.04.24.09 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Aug 2014 04:24:09 -0700 (PDT) From: Paolo Bonzini To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: namit@cs.technion.ac.il Subject: [PATCH] KVM: x86: do not check CS.DPL against RPL during task switch Date: Wed, 20 Aug 2014 13:24:05 +0200 Message-Id: <1408533845-18181-1-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This reverts the check added by commit 5045b468037d (KVM: x86: check CS.DPL against RPL during task switch, 2014-05-15). Although the CS.DPL=CS.RPL check is mentioned in table 7-1 of the SDM as causing a #TSS exception, it is not mentioned in table 6-6 that lists "invalid TSS conditions" which cause #TSS exceptions. In fact it causes some tests to fail, which pass on bare-metal. Keep the rest of the commit, since we will find new uses for it in 3.18. Reported-by: Nadav Amit Signed-off-by: Paolo Bonzini --- arch/x86/kvm/emulate.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index ef117b842334..03954f7900f5 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -1491,9 +1491,6 @@ static int __load_segment_descriptor(struct x86_emulate_ctxt *ctxt, goto exception; break; case VCPU_SREG_CS: - if (in_task_switch && rpl != dpl) - goto exception; - if (!(seg_desc.type & 8)) goto exception;