<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-dev/drivers/vdpa/vdpa_user, branch master</title>
<subtitle>Linux kernel development work - see feature branches</subtitle>
<id>https://git.zx2c4.com/linux-dev/atom/drivers/vdpa/vdpa_user?h=master</id>
<link rel='self' href='https://git.zx2c4.com/linux-dev/atom/drivers/vdpa/vdpa_user?h=master'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/'/>
<updated>2022-09-27T22:32:45Z</updated>
<entry>
<title>vduse: prevent uninitialized memory accesses</title>
<updated>2022-09-27T22:32:45Z</updated>
<author>
<name>Maxime Coquelin</name>
<email>maxime.coquelin@redhat.com</email>
</author>
<published>2022-08-31T15:49:23Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=46f8a29272e51b6df7393d58fc5cb8967397ef2b'/>
<id>urn:sha1:46f8a29272e51b6df7393d58fc5cb8967397ef2b</id>
<content type='text'>
If the VDUSE application provides a smaller config space
than the driver expects, the driver may use uninitialized
memory from the stack.

This patch prevents it by initializing the buffer passed by
the driver to store the config value.

This fix addresses CVE-2022-2308.

Cc: stable@vger.kernel.org # v5.15+
Fixes: c8a6153b6c59 ("vduse: Introduce VDUSE - vDPA Device in Userspace")
Reviewed-by: Xie Yongji &lt;xieyongji@bytedance.com&gt;
Acked-by: Jason Wang &lt;jasowang@redhat.com&gt;
Signed-off-by: Maxime Coquelin &lt;maxime.coquelin@redhat.com&gt;
Message-Id: &lt;20220831154923.97809-1-maxime.coquelin@redhat.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Reviewed-by: Chaitanya Kulkarni &lt;kch@nvidia.com&gt;
</content>
</entry>
<entry>
<title>vduse: Support querying information of IOVA regions</title>
<updated>2022-08-11T08:26:08Z</updated>
<author>
<name>Xie Yongji</name>
<email>xieyongji@bytedance.com</email>
</author>
<published>2022-08-03T04:55:23Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=ad146355bfad627bd0717ece73997c6c93b1b82e'/>
<id>urn:sha1:ad146355bfad627bd0717ece73997c6c93b1b82e</id>
<content type='text'>
This introduces a new ioctl: VDUSE_IOTLB_GET_INFO to
support querying some information of IOVA regions.

Now it can be used to query whether the IOVA region
supports userspace memory registration.

Signed-off-by: Xie Yongji &lt;xieyongji@bytedance.com&gt;
Message-Id: &lt;20220803045523.23851-6-xieyongji@bytedance.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Acked-by: Jason Wang &lt;jasowang@redhat.com&gt;
</content>
</entry>
<entry>
<title>vduse: Support registering userspace memory for IOVA regions</title>
<updated>2022-08-11T08:26:08Z</updated>
<author>
<name>Xie Yongji</name>
<email>xieyongji@bytedance.com</email>
</author>
<published>2022-08-03T04:55:22Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=79a463be9e0051997508d52cf411ed5e91d657f6'/>
<id>urn:sha1:79a463be9e0051997508d52cf411ed5e91d657f6</id>
<content type='text'>
Introduce two ioctls: VDUSE_IOTLB_REG_UMEM and
VDUSE_IOTLB_DEREG_UMEM to support registering
and de-registering userspace memory for IOVA
regions.

Now it only supports registering userspace memory
for bounce buffer region in virtio-vdpa case.

Signed-off-by: Xie Yongji &lt;xieyongji@bytedance.com&gt;
Acked-by: Jason Wang &lt;jasowang@redhat.com&gt;
Message-Id: &lt;20220803045523.23851-5-xieyongji@bytedance.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
</content>
</entry>
<entry>
<title>vduse: Support using userspace pages as bounce buffer</title>
<updated>2022-08-11T08:26:08Z</updated>
<author>
<name>Xie Yongji</name>
<email>xieyongji@bytedance.com</email>
</author>
<published>2022-08-03T04:55:21Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=6c77ed22880d3e8ae91b1d2cce26dbd6c69f38b7'/>
<id>urn:sha1:6c77ed22880d3e8ae91b1d2cce26dbd6c69f38b7</id>
<content type='text'>
Introduce two APIs: vduse_domain_add_user_bounce_pages()
and vduse_domain_remove_user_bounce_pages() to support
adding and removing userspace pages for bounce buffers.
During adding and removing, the DMA data would be copied
from the kernel bounce pages to the userspace bounce pages
and back.

