mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-09-22 09:34:56 +02:00
VDUSE: avoid leaking information to userspace
The bounceing is not necessarily page aligned, so current VDUSE can
leak kernel information through mapping bounce pages to
userspace. Allocate bounce pages with __GFP_ZERO to avoid leaking
information to userspace.
Fixes: 8c773d53fb ("vduse: Implement an MMU-based software IOTLB")
Cc: stable@vger.kernel.org
Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Xie Yongji <xieyongji@bytedance.com>
Reviewed-by: Eugenio Pérez <eperezma@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20260130050750.4050-1-jasowang@redhat.com>
This commit is contained in:
committed by
Michael S. Tsirkin
parent
ae9c13b6fd
commit
9c15238034
@@ -124,7 +124,7 @@ static int vduse_domain_map_bounce_page(struct vduse_iova_domain *domain,
|
||||
if (!map->bounce_page) {
|
||||
head_map = &domain->bounce_maps[(iova & PAGE_MASK) >> BOUNCE_MAP_SHIFT];
|
||||
if (!head_map->bounce_page) {
|
||||
tmp_page = alloc_page(GFP_ATOMIC);
|
||||
tmp_page = alloc_page(GFP_ATOMIC | __GFP_ZERO);
|
||||
if (!tmp_page)
|
||||
return -ENOMEM;
|
||||
if (cmpxchg(&head_map->bounce_page, NULL, tmp_page))
|
||||
|
||||
@@ -999,7 +999,7 @@ static void *vduse_dev_alloc_coherent(union virtio_map token, size_t size,
|
||||
if (!token.group)
|
||||
return NULL;
|
||||
|
||||
addr = alloc_pages_exact(size, flag);
|
||||
addr = alloc_pages_exact(size, flag | __GFP_ZERO);
|
||||
if (!addr)
|
||||
return NULL;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user