Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2662641pxj; Mon, 14 Jun 2021 04:20:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOicd8mSsWQNBCnjLNewmnJvRfrsCv6qViMovcwORiBG28zFgzfcSlWEeQWjdmDpuVHO3J X-Received: by 2002:a17:906:2a8e:: with SMTP id l14mr14511642eje.549.1623669618535; Mon, 14 Jun 2021 04:20:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623669618; cv=none; d=google.com; s=arc-20160816; b=VoKk9+XCwq3751DEKSeU5ws6FDSBQZxzGPXiJRP01OSCvC1NZbPVISTOrpnXL5xDQ8 TxIVFbQwlrm6yY5O6Q0ycoVn8DOyFhKm+TTQPRr2WfHs+qjyCQp4vW6/KUwZ917tulzC BtKh3E2dyAMVQwdN2IfOczKR1FkkhFctRYVOzASuyi67vLqUmsfYE8D4KoofyplRQi2Q nV98R6/18rNOjEnHBv/s/8iXetvRo4tGSxg3Q3AwjdY1WPGHPUUvVPmANTRGyfC9rSi6 pUjafHqlwUohY1+OtVJGX/1RnqnVb0CC4AfzT2Npmc7A2Hu5l2q40dg8rgA60Y9+RfTA 25eA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8fIiFX/HAZk5wOkyP6mEwizrXtvF6ehPydZgqD0svdI=; b=BVeANDi2FESwa2uwf6numFu9vy+wksnkLrYzC3PTa01qxsKoMF0DyybjlBSmF6y+VX ELwikbpX/j/ue55Jk93R8bojH26d6sPZY7lLpnt2N3Fu17IcgYvWt0FiV97fqUukwN+b KIO96SG8YV8Xk5j268oa+2S2WpS2G4FPhV1TnogRNhqLT6lDUJii4PqUqNdGtr6rg8uO Fre6VL5vJxwmTLQb0e05J8PL3Vvejsr+XQ05EU8b+S5YLRUuGQURBc3LeK+vIVfUwGdj XhMEcB5EVxKe1B7MZCKNG5uoplEZWRi9UeVJFTFJ2fOMHbowae/Qfbywo1c+RIIKno/Z OiYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FM+BzUlM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d3si11202329edz.423.2021.06.14.04.19.56; Mon, 14 Jun 2021 04:20:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FM+BzUlM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236081AbhFNLUR (ORCPT + 99 others); Mon, 14 Jun 2021 07:20:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:39538 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234189AbhFNLH4 (ORCPT ); Mon, 14 Jun 2021 07:07:56 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2B13B61933; Mon, 14 Jun 2021 10:46:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623667571; bh=5v2OFS50SGrtKixBb1zZSrIBnC13A5UX6gk+6YxbADg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FM+BzUlMf1cagelotL0A/UuNCrGXENgtsKtU0zwWPu/GkOJNvccAnabQ4nK+n3BNF Oz/4QR2ORsURjzN/e0Uz5ZBb+gVHUgfoakAR5JuvveJyUwtHY3n6/XMkBYr0wU6s7v oltdaXlzDXOfY+UbUYJL8dNR8cluY39GzJumW8x0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paolo Bonzini Subject: [PATCH 5.10 123/131] kvm: fix previous commit for 32-bit builds Date: Mon, 14 Jun 2021 12:28:04 +0200 Message-Id: <20210614102657.195583338@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210614102652.964395392@linuxfoundation.org> References: <20210614102652.964395392@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Paolo Bonzini commit 4422829e8053068e0225e4d0ef42dc41ea7c9ef5 upstream. array_index_nospec does not work for uint64_t on 32-bit builds. However, the size of a memory slot must be less than 20 bits wide on those system, since the memory slot must fit in the user address space. So just store it in an unsigned long. Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- include/linux/kvm_host.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -1110,8 +1110,8 @@ __gfn_to_hva_memslot(struct kvm_memory_s * table walks, do not let the processor speculate loads outside * the guest's registered memslots. */ - unsigned long offset = array_index_nospec(gfn - slot->base_gfn, - slot->npages); + unsigned long offset = gfn - slot->base_gfn; + offset = array_index_nospec(offset, slot->npages); return slot->userspace_addr + offset * PAGE_SIZE; }