From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796132012; b=4ICl1b6R6xIPngU4lNz2psu69EqevI/jDfJass4F7k1nvBejkecXyfEFGdsgGkOlj6I/ 6hLqgMAIozjiQyAsGXNltxPvt64Rqo79frCicajgza7PnrJjmOBYdDYf9xtONZddXf07y hz9DY+gQAmTTsCylDeQedQQodIJyEurqX4ZoWBXqoM3KsDXEDuwOVc4kWd2HXJGReZKmv VToLo51p5QNjNdJg5EhqtdVCAZnESt63vGoNITkUKu3sP7jY6nmVa+JPAoyRE/EJCSetO aEBicg+WSDpKtYeYOqhlhGdkg4DKkMkpzuM5Se/ipA1mPFC2xyzzTyhuorMRdMztEcw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796132012; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=VYgQnyW91SAIqn6GEY7XwGQQvO37u4DsgBAXlDgxiik=; b=1nB2DTGIl+bpcxXxWh2ccaobYuC+RZn2MJVk4a/YIwp14p1HeQ5D9qVrb/AHqejRviGf fO0pyLtXQjsNIo5K4evOd8chSDyzCKrJ7zEtZ8hwMLfeX5yI5UAmccI49iQs4jHeNFpNO VP6Na1DJAjxZLbV4oDb2DNnX9ePlHg0gN7vFWWuFjlgAW5s8ttUglae9ZluNqSXOA+BUH 5qqFI31Yjh53gA/pf/lwY497abrymMpxYrEIGctaUDlkN9A0hSYl9YkvhZ3J/eUHJr3+1 AzwqXV9ri/gYdMyZftIcXPMe7cKrXONwVaQaF++4BHHnL34ABAENg52sz5CpiEAPZLQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=FkywrqNt; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1CEA4606A327; Tue, 1 Dec 2026 13:33:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=FkywrqNt Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC9001F0089A; Tue, 1 Dec 2026 13:33:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796132011; bh=VYgQnyW91SAIqn6GEY7XwGQQvO37u4DsgBAXlDgxiik=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=FkywrqNtBJw1dkezaWAJTCQ2m1iHrqrdbm6X6ozwapyO7ApGvcwXOZjvo1aB7SaN7 csZppYzI68SpQxK4h5Y67YnYnROxP6mIG3c0g2La0Kf1+mFyk2dJcXVGmj/E+xCFPy nHbarG6YuOFvY+Wy5tox3sr3v2m+M7MIj3dOgvbEb9IS6BOJua8znpejB6rbakEu0a e/Gp3q0dADLAsRyJxQ51TniFN55w9rXusFsIcDzOuxBMr/Oygv1Ob9dJ2vTd9wmqTx FWwKIhAJo4FVFylBgHXIE5LR5We9UGR4nuef18VhPyGyejaDJsk5Qc60qMXxQeAZN3 ak4ZOv4eHRJmA== Date: Tue, 1 Dec 2026 13:33:27 +0000 From: "Lorenzo Stoakes (ARM)" To: chenglong ma Cc: "Michael S . Tsirkin" , Jason Wang , Eugenio Perez , Xuan Zhuo , Xie Yongji , virtualization@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] vduse: don't set VM_IO on the domain file mapping Message-ID: References: <20261126062915.209-1-longpareto@gmail.com> <20261130095135.862-1-longpareto@gmail.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261130095135.862-1-longpareto@gmail.com> On Mon, Nov 30, 2026 at 05:51:35PM +0800, chenglong ma wrote: > Commit bb2e6f166547 ("vduse: fix VA/PA confusion in the coherent page > fault path") set VM_IO on the domain mapping to keep vhost-vdpa from > importing it. Since 99fd6bf43d5d, the MM rejects VM_IO on mm-managed > mappings. As a result, mmap() of the domain file warns and returns > -EINVAL, breaking VDUSE userspace. > > Drop VM_IO so that userspace can mmap the domain file again. This also > makes shared mappings of VDUSE domain files eligible for import through > vhost-vdpa. The existing file pointer comparison rejects the target > domain's own file but allows a file belonging to another VDUSE domain. > Each imported entry holds a file reference, so accepting another > domain's file would allow the two domains to hold references to each > other. > > All VDUSE domain files use vduse_domain_fops. Check the file operations > at import time and reject any such file before taking a reference. Now it seems like you're doing 2 fixes in 1? Why are you doing that? That's not how patches work, you don't just shove everything into one patch? Can you please just send these separately and reinstate my R-b on the VM_IO fix? Thanks. > > Fixes: bb2e6f166547 ("vduse: fix VA/PA confusion in the coherent page fault path") > Cc: stable@vger.kernel.org > Reported-by: Lorenzo Stoakes (ARM) > Closes: https://lore.kernel.org/r/awWOpS3HR_2FTN3I@gremlin > Suggested-by: Lorenzo Stoakes (ARM) > Signed-off-by: chenglong ma > --- > Please consider this for the 7.4 cycle. The mmap() regression prevents > VDUSE userspace from accessing the domain mapping. > > Changes in v3: > - Reject imports backed by any VDUSE domain file, as pointed out by > Sashiko during review of v2. > - Drop Lorenzo's Reviewed-by because the import check changed. > - v2: https://lore.kernel.org/r/20261126062915.209-1-longpareto@gmail.com > > Changes in v2: > - Move the hotfix request below the cut, add stable and Lorenzo's > Reviewed-by, and update the sign-off name. > - v1: https://lore.kernel.org/r/20261125152800.485-1-longpareto@gmail.com > > Tested in QEMU on v7.4-rc2. The domain file could be mapped and a > coherent vring page faulted in. Imports of both the target domain's > file and a different domain's file were rejected, with no entry at the > requested IOVA. An ordinary memfd mapping imported and shared data. > > drivers/vdpa/vdpa_user/iova_domain.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/vdpa/vdpa_user/iova_domain.c b/drivers/vdpa/vdpa_user/iova_domain.c > index 28a977248a0d..8acd0672fd30 100644 > --- a/drivers/vdpa/vdpa_user/iova_domain.c > +++ b/drivers/vdpa/vdpa_user/iova_domain.c > @@ -76,7 +76,7 @@ int vduse_domain_set_map(struct vduse_iova_domain *domain, > for (map = vhost_iotlb_itree_first(iotlb, start, last); map; > map = vhost_iotlb_itree_next(map, start, last)) { > map_file = (struct vdpa_map_file *)map->opaque; > - if (!map_file || map_file->file == domain->file) { > + if (!map_file || map_file->file->f_op == domain->file->f_op) { > ret = -EINVAL; > goto err; > } > @@ -588,7 +588,7 @@ static int vduse_domain_mmap(struct file *file, struct vm_area_struct *vma) > { > struct vduse_iova_domain *domain = file->private_data; > > - vm_flags_set(vma, VM_IO | VM_DONTDUMP | VM_DONTEXPAND); > + vm_flags_set(vma, VM_DONTDUMP | VM_DONTEXPAND); > vma->vm_private_data = domain; > vma->vm_ops = &vduse_domain_mmap_ops; > > > base-commit: 44293796526f4343639f87b2acc53811c78b5d54 -- Cheers, Lorenzo