Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6066561imu; Wed, 26 Dec 2018 14:25:53 -0800 (PST) X-Google-Smtp-Source: ALg8bN7wl78fzKM9g7Ayre5zljkh3iDJbe3pc5BuuipsDqNCP2Lx11GulPq5s9mhQvXEtw5DsvBL X-Received: by 2002:a63:6984:: with SMTP id e126mr20683492pgc.143.1545863153175; Wed, 26 Dec 2018 14:25:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545863153; cv=none; d=google.com; s=arc-20160816; b=bdXVmWP4qZlnIPeAlnoA1ddvXYLJtXkVrHgCl8gi14vnvuTh2bVNE8+oU1wj9KrZBo QGcPii2XuzwZPvQd5pqxlJXL9e4yQNGWLUmd+dikRdSKOu1KSXl6ruYf3tycn3jGxQP4 d2j9PppmW1rpPfkmMeJMcKtI1sEsMKNoNESTBoRhaljrxmamST79X49UJkLh0B/TRcFx 1iVUVwqjPG3yeylUirLufOJP3Fk4uyJk8jhdxBoPBVR5R3aSphBWJnCrhOZFkAAmt7er VmT4jnDh0Ee1+w61CM0qUy9xbaqwSn34/ASiUkBAB6AEO5M/sKvg+o+xWPTjonD1U/QR Hz6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date; bh=Am2D7FapdJ1MyZmZCfc+2Jg4Lt5pImvd/wXLcanU51A=; b=piOsgdlkt9zHG+4l+6VcEuxmJahgQ+01gAtHSrFup1PJa41SlaWWpT/yoUPktib0HJ c94gMpawhwnuU5x0SNJ2nQWmwchYbAoTIMJCLQFZSsj/XiSF39eYfgq3v5VaM3/SI9xD LIXkcwrdt00iMWfbANX67Ij35NCVarkbnoKfq1fobksa4qkcVza7oLPQsry0GjJdmy32 kjLHcFJDCLk+ai/m3u6SdPt95m7AF9Mz0rLwXnw1EPigXsAdSL+eK999Pb8BUYLWji4A ZIF07YMhNwoJ0tP95sPa4r61D22K31N4lkkAlPiqa+BQw+eJwCpcaLsZiVKhfIgDUuee ppVw== 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 w24si484137plp.304.2018.12.26.14.25.38; Wed, 26 Dec 2018 14:25:53 -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 S1728133AbeLZUlF (ORCPT + 99 others); Wed, 26 Dec 2018 15:41:05 -0500 Received: from gateway32.websitewelcome.com ([192.185.145.102]:11291 "EHLO gateway32.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727561AbeLZUlF (ORCPT ); Wed, 26 Dec 2018 15:41:05 -0500 Received: from cm10.websitewelcome.com (cm10.websitewelcome.com [100.42.49.4]) by gateway32.websitewelcome.com (Postfix) with ESMTP id 7FF81E5CD for ; Wed, 26 Dec 2018 14:41:04 -0600 (CST) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id cFzEgsv4O2PzOcFzEgbAg9; Wed, 26 Dec 2018 14:41:04 -0600 X-Authority-Reason: nr=8 Received: from [189.250.78.104] (port=60394 helo=embeddedor) by gator4166.hostgator.com with esmtpa (Exim 4.91) (envelope-from ) id 1gcFzB-002qjw-B5; Wed, 26 Dec 2018 14:41:01 -0600 Date: Wed, 26 Dec 2018 14:40:59 -0600 From: "Gustavo A. R. Silva" To: Luwei Kang , Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" Subject: [PATCH][next] KVM: x86: Fix bit shifting in update_intel_pt_cfg Message-ID: <20181226204059.GA11391@embeddedor> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 189.250.78.104 X-Source-L: No X-Exim-ID: 1gcFzB-002qjw-B5 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (embeddedor) [189.250.78.104]:60394 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 10 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ctl_bitmask in pt_desc is of type u64. When an integer like 0xf is being left shifted more than 32 bits, the behavior is undefined. Fix this by adding suffix ULL to integer 0xf. Addresses-Coverity-ID: 1476095 ("Bad bit shift operation") Fixes: 6c0f0bba85a0 ("KVM: x86: Introduce a function to initialize the PT configuration") Signed-off-by: Gustavo A. R. Silva --- arch/x86/kvm/vmx/vmx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index cbd55e7aeae5..251c68a74bbe 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -7012,7 +7012,7 @@ static void update_intel_pt_cfg(struct kvm_vcpu *vcpu) /* unmask address range configure area */ for (i = 0; i < vmx->pt_desc.addr_range; i++) - vmx->pt_desc.ctl_bitmask &= ~(0xf << (32 + i * 4)); + vmx->pt_desc.ctl_bitmask &= ~(0xfULL << (32 + i * 4)); } static void vmx_cpuid_update(struct kvm_vcpu *vcpu) -- 2.20.1