Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2632412pxj; Mon, 14 Jun 2021 03:34:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSk8xRz7RsK8nkmkbIs92cv/f0aReQVhiIqXnYDzTXzBI3pyQvBnsajnf5yUxdHUn+7453 X-Received: by 2002:a17:906:b03:: with SMTP id u3mr12186794ejg.95.1623666845030; Mon, 14 Jun 2021 03:34:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623666845; cv=none; d=google.com; s=arc-20160816; b=jkXxMy1Fpz+mp+njKaibVjeeONtC33LZhmtyPcUiB666+tgKrGOByPxEXNsVZWtmMx 4xyWuwSY7ifGeGKOLyvkGuzwwoXbgiA2KaIZ6/ss8I7I23fMCrtQgEama8EWCClDCHhz eWgbqm8L3xVfjXUAs5HaNjNyEFDEF50xmVrIwPLFzcmPNLl2N7NjXYTxFp/UfmkY4p8m +Ar/5s7TtNlq+hKjwmtOMNFuWK2PJg7BeE3TWYJI074Ei6O4xMDW4UMiTkuFTir1HEF+ Y4/qLJ3mV3FN5Co17n/I/rI62aEj9Xf4qyF5f4QTyUDcqXIVI/EppdhN4Ww4LV1QG2dg rF8g== 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=CrpKwjA1qFGnv7Kubxh9A6MVKTNI9O2aVkrqtmOAYN4=; b=iCr6qj+unTcFa8Q7cWpGvGDQQfsk0nax6NLPD+OV76m1FR2Cc+ogm6zxIvWQpd8pWv jvwAUeHfDQlLD7iESAjLPg5YxRWSo+AW9mUMtlLbqg5vOFvCLw7TN21W0ig5g6YxBdBJ UrI9P6AKOYrfphVxDTtDr6VW3FKmuHmDGbQtNnj5EPYalJFYwI6pBh5BUQq+OdXyTqQa /qi2ElI9UTyS/O33zFPqg9qGfUnGiPH9dAwnLq+la/S3rTXhWOwPTvwRpgoardpw6yu1 bI2ONvMWlW/xMdD3yjYLquwFkOukD9FkFXZ1X7t0wk0DAn6NLnGyI8UCn7kO0sJ97IEs bAmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hDL6Ewiz; 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 f3si10748939edt.290.2021.06.14.03.33.42; Mon, 14 Jun 2021 03:34:05 -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=hDL6Ewiz; 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 S233043AbhFNKdY (ORCPT + 99 others); Mon, 14 Jun 2021 06:33:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:38154 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233003AbhFNKb7 (ORCPT ); Mon, 14 Jun 2021 06:31:59 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1814E61242; Mon, 14 Jun 2021 10:29:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623666580; bh=1x6PxafyRvve4h7r3JvKh1m6RtnWVAKfi6AjhpfWSFE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hDL6Ewiz9/C38tMngK4aqriUrs+MzWYoTJTs+//xBVlzBkaf82ZWWhCJ8PblWLiqc UNyPjE9+h9/odAZ1CEvFXqvTjm3I9ajbpicqYdIracWUsUreF5nXJgbePAa4mhV+aT ZGyw/0NeVDRFVJ/cQad6pC6B7T4iu1Nn26kF770U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paolo Bonzini Subject: [PATCH 4.4 31/34] kvm: fix previous commit for 32-bit builds Date: Mon, 14 Jun 2021 12:27:22 +0200 Message-Id: <20210614102642.582276111@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210614102641.582612289@linuxfoundation.org> References: <20210614102641.582612289@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 @@ -959,8 +959,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; }