Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3920443imm; Mon, 8 Oct 2018 11:42:27 -0700 (PDT) X-Google-Smtp-Source: ACcGV62JngF+GlouZACSCBA39GB+w2XqQOd6sCyqE9Cw1nQqodRB6DO+Iprh86QZol4ms05K/W1o X-Received: by 2002:a17:902:447:: with SMTP id 65-v6mr25010877ple.325.1539024147858; Mon, 08 Oct 2018 11:42:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539024147; cv=none; d=google.com; s=arc-20160816; b=W+O17dUUpoMhK4Ua6m+X8xtxmCWzDX95aBctlelJ6/wahNkDg9Z1JPnhQ95qwFzxDW i2r7xbkAAvxccPPCOjo2qJfcA3QiDlVEyW9uFIicUAvyEvmo8gMxSaEy8uywDbD5IsHb tYQM/ROsET/fMKaOHcSuPGNDIKNFrU0e1BXBOqrVuMuycODCUFsV4OebwLk7CTJoL/rN ZAAGcuM7pSdXHjd5ToOG1n4me6FTR18awoFLByfZQFY8s+FRsAAGo7nJi+kTx1+GRaO2 WAMKlIdfVEKDyBr+5t5yYsNafUiFb1/9fn452lGOTWdpChFAvZ8dRHP2gYgzQr1jhKfG G/kQ== 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=jAK2id9/Q+mJzjS0OP5l3VPygulebbD+TJd3erBK9Kc=; b=aVN5oqTdMaam9JLhLOsN+kLbwyI3GPDeawjESYwIVUlGGttm1JRHNZI8x0SjehSCLg mEORnlzksB3jeA49yNfOIXkwSI8Q3H0yYm1CcFgnIRlc1hs7TE1WI8R/ld9TcCIv3vJL IHJzqixayS4/edyVCgbOKfuI5On5vP9ZRiSKMMmu5HbNU7MfQiYcHAUhesoK4GxqILY3 nOjGOa3VddJgkk7MHb2yV7VyVOyupUTNdzMoL+mmOB+lJP2QDgDWFgn/hJBxqOWEL4oN xdPRpiWULSvfyf1zjtYoxXSdfyYPz+JxtUl0GytdSxUhUcOTj4N9DKMbnb0E/lyzjX0n LcNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lCdl1lko; 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 72-v6si1265557pla.334.2018.10.08.11.42.12; Mon, 08 Oct 2018 11:42:27 -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=lCdl1lko; 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 S1730164AbeJIBzL (ORCPT + 99 others); Mon, 8 Oct 2018 21:55:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:42746 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730155AbeJIBzL (ORCPT ); Mon, 8 Oct 2018 21:55:11 -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 04D192064A; Mon, 8 Oct 2018 18:42:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539024126; bh=1e7qCcxUy6NAYwK4jSXKP5ilUcJhYIgNAFyrvYXixMc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lCdl1lkoKbIR7MuYiOEmCe4oqpPoiNqE9Yac6Rl7tVLMxgpDbNsjrxbEGly49/3O0 KBBAU+ml4ZvR2UnuEYwGut7MKIoRRVTkvRkyyflzIfXFwbX5fhTJgjEqBEUlFHSdaG 5BifVNIAK6HFqCPaiOsDjIL7Uu2ajVLVlRYcCDgw= 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.14 07/94] KVM: PPC: Book3S HV: Dont truncate HPTE index in xlate function Date: Mon, 8 Oct 2018 20:30:48 +0200 Message-Id: <20181008175605.407729136@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181008175605.067676667@linuxfoundation.org> References: <20181008175605.067676667@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.14-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 @@ -355,7 +355,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); /* Get SLB entry */