Signed-off-by: Xie Yongji &lt;xieyongji@bytedance.com&gt;
Acked-by: Jason Wang &lt;jasowang@redhat.com&gt;
Message-Id: &lt;20220803045523.23851-4-xieyongji@bytedance.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
</content>
</entry>
<entry>
<title>vduse: Use memcpy_{to,from}_page() in do_bounce()</title>
<updated>2022-08-11T08:26:08Z</updated>
<author>
<name>Xie Yongji</name>
<email>xieyongji@bytedance.com</email>
</author>
<published>2022-08-03T04:55:20Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=82eb46f94ae5faa87ace248d950292c87384a097'/>
<id>urn:sha1:82eb46f94ae5faa87ace248d950292c87384a097</id>
<content type='text'>
kmap_atomic() is being deprecated in favor of kmap_local_page().

The use of kmap_atomic() in do_bounce() is all thread local therefore
kmap_local_page() is a sufficient replacement.

Convert to kmap_local_page() but, instead of open coding it,
use the helpers memcpy_to_page() and memcpy_from_page().

Signed-off-by: Xie Yongji &lt;xieyongji@bytedance.com&gt;
Acked-by: Jason Wang &lt;jasowang@redhat.com&gt;
Reviewed-by: Muchun Song &lt;songmuchun@bytedance.com&gt;
Message-Id: &lt;20220803045523.23851-3-xieyongji@bytedance.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
</content>
</entry>
<entry>
<title>vduse: Remove unnecessary spin lock protection</title>
<updated>2022-08-11T08:26:08Z</updated>
<author>
<name>Xie Yongji</name>
<email>xieyongji@bytedance.com</email>
</author>
<published>2022-08-03T04:55:19Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=c32ee693125aa19a021dad32abbd49f5c6f70031'/>
<id>urn:sha1:c32ee693125aa19a021dad32abbd49f5c6f70031</id>
<content type='text'>
Now we use domain-&gt;iotlb_lock to protect two different
variables: domain-&gt;bounce_maps-&gt;bounce_page and
domain-&gt;iotlb. But for domain-&gt;bounce_maps-&gt;bounce_page,
we actually don't need any synchronization between
vduse_domain_get_bounce_page() and vduse_domain_free_bounce_pages()
since vduse_domain_get_bounce_page() will only be called in
page fault handler and vduse_domain_free_bounce_pages() will
be called during file release.

So let's remove the unnecessary spin lock protection in
vduse_domain_get_bounce_page(). Then the usage of
domain-&gt;iotlb_lock could be more clear: the lock will be
only used to protect the domain-&gt;iotlb.

Signed-off-by: Xie Yongji &lt;xieyongji@bytedance.com&gt;
Acked-by: Jason Wang &lt;jasowang@redhat.com&gt;
Message-Id: &lt;20220803045523.23851-2-xieyongji@bytedance.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
</content>
</entry>
<entry>
<title>vduse: Tie vduse mgmtdev and its device</title>
<updated>2022-06-24T06:49:48Z</updated>
<author>
<name>Parav Pandit</name>
<email>parav@nvidia.com</email>
</author>
<published>2022-06-13T19:52:23Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=0e0348ac3f0a6e6606f1aa5acb1803ada913aa3d'/>
<id>urn:sha1:0e0348ac3f0a6e6606f1aa5acb1803ada913aa3d</id>
<content type='text'>
vduse devices are not backed by any real devices such as PCI. Hence it
doesn't have any parent device linked to it.

Kernel driver model in [1] suggests to avoid an empty device
release callback.

Hence tie the mgmtdevice object's life cycle to an allocate dummy struct
device instead of static one.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/core-api/kobject.rst?h=v5.18-rc7#n284

Signed-off-by: Parav Pandit &lt;parav@nvidia.com&gt;
Message-Id: &lt;20220613195223.473966-1-parav@nvidia.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Reviewed-by: Xie Yongji &lt;xieyongji@bytedance.com&gt;
Acked-by: Jason Wang &lt;jasowang@redhat.com&gt;
</content>
</entry>
<entry>
<title>vduse: Fix NULL pointer dereference on sysfs access</title>
<updated>2022-06-08T12:56:03Z</updated>
<author>
<name>Xie Yongji</name>
<email>xieyongji@bytedance.com</email>
</author>
<published>2022-04-26T07:36:56Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=b27ee76c74dc831d6e092eaebc2dfc9c0beed1c9'/>
<id>urn:sha1:b27ee76c74dc831d6e092eaebc2dfc9c0beed1c9</id>
<content type='text'>
The control device has no drvdata. So we will get a
NULL pointer dereference when accessing control
device's msg_timeout attribute via sysfs:

