Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3526264pxf; Mon, 15 Mar 2021 11:31:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxeJ6au/CyN1bgVhcXBnT+NnLqT+nOA82C3LICKtKBvOpPglzbDGlPa+gTQqyzDcAAtkhmz X-Received: by 2002:aa7:c903:: with SMTP id b3mr31582884edt.156.1615833065117; Mon, 15 Mar 2021 11:31:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615833065; cv=none; d=google.com; s=arc-20160816; b=oKIqfTjGL0T6UoMI+/ST4Lac9XBM6Yep8H6i4h7WOPi6KZGpmFCmk6IEUZSsnlJNN4 CcGDVtrovMDsKFsjPO6zORa5xroT8c+nf713mB7lbKmsdMcovd5LywxYZgyNXdzrRPIE OW7aw8lm9CLwC981iFtMQxr0Xryhg+raPxOT9bzTYSs65VLOKyiEtP8EQ9qwSNSzKvHw MYV59N/4L2anuSufDxw8HnqkWgDAMxCUNu5vkVb/qoBvb8uNJJDR5S/lSioOaSspttJL jthJZ44hnhLMFXf5jIqTL+nwEMTRNwhPBidSKMfod8p1RoZZDRoRyvduusJ2LpkhrGzM eduw== 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=u88wMfPq2uWPPHvnkRhFxe1qVs+eIIHzgdufw94aCj4=; b=xwhzDmJXCkUNwv9eDBQHe6NXJZVB8bULZ0j8lBeCPxqlW6Igxv/bzPWu23t4xJN3rc RHbXPyKic+BSk7uKzYVryu8qL+9SwQBw/G7vH4oqwsTTv/1oqB2Uh5cRNp+uq2sULD9g IZd/j/4dWBmn3MBLj332ed1Iqt4hTAPlW6VT2oqPQBbJDmWNTYCQVPjHgV0F0CvRyhlo sNhd0z1taz0iFcm3AHm9Cy06VRLUJmL0UB9w0bOCHjSUbNc+D88OWx3/cdvgtPVdzfxz NHVymy8J1KEZZ6eabzQDxAPg+nzmjDk4uTspvPhhkydVz9gqMFG93Z5nWr79qXJ3K8aj Q8Aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rAVD+Fx5; 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 24si12153695edv.533.2021.03.15.11.30.42; Mon, 15 Mar 2021 11:31: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=rAVD+Fx5; 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 S240478AbhCOOiA (ORCPT + 99 others); Mon, 15 Mar 2021 10:38:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:36764 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233362AbhCOOBg (ORCPT ); Mon, 15 Mar 2021 10:01:36 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E0D6264FA6; Mon, 15 Mar 2021 14:01:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816864; bh=ZSDDJqmx1ezviwIfBelKE+p28/Gdv9yUJNdgvYPx34A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rAVD+Fx5uhitcip78PmKLvZVbNZhZk4sSDomTQOR/xX0ha+4kIire3Vj1glyOBb+d kkYMSu/Hr813F+XwOQOd7jm2opcfi9WOnhoJfYjSxHAH8fhAFFVLJlSbRo+ghNYgur /Kb9USZN6iF7OTZD9jH8xPUpGni9O8S6pjTYLoeo= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Auger , Marc Zyngier , Andrew Jones Subject: [PATCH 4.19 117/120] KVM: arm64: Fix exclusive limit for IPA size Date: Mon, 15 Mar 2021 14:57:48 +0100 Message-Id: <20210315135723.811477229@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135720.002213995@linuxfoundation.org> References: <20210315135720.002213995@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: Greg Kroah-Hartman From: Marc Zyngier Commit 262b003d059c6671601a19057e9fe1a5e7f23722 upstream. When registering a memslot, we check the size and location of that memslot against the IPA size to ensure that we can provide guest access to the whole of the memory. Unfortunately, this check rejects memslot that end-up at the exact limit of the addressing capability for a given IPA size. For example, it refuses the creation of a 2GB memslot at 0x8000000 with a 32bit IPA space. Fix it by relaxing the check to accept a memslot reaching the limit of the IPA space. Fixes: c3058d5da222 ("arm/arm64: KVM: Ensure memslots are within KVM_PHYS_SIZE") Reviewed-by: Eric Auger Signed-off-by: Marc Zyngier Cc: stable@vger.kernel.org # 4.4, 4.9, 4.14, 4.19 Reviewed-by: Andrew Jones Link: https://lore.kernel.org/r/20210311100016.3830038-3-maz@kernel.org Signed-off-by: Greg Kroah-Hartman --- virt/kvm/arm/mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/virt/kvm/arm/mmu.c +++ b/virt/kvm/arm/mmu.c @@ -2080,7 +2080,7 @@ int kvm_arch_prepare_memory_region(struc * Prevent userspace from creating a memory region outside of the IPA * space addressable by the KVM guest IPA space. */ - if (memslot->base_gfn + memslot->npages >= + if (memslot->base_gfn + memslot->npages > (KVM_PHYS_SIZE >> PAGE_SHIFT)) return -EFAULT;