linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 00/17] Add validation for used length
@ 2021-05-17  9:08 Xie Yongji
  2021-05-17  9:08 ` [RFC PATCH 01/17] virtio_ring: Avoid reading unneeded " Xie Yongji
                   ` (17 more replies)
  0 siblings, 18 replies; 27+ messages in thread
From: Xie Yongji @ 2021-05-17  9:08 UTC (permalink / raw)
  To: mst, jasowang, stefanha
  Cc: amit, arei.gonglei, airlied, kraxel, dan.j.williams, johannes,
	ohad, bjorn.andersson, david, vgoyal, miklos, sgarzare,
	virtualization, linux-kernel

Current virtio device drivers may trust the used length returned
in virtqueue_get_buf()/virtqueue_get_buf_ctx(). But the used length
might come from an untrusted device when VDUSE[1] is enabled. To
protect this case, this series tries to add validation for the
used length.

Since many legacy devices will also set the used length incorrectly,
we did not add the validation unconditionally. Instead, we will do
the validation only when the device driver needs the used length.
A NULL len passed to virtqueue_get_buf()/virtqueue_get_buf_ctx()
will mean the used length is not needed by the device driver.

[1] https://lore.kernel.org/kvm/20210331080519.172-1-xieyongji@bytedance.com/

Xie Yongji (17):
  virtio_ring: Avoid reading unneeded used length
  virtio-blk: Remove unused used length
  virtio_console: Remove unused used length
  crypto: virtio - Remove unused used length
  drm/virtio: Remove unused used length
  caif_virtio: Remove unused used length
  virtio_net: Remove unused used length
  mac80211_hwsim: Remove unused used length
  virtio_pmem: Remove unused used length
  rpmsg: virtio: Remove unused used length
  virtio_scsi: Remove unused used length
  virtio_balloon: Remove unused used length
  virtio_input: Remove unused used length
  virtio_mem: Remove unused used length
  virtiofs: Remove unused used length
  vsock: Remove unused used length
  virtio_ring: Add validation for used length

 drivers/block/virtio_blk.c                 |  3 +--
 drivers/char/virtio_console.c              | 12 ++++--------
 drivers/crypto/virtio/virtio_crypto_algs.c |  6 ++----
 drivers/gpu/drm/virtio/virtgpu_vq.c        |  3 +--
 drivers/net/caif/caif_virtio.c             |  3 +--
 drivers/net/virtio_net.c                   | 10 ++++------
 drivers/net/wireless/mac80211_hwsim.c      |  3 +--
 drivers/nvdimm/nd_virtio.c                 |  3 +--
 drivers/rpmsg/virtio_rpmsg_bus.c           |  3 +--
 drivers/scsi/virtio_scsi.c                 |  3 +--
 drivers/virtio/virtio_balloon.c            | 21 ++++++++++-----------
 drivers/virtio/virtio_input.c              |  6 ++----
 drivers/virtio/virtio_mem.c                |  3 +--
 drivers/virtio/virtio_ring.c               | 28 +++++++++++++++++++++++-----
 fs/fuse/virtio_fs.c                        |  6 ++----
 net/vmw_vsock/virtio_transport.c           |  3 +--
 16 files changed, 56 insertions(+), 60 deletions(-)

-- 
2.11.0


^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2021-05-25  5:08 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-17  9:08 [RFC PATCH 00/17] Add validation for used length Xie Yongji
2021-05-17  9:08 ` [RFC PATCH 01/17] virtio_ring: Avoid reading unneeded " Xie Yongji
2021-05-17  9:11   ` Johannes Berg
2021-05-17  9:41     ` Yongji Xie
2021-05-17  9:08 ` [RFC PATCH 02/17] virtio-blk: Remove unused " Xie Yongji
2021-05-17  9:08 ` [RFC PATCH 03/17] virtio_console: " Xie Yongji
2021-05-17  9:08 ` [RFC PATCH 04/17] crypto: virtio - " Xie Yongji
2021-05-17  9:08 ` [RFC PATCH 05/17] drm/virtio: " Xie Yongji
2021-05-17  9:08 ` [RFC PATCH 06/17] caif_virtio: " Xie Yongji
2021-05-17  9:08 ` [RFC PATCH 07/17] virtio_net: " Xie Yongji
2021-05-17  9:08 ` [RFC PATCH 08/17] mac80211_hwsim: " Xie Yongji
2021-05-17  9:08 ` [RFC PATCH 09/17] virtio_pmem: " Xie Yongji
2021-05-17  9:08 ` [RFC PATCH 10/17] rpmsg: virtio: " Xie Yongji
2021-05-17  9:08 ` [RFC PATCH 11/17] virtio_scsi: " Xie Yongji
2021-05-17  9:08 ` [RFC PATCH 12/17] virtio_balloon: " Xie Yongji
2021-05-17  9:08 ` [RFC PATCH 13/17] virtio_input: " Xie Yongji
2021-05-17  9:08 ` [RFC PATCH 14/17] virtio_mem: " Xie Yongji
2021-05-17  9:08 ` [RFC PATCH 15/17] virtiofs: " Xie Yongji
2021-05-17  9:08 ` [RFC PATCH 16/17] vsock: " Xie Yongji
2021-05-17  9:08 ` [RFC PATCH 17/17] virtio_ring: Add validation for " Xie Yongji
2021-05-17 23:39   ` Michael S. Tsirkin
2021-05-25  1:31     ` Jason Wang
2021-05-25  5:08       ` Yongji Xie
2021-05-17 23:40 ` [RFC PATCH 00/17] " Michael S. Tsirkin
2021-05-18  8:29   ` Yongji Xie
2021-05-18  9:52     ` Michael S. Tsirkin
2021-05-18 12:28       ` Yongji Xie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).