[ 132.841881][ T3644] BUG: kernel NULL pointer dereference, address: 00000000000000f8
[ 132.850619][ T3644] RIP: 0010:msg_timeout_show (drivers/vdpa/vdpa_user/vduse_dev.c:1271)
[ 132.869447][ T3644] dev_attr_show (drivers/base/core.c:2094)
[ 132.870215][ T3644] sysfs_kf_seq_show (fs/sysfs/file.c:59)
[ 132.871164][ T3644] ? device_remove_bin_file (drivers/base/core.c:2088)
[ 132.872082][ T3644] kernfs_seq_show (fs/kernfs/file.c:164)
[ 132.872838][ T3644] seq_read_iter (fs/seq_file.c:230)
[ 132.873578][ T3644] ? __vmalloc_area_node (mm/vmalloc.c:3041)
[ 132.874532][ T3644] kernfs_fop_read_iter (fs/kernfs/file.c:238)
[ 132.875513][ T3644] __kernel_read (fs/read_write.c:440 (discriminator 1))
[ 132.876319][ T3644] kernel_read (fs/read_write.c:459)
[ 132.877129][ T3644] kernel_read_file (fs/kernel_read_file.c:94)
[ 132.877978][ T3644] kernel_read_file_from_fd (include/linux/file.h:45 fs/kernel_read_file.c:186)
[ 132.879019][ T3644] __do_sys_finit_module (kernel/module.c:4207)
[ 132.879930][ T3644] __ia32_sys_finit_module (kernel/module.c:4189)
[ 132.880930][ T3644] do_int80_syscall_32 (arch/x86/entry/common.c:112 arch/x86/entry/common.c:132)
[ 132.881847][ T3644] entry_INT80_compat (arch/x86/entry/entry_64_compat.S:419)

To fix it, don't create the unneeded attribute for
control device anymore.

Fixes: c8a6153b6c59 ("vduse: Introduce VDUSE - vDPA Device in Userspace")
Reported-by: kernel test robot &lt;oliver.sang@intel.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Xie Yongji &lt;xieyongji@bytedance.com&gt;
Message-Id: &lt;20220426073656.229-1-xieyongji@bytedance.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
</content>
</entry>
<entry>
<title>vdpa: multiple address spaces support</title>
<updated>2022-05-31T16:44:27Z</updated>
<author>
<name>Gautam Dawar</name>
<email>gautam.dawar@xilinx.com</email>
</author>
<published>2022-03-30T18:03:46Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=db9adcbf4286ad1c1fca091a870db6e49bb0df07'/>
<id>urn:sha1:db9adcbf4286ad1c1fca091a870db6e49bb0df07</id>
<content type='text'>
This patches introduces the multiple address spaces support for vDPA
device. This idea is to identify a specific address space via an
dedicated identifier - ASID.

During vDPA device allocation, vDPA device driver needs to report the
number of address spaces supported by the device then the DMA mapping
ops of the vDPA device needs to be extended to support ASID.

This helps to isolate the environments for the virtqueue that will not
be assigned directly. E.g in the case of virtio-net, the control
virtqueue will not be assigned directly to guest.

As a start, simply claim 1 virtqueue groups and 1 address spaces for
all vDPA devices. And vhost-vDPA will simply reject the device with
more than 1 virtqueue groups or address spaces.

Signed-off-by: Jason Wang &lt;jasowang@redhat.com&gt;
Signed-off-by: Gautam Dawar &lt;gdawar@xilinx.com&gt;
Message-Id: &lt;20220330180436.24644-7-gdawar@xilinx.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
</content>
</entry>
<entry>
<title>vdpa: introduce virtqueue groups</title>
<updated>2022-05-31T16:44:27Z</updated>
<author>
<name>Gautam Dawar</name>
<email>gautam.dawar@xilinx.com</email>
</author>
<published>2022-03-30T18:03:45Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=d4821902e43453b85b31329441a9f6ac071228a8'/>
<id>urn:sha1:d4821902e43453b85b31329441a9f6ac071228a8</id>
<content type='text'>
This patch introduces virtqueue groups to vDPA device. The virtqueue
group is the minimal set of virtqueues that must share an address
space. And the address space identifier could only be attached to
a specific virtqueue group.

Signed-off-by: Jason Wang &lt;jasowang@redhat.com&gt;
Signed-off-by: Gautam Dawar &lt;gdawar@xilinx.com&gt;
Message-Id: &lt;20220330180436.24644-6-gdawar@xilinx.com&gt;
Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
</content>
</entry>
</feed>
