Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3942666imm; Mon, 8 Oct 2018 12:04:12 -0700 (PDT) X-Google-Smtp-Source: ACcGV63l/xjPZQCXWx5HgdJncOyQujeze4tKhtyE9my3MC7/mSMDt4ZVBMFTJ5Txzx3xxSBQQ1Ka X-Received: by 2002:a17:902:694a:: with SMTP id k10-v6mr25029325plt.166.1539025452080; Mon, 08 Oct 2018 12:04:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539025452; cv=none; d=google.com; s=arc-20160816; b=ozrpZLwBaMlLmfMTZ79GNxgkP4xfnqKZRxY7GqHxXTyia6unPju2dHQhiZDisihajl AhUbMJEPpN6+tAmE0lcn09rpOl1fh4oh+jG3QEiAWY3Hc5/eGbuYDMxc061/eSPCWYp3 PNAhYcdMs3Tn+ngXkPpQ2geeC0ecinXr7QW5lEO+p4CMsIxk0SLORaWNm5IH/9jk5mS7 NWteO2eUs0fMZkz21oWsUeFTZsTCEaOr9LCsOq3173idUWX2bD4PITzHt997TiugwS6S GDVH4JXYT0LA0GK1TS8AWAnRS7J+kk0HC8itD47qiiWXGQvHw4qgmU7Q2Gyx7uHFYHsj cOfQ== 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=O+67LlGpXM1JPVEtlofcriIuO/l9wSd0ikYXOU9+vuA=; b=XTqcG2QNwbs4v+BfwEoN8BBmBQa7IfxDJR/QeFGFBSUCmSuEqYkOv+IIC7ioQ/BwAF ub4gsSAm5ZJnK9sRwlpmU6d6T+0Ygh9yvrVzJo5a7oGvP+4qr/1pLELVuEAsIfcU+TD4 2sB4DVlsrSxb4iX9WotZJ6iqk9smj8sr2Rt4FbmcVBlZmYbkMgOrExyZJjx2+SOPCK+C NZjl8NgnR2kWUxtXu/Mizj0AtfUotL+kO4bOayum9pRUEbeCFgKpwoLhdby8s8Dcstpm hPVcVoGFkgj+nngfzfBGC7O4/cvgplez561vbSCNPzpQnmItwEnvT2vErHx73y89js/r ZjmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kciSMVIK; 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 k20-v6si17985851pgm.574.2018.10.08.12.03.56; Mon, 08 Oct 2018 12:04:12 -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=kciSMVIK; 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 S1731096AbeJIB7A (ORCPT + 99 others); Mon, 8 Oct 2018 21:59:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:47156 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728570AbeJIB66 (ORCPT ); Mon, 8 Oct 2018 21:58:58 -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 239C8214C2; Mon, 8 Oct 2018 18:45:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539024352; bh=XP1v+DALJ9fcKzbROxuM9Md63HLUKkiBrccm31IQ7o0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kciSMVIK5fV9BSMMEv50U4aJXKZkfMhxnkjuxW1Xfgc/CKwoYZykrU79ALFLEy+oX xwXu514+wHwLbpZ+XhS6iRBM7gRRe4fHTD9aPVAyKG8klh9eF+hVay/3nqHKOtjAo1 kftnBSJ/iFoMiBrFaBLjNL4+yIc9foKZTPBKv4t8= 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.18 005/168] KVM: PPC: Book3S HV: Dont truncate HPTE index in xlate function Date: Mon, 8 Oct 2018 20:29:45 +0200 Message-Id: <20181008175620.245811456@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181008175620.043587728@linuxfoundation.org> References: <20181008175620.043587728@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.18-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 @@ -359,7 +359,7 @@ static int kvmppc_mmu_book3s_64_hv_xlate unsigned long pp, key; unsigned long v, orig_v, gr; __be64 *hptep; - int index; + long int index; int virtmode = vcpu->arch.shregs.msr & (data ? MSR_DR : MSR_IR); if (kvm_is_radix(vcpu->kvm))