All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 kvmtool 0/5] Fix few small issues in virtio code
@ 2022-03-03 23:10 Martin Radev
  2022-03-03 23:10 ` [PATCH kvmtool 1/5] kvmtool: Add WARN_ONCE macro Martin Radev
                   ` (6 more replies)
  0 siblings, 7 replies; 24+ messages in thread
From: Martin Radev @ 2022-03-03 23:10 UTC (permalink / raw)
  To: kvm, will, julien.thierry.kdev, andre.przywara, alexandru.elisei
  Cc: Martin Radev

Hello everyone,

Thanks for the reviews in the first patch set.

This is the second version of the original patch set which addresses
few found overflows in the common virtio code. Since the first version,
the following changes were made:
- the virtio_net warning patch was removed.
- a WARN_ONCE macro is added to help signal that an issue was observed,
  but without polluting the log.
- a couple of improvements in sanitization and style.
- TODO comment for missing handling of multi-byte PCI accesses.

The Makefile change is kept in its original form because I didn't understand
if there is an issue with it on aarch64.

Martin Radev (5):
  kvmtool: Add WARN_ONCE macro
  virtio: Sanitize config accesses
  virtio: Check for overflows in QUEUE_NOTIFY and QUEUE_SEL
  Makefile: Mark stack as not executable
  mmio: Sanitize addr and len

 Makefile                |  7 +++--
 include/kvm/util.h      | 10 +++++++
 include/kvm/virtio-9p.h |  1 +
 include/kvm/virtio.h    |  3 ++-
 mmio.c                  |  4 +++
 virtio/9p.c             | 27 ++++++++++++++-----
 virtio/balloon.c        | 10 ++++++-
 virtio/blk.c            | 10 ++++++-
 virtio/console.c        | 10 ++++++-
 virtio/mmio.c           | 44 +++++++++++++++++++++++++-----
 virtio/net.c            | 12 +++++++--
 virtio/pci.c            | 59 ++++++++++++++++++++++++++++++++++++++---
 virtio/rng.c            |  8 +++++-
 virtio/scsi.c           | 10 ++++++-
 virtio/vsock.c          | 10 ++++++-
 15 files changed, 199 insertions(+), 26 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 24+ messages in thread
* [PATCH kvmtool 0/5] kvmtool: Fix few found bugs
@ 2022-01-17 22:11 Martin Radev
  2022-01-17 22:12 ` [PATCH kvmtool 5/5] mmio: Sanitize addr and len Martin Radev
  0 siblings, 1 reply; 24+ messages in thread
From: Martin Radev @ 2022-01-17 22:11 UTC (permalink / raw)
  To: kvm; +Cc: will, julien.thierry.kdev, Martin Radev

In December, we hosted a CTF where one of the challenges was exploiting
any "0day" bug in kvmtool [1]. Eight teams managed to find a bug and
exploit it in less than 36 hours. Write-ups for exploits are available
by HXP [2] and kalmarunionen [3]. 

Now, I'm aware that kvmtool is mostly used for KVM testing and KVM bring-up
in simulation environments. But since it does get mentioned in some security-
related projects [4, 5] and has a sandboxing feature, maybe it makes sense
to fix these bugs.

Could you please check if these patches make sense?
I have not verified that these patches do not break something for these virtio
drivers.

Kind regards,
Martin

[1]: https://2021.ctf.link/internal/challenge/dd0e8826-c970-4fde-8eeb-41a9d8a86b67/
[2]: https://hxp.io/blog/87/hxp-CTF-2021-indie_vmm-writeup/
[3]: https://www.kalmarunionen.dk/writeups/2021/hxp-2021/lkvm/
[4]: https://blog.quarkslab.com/no-tears-no-fears.html
[5]: https://fly.io/blog/sandboxing-and-workload-isolation/

Martin Radev (5):
  virtio: Sanitize config accesses
  virtio: Check for overflows in QUEUE_NOTIFY and QUEUE_SEL
  virtio/net: Warn if virtio_net is implicitly enabled
  Makefile: Mark stack as not executable
  mmio: Sanitize addr and len

 Makefile                |  7 +++++--
 include/kvm/virtio-9p.h |  1 +
 include/kvm/virtio.h    |  3 ++-
 mmio.c                  |  4 ++++
 virtio/9p.c             | 21 ++++++++++++++++----
 virtio/balloon.c        |  8 +++++++-
 virtio/blk.c            |  8 +++++++-
 virtio/console.c        |  8 +++++++-
 virtio/mmio.c           | 44 ++++++++++++++++++++++++++++++++++-------
 virtio/net.c            | 11 ++++++++++-
 virtio/pci.c            | 40 +++++++++++++++++++++++++++++++++----
 virtio/rng.c            |  8 +++++++-
 virtio/scsi.c           |  8 +++++++-
 virtio/vsock.c          |  8 +++++++-
 14 files changed, 154 insertions(+), 25 deletions(-)

-- 
2.25.1


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

end of thread, other threads:[~2022-05-06 13:20 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-03 23:10 [PATCH v2 kvmtool 0/5] Fix few small issues in virtio code Martin Radev
2022-03-03 23:10 ` [PATCH kvmtool 1/5] kvmtool: Add WARN_ONCE macro Martin Radev
2022-03-03 23:10 ` [PATCH kvmtool 2/5] virtio: Sanitize config accesses Martin Radev
2022-03-16 13:04   ` Alexandru Elisei
2022-03-27 20:37     ` Martin Radev
2022-04-22 10:12       ` Alexandru Elisei
2022-03-03 23:10 ` [PATCH kvmtool 3/5] virtio: Check for overflows in QUEUE_NOTIFY and QUEUE_SEL Martin Radev
2022-03-16 15:38   ` Alexandru Elisei
2022-03-27 20:45     ` Martin Radev
2022-04-22 10:35       ` Alexandru Elisei
2022-03-03 23:10 ` [PATCH kvmtool 4/5] Makefile: Mark stack as not executable Martin Radev
2022-03-03 23:10 ` [PATCH kvmtool 5/5] mmio: Sanitize addr and len Martin Radev
2022-03-16 15:39   ` Alexandru Elisei
2022-03-27 21:00     ` Martin Radev
2022-04-22 10:36       ` Alexandru Elisei
2022-03-10 14:56 ` [PATCH v2 kvmtool 0/5] Fix few small issues in virtio code Alexandru Elisei
2022-03-11 11:23   ` Andre Przywara
2022-03-14 17:11     ` Alexandru Elisei
2022-03-27 12:46       ` Martin Radev
2022-04-22 10:37         ` Alexandru Elisei
2022-05-06 13:20 ` Will Deacon
  -- strict thread matches above, loose matches on Subject: below --
2022-01-17 22:11 [PATCH kvmtool 0/5] kvmtool: Fix few found bugs Martin Radev
2022-01-17 22:12 ` [PATCH kvmtool 5/5] mmio: Sanitize addr and len Martin Radev
2022-02-01 15:34   ` Alexandru Elisei
2022-02-01 15:52   ` Andre Przywara

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.