Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3916726imm; Mon, 8 Oct 2018 11:38:44 -0700 (PDT) X-Google-Smtp-Source: ACcGV61Gix1InnFWhukrH70HO2taasNV+dEKxTHUs53xdz2XG/7CMoppwjyPNxfLTE8z7VfIgyEz X-Received: by 2002:a62:5441:: with SMTP id i62-v6mr14280856pfb.155.1539023924879; Mon, 08 Oct 2018 11:38:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539023924; cv=none; d=google.com; s=arc-20160816; b=YUCGbdAU49HOXJqh1Z8+MptoH3Zvcrb/UpdwHbzUXb0t5zHlAgUHKp5CNEhaKmpgwl rWVt2dUsFqHvPdrfw7+S3R7VBR88aLCWZ3Upi0+yZ/ZCaJ3chdlFu+hpmkvkM2SrqKPQ krnOQvQ+U3zi6n6P7g8PBp81adHO/5YmNQJkI2pZm2qmcmBeZrB/Ci7zXLGi0IcuqjI/ M7VzmX23a2pmQhm51XApmj5qUAKfd6/khJGl12VTCsyHmFEkl7qnUsZc760nHkvky0uW EqecFLfD8E7umgBXWR26K6p869kfDdOrhyuRaDkSUa36Kb2Yq8Vtn/DBCcY1zR889xJ5 dWTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kVY1MjNHT/HhYILgpyXz6mh8IvovYwTp3fLLjhubTak=; b=svVxQKXk7M4jt6NjXJn6XyNL5mGbL4n4LfBnqK3XPV7a/KfpmKFTVOMuXFUuWnZ3z/ 84t/fPXcV9gCB8sUI2ZfUbbS2Lw0oFGRFO06zrGJvqs2rDeIRrG/W85pvYRcfLIkLFO8 kxvAYNfdFQuA53XsAi9rQ8uZ0btPJPfrY+w9fZfFD4ar5BZ5YdzjC5ylrbRTjtfsRIBP ggw+UCl++jwbiL+F3sVRZI/q8maRvBVQ+WwE7MLootLRPmZEfir1FiQ6108mg/hRVZGJ FMQJKRJCBZ2LELSZo5FeCXTREnyAf6oU12Gs5RQ+Nx1yGBx6ePaDXC8OozREKzcnzkPj Mynw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gWOEAEo2; 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 i5-v6si12901820pgc.289.2018.10.08.11.38.29; Mon, 08 Oct 2018 11:38:44 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=gWOEAEo2; 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 S1728934AbeJIBug (ORCPT + 99 others); Mon, 8 Oct 2018 21:50:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:36826 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726427AbeJIBuf (ORCPT ); Mon, 8 Oct 2018 21:50:35 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E5B402064A; Mon, 8 Oct 2018 18:37:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539023852; bh=1x619ilvkg9+iY5g4rl0htTG54YBTa8jqvQaSPVF5oA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gWOEAEo217eB5Yu8WkkudxXgfBb6Ln3Bvp+gyZDVBcnxIhGWNXML9vIdIcrOcFgW0 m+hcNe0u3ZBUik9s02JFbBYwV6uaZBFVf7DSua84NpIenjvXU6brFQu4IforG7H3mH UKkk+086eehJOeotBiBDysTlVXjw+eKFNZBS6lAo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Mackerras , Sasha Levin Subject: [PATCH 4.4 074/113] KVM: PPC: Book3S HV: Dont truncate HPTE index in xlate function Date: Mon, 8 Oct 2018 20:31:15 +0200 Message-Id: <20181008175535.018898572@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181008175530.864641368@linuxfoundation.org> References: <20181008175530.864641368@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Paul Mackerras [ Upstream commit 46dec40fb741f00f1864580130779aeeaf24fb3d ] This fixes a bug which causes guest virtual addresses to get translated to guest real addresses incorrectly when the guest is using the HPT MMU and has more than 256GB of RAM, or more specifically has a HPT larger than 2GB. This has showed up in testing as a failure of the host to emulate doorbell instructions correctly on POWER9 for HPT guests with more than 256GB of RAM. The bug is that the HPTE index in kvmppc_mmu_book3s_64_hv_xlate() is stored as an int, and in forming the HPTE address, the index gets shifted left 4 bits as an int before being signed-extended to 64 bits. The simple fix is to make the variable a long int, matching the return type of kvmppc_hv_find_lock_hpte(), which is what calculates the index. Fixes: 697d3899dcb4 ("KVM: PPC: Implement MMIO emulation support for Book3S HV guests") Signed-off-by: Paul Mackerras Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/kvm/book3s_64_mmu_hv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/powerpc/kvm/book3s_64_mmu_hv.c +++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c @@ -314,7 +314,7 @@ static int kvmppc_mmu_book3s_64_hv_xlate unsigned long pp, key; unsigned long v, gr; __be64 *hptep; - int index; + long int index; int virtmode = vcpu->arch.shregs.msr & (data ? MSR_DR : MSR_IR); /* Get SLB entry */