From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 75DAB7E9; Mon, 7 Jul 2025 00:54:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751849694; cv=none; b=jg6VtKo5dqldLQkW1kmOTdY3dxTvlv6Jkklbjsftn0MtmgPFuyR0bAAhyJRBmfcV5UCX1VMJxkaWd/n2FsR5Z2QXwDluFfjjbFOfmX4uQN4fb2tFFwGeNBUt67Ima5bmfP9i1a1JSh+z5FZSykiId5O+e1+L6loYqUq8O/uhYP0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751849694; c=relaxed/simple; bh=hFZnzropm8sQxsCNQZS7PLoBR/gaSnoIEMpSFTFGaIE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=X5xN+oR1xZQfE/Toc5kJnkqpgkegJ1MqtwpY8dz41GoI9HEigXbz4fQP69917Ax00/74Bk/LbGyWoaQ7ckx0gQrI/cEm2OYpQDMGgSqlmFNlWIZfMMeKsWaKXU5mPlwizvfQag2AxGgy8p3toN6DhTT5P2eQN183wCYoZw75oOQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC3CBC4CEEF; Mon, 7 Jul 2025 00:54:18 +0000 (UTC) Date: Sun, 6 Jul 2025 19:54:18 -0500 From: Catalin Marinas To: ankita@nvidia.com Cc: jgg@nvidia.com, maz@kernel.org, oliver.upton@linux.dev, joey.gouly@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, will@kernel.org, ryan.roberts@arm.com, shahuang@redhat.com, lpieralisi@kernel.org, david@redhat.com, ddutile@redhat.com, seanjc@google.com, aniketa@nvidia.com, cjia@nvidia.com, kwankhede@nvidia.com, kjaju@nvidia.com, targupta@nvidia.com, vsethi@nvidia.com, acurrid@nvidia.com, apopple@nvidia.com, jhubbard@nvidia.com, danw@nvidia.com, zhiw@nvidia.com, mochs@nvidia.com, udhoke@nvidia.com, dnigam@nvidia.com, alex.williamson@redhat.com, sebastianene@google.com, coltonlewis@google.com, kevin.tian@intel.com, yi.l.liu@intel.com, ardb@kernel.org, akpm@linux-foundation.org, gshan@redhat.com, linux-mm@kvack.org, tabba@google.com, qperret@google.com, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, maobibo@loongson.cn Subject: Re: [PATCH v10 3/6] KVM: arm64: Block cacheable PFNMAP mapping Message-ID: References: <20250705071717.5062-1-ankita@nvidia.com> <20250705071717.5062-4-ankita@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250705071717.5062-4-ankita@nvidia.com> On Sat, Jul 05, 2025 at 07:17:14AM +0000, ankita@nvidia.com wrote: > From: Ankit Agrawal > > Fixes a security bug due to mismatched attributes between S1 and > S2 mapping. > > Currently, it is possible for a region to be cacheable in the userspace > VMA, but mapped non cached in S2. This creates a potential issue where > the VMM may sanitize cacheable memory across VMs using cacheable stores, > ensuring it is zeroed. However, if KVM subsequently assigns this memory > to a VM as uncached, the VM could end up accessing stale, non-zeroed data > from a previous VM, leading to unintended data exposure. This is a security > risk. > > Block such mismatch attributes case by returning EINVAL when userspace > try to map PFNMAP cacheable. Only allow NORMAL_NC and DEVICE_*. > > CC: Oliver Upton > CC: Catalin Marinas > CC: Sean Christopherson > Suggested-by: Jason Gunthorpe > Reviewed-by: Jason Gunthorpe > Reviewed-by: David Hildenbrand > Tested-by: Donald Dutile > Signed-off-by: Ankit Agrawal Reviewed-by: Catalin Marinas