Received: by 10.223.185.116 with SMTP id b49csp6342020wrg; Wed, 28 Feb 2018 07:53:16 -0800 (PST) X-Google-Smtp-Source: AH8x2242xcp8GvQrXJ6zVj+GstbqFLWhIFXX4ofaOQskVu+D18Zz7uRQPU5+bz66ozbkRmarLx/O X-Received: by 10.98.18.70 with SMTP id a67mr18178687pfj.213.1519833196880; Wed, 28 Feb 2018 07:53:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519833196; cv=none; d=google.com; s=arc-20160816; b=ioux1ZHUazNzog/3bNSH0QraI5SWv+1p0fBf2nRLAAB9yqhuESUxaC3abP9y/HN6CY 8Cx9Frf8Kr2U8pola1fmHk5wNQwFXPs2l2O2eQPbwjlCf9shzoebGSceq4XXcqc8vxUH 6e37Rt4awF1/NgrJrip3WJmCtQmI9YsWpAQaAd1Ardh0be/y0bZOKGjMcDsuxO5uRYon b+jUeI2csbn4yk5/y2lM7xs4x3amLsdAsvJOivE9gTK8RbX/LsLDPcuj/VFZmc0QapOp dtp4l1odTiKnWyoHkgRJrDUbAxiB+JhiDs+ApwSB50HLoU3wKZn++4oZ3w2DlDOHE9hx zc3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=X+BNMbUy4DJf7w97klE0j1KDxTBhr3T589zt5kfnDuQ=; b=ros796DfLlC/jz/LYzuwQFCXFhz2NxeonKXzYY4wNdhL8IJSm5Xe0zHR2C0dOeIy4m 0Oip42FVhLtxLVNEQcVkNnvbw3U4FTHAluJxa+HeoD6QU9Pnfn1YVMtTbPmzTREp9kBv 40DweoxIVS2GLnU8qB/PdUMZerDkeNden7Qt0tOxI3iGRpC9xkmxXjy/Khl5mVTZmxci PHzmeNN7gkQBXktLd6asXzCbtW+0bwlay3ZXOgKvhq2FoIY86YJ8+9f2s5fMNseTqRqp oKp1Q2j4E2F8F3GR5IxWRwI5ClSnqpt0vPLvmTetCrtXrl+YQAfTtdHwF+pVRJQDXE3p srcQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z188si1160436pgb.592.2018.02.28.07.53.01; Wed, 28 Feb 2018 07:53:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933849AbeB1PwY (ORCPT + 99 others); Wed, 28 Feb 2018 10:52:24 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:34391 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932426AbeB1PwV (ORCPT ); Wed, 28 Feb 2018 10:52:21 -0500 Received: from [2a02:8011:400e:2:6f00:88c8:c921:d332] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1er3Yp-0006Xk-1h; Wed, 28 Feb 2018 15:22:27 +0000 Received: from ben by deadeye with local (Exim 4.90_1) (envelope-from ) id 1er3Yk-0000H1-42; Wed, 28 Feb 2018 15:22:22 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Tianyu Lan" , "Radim =?UTF-8?Q?Kr=C4=8Dm=C3=A1=C5=99?=" , "Paolo Bonzini" , "Jeremi Piotrowski" , "Tianyu Lan" Date: Wed, 28 Feb 2018 15:20:18 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 213/254] KVM/x86: Fix wrong macro references of X86_CR0_PG_BIT and X86_CR4_PAE_BIT in kvm_valid_sregs() In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.55-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Tianyu Lan commit 37b95951c58fdf08dc10afa9d02066ed9f176fb5 upstream. kvm_valid_sregs() should use X86_CR0_PG and X86_CR4_PAE to check bit status rather than X86_CR0_PG_BIT and X86_CR4_PAE_BIT. This patch is to fix it. Fixes: f29810335965a(KVM/x86: Check input paging mode when cs.l is set) Reported-by: Jeremi Piotrowski Cc: Paolo Bonzini Cc: Radim Krčmář Signed-off-by: Tianyu Lan Signed-off-by: Radim Krčmář Signed-off-by: Ben Hutchings --- arch/x86/kvm/x86.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -6581,13 +6581,13 @@ EXPORT_SYMBOL_GPL(kvm_task_switch); int kvm_valid_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs) { - if ((sregs->efer & EFER_LME) && (sregs->cr0 & X86_CR0_PG_BIT)) { + if ((sregs->efer & EFER_LME) && (sregs->cr0 & X86_CR0_PG)) { /* * When EFER.LME and CR0.PG are set, the processor is in * 64-bit mode (though maybe in a 32-bit code segment). * CR4.PAE and EFER.LMA must be set. */ - if (!(sregs->cr4 & X86_CR4_PAE_BIT) + if (!(sregs->cr4 & X86_CR4_PAE) || !(sregs->efer & EFER_LMA)) return -EINVAL; } else {