Skip to content

virtio-net: fix use after unmap/free for sg#1379

Open
AndrewFasano wants to merge 1 commit into
devfrom
upstream_cve
Open

virtio-net: fix use after unmap/free for sg#1379
AndrewFasano wants to merge 1 commit into
devfrom
upstream_cve

Conversation

@AndrewFasano

Copy link
Copy Markdown
Contributor

Cherry-picked commit bedd7e9 from upstream to address #1378. In general, we're not in the business of backporting upstream qemu code to PANDA, but if this single commit doesn't break anything it's easy enough to merge.

When mergeable buffer is enabled, we try to set the num_buffers after
the virtqueue elem has been unmapped. This will lead several issues,
E.g a use after free when the descriptor has an address which belongs
to the non direct access region. In this case we use bounce buffer
that is allocated during address_space_map() and freed during
address_space_unmap().

Fixing this by storing the elems temporarily in an array and delay the
unmap after we set the the num_buffers.

This addresses CVE-2021-3748.

Reported-by: Alexander Bulekov <alxndr@bu.edu>
Fixes: fbe78f4 ("virtio-net support")
Cc: qemu-stable@nongnu.org
Signed-off-by: Jason Wang <jasowang@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants