Skip to contentSkip to conversation

virtio: document virtio hardening status and TODO

RFC PATCH In review Jason Wang 3 participants 4 messages Oct 14, 2022 – Oct 18, 2022

Subsystems (2)
lore
Share & tools
lore

Jason Wang

author
#0 lore raw

RFC PATCH 1/1 virtio: document virtio hardening status and TODO

This patch summarizes the status of hardening and TODO of hardening virtio core and drivers.

---
 Documentation/security/virtio/core.rst | 49 ++++++++++++++++++++++++++
 MAINTAINERS                            |  1 +
 2 files changed, 50 insertions(+)
 create mode 100644 Documentation/security/virtio/core.rst
Documentation/security/virtio/core.rst new file +49 -0
new file mode 100644
index 000000000000..b8baa104d7c8
@@ -0,0 +1,49 @@
+================
+Virtio hardening
+================
+
+The virtio core and drivers should not trust the devices. This means
+all kinds of input from the device must be validated before being
+used. This document summarizes the current status and TODO for this
+validation/hardening efforts.
+
+
+Status
+======
+
+The virtio core and drivers has done some basic hardening:
+
+* Config callback hardening: The core makes sure the config interrupt
+  callbacks are enabled after the driver is ready and disable before
+  the driver is removed.
+
+* Descriptor ring hardening: The metadata of a descriptor were copied
+  and stored in a driver private memory that can not be accessed by the
+  device. The eliminates the device triggerable behaviours through the
+  descriptor ring.
+
+* Device configuration space validation: Some of the virtio drivers
+  validates the fields of device configuration space before try to use
+  them.
+
+
+TODO
+====
+
+* Input buffer length validation: The virtio core needs to validate
+  the input buffer length validation before passing them to individual
+  virtio drivers.
+
+* Virtqueue callback hardening: The virtio core (or with the help of
+  the drivers) should guarantee that the virtqueue callbacks should not
+  be triggered before the driver is ready or after the driver is
+  removed.
+
+* Transport specific data validation: The virtio transport driver should
+  validate the virtio transport specific data provided by the device
+  before trying to use them in the probing.
+
+* Device specific validation: Driver should validate the device specific
+  metadata before being used by a specific subsystem.
+
+
MAINTAINERS +1 -0
index 673b9f9b8d8a..b33cc5c751c1 100644
@@ -21516,6 +21516,7 @@ S:	Maintained
 F:	Documentation/ABI/testing/sysfs-bus-vdpa
 F:	Documentation/ABI/testing/sysfs-class-vduse
 F:	Documentation/devicetree/bindings/virtio/
+F:	Documentation/security/virtio/core.rst
 F:	drivers/block/virtio_blk.c
 F:	drivers/crypto/virtio/
 F:	drivers/net/virtio_net.c
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 9 lines · Jason Wang

This patch summarizes the status of hardening and TODO of hardening virtio core and drivers.

---
 Documentation/security/virtio/core.rst | 49 ++++++++++++++++++++++++++
 MAINTAINERS                            |  1 +
 2 files changed, 50 insertions(+)
 create mode 100644 Documentation/security/virtio/core.rst

Do you really need to create a new directory for a single file?

Regardless of where it sits, you'll need to add this file to an index.rst file so that it becomes part of the docs build.

Thanks,

jon
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

author
#2 lore raw
Quoted 6 lines · Jonathan Corbet
Quoted 3 lines · Jason Wang

This patch summarizes the status of hardening and TODO of hardening virtio core and drivers.

Quoted 9 lines
Quoted 6 lines
---
 Documentation/security/virtio/core.rst | 49 ++++++++++++++++++++++++++
 MAINTAINERS                            |  1 +
 2 files changed, 50 insertions(+)
 create mode 100644 Documentation/security/virtio/core.rst

Do you really need to create a new directory for a single file?

Not sure, but I think we can start without a dedicated directory.

Quoted 2 lines

Regardless of where it sits, you'll need to add this file to an index.rst file so that it becomes part of the docs build.

Yes, I will fix it.

Thanks

Quoted 5 lines

Thanks,

jon

#3 lore raw
In reply to Jason Wang

I'm not a native speaker, so the following suggestions can be wrong :-)

Quoted 16 lines · Jason Wang

This patch summarizes the status of hardening and TODO of hardening virtio core and drivers.

---
Documentation/security/virtio/core.rst | 49 ++++++++++++++++++++++++++
MAINTAINERS | 1 +

2 files changed, 50 insertions(+)

create mode 100644 Documentation/security/virtio/core.rst

Documentation/security/virtio/core.rst new file +0 -0
new file mode 100644
index 000000000000..b8baa104d7c8

Documentation/security/virtio/core.rst line 8

Quoted 8 lines
Documentation/security/virtio/core.rst new file +8 -0
@@ -0,0 +1,49 @@
+================
+Virtio hardening
+================
+
+The virtio core and drivers should not trust the devices. This means
+all kinds of input from the device must be validated before being
+used. This document summarizes the current status and TODO for this
+validation/hardening efforts.

s/efforts/effort

Quoted 4 lines
Documentation/security/virtio/core.rst new file +4 -0
+
+
+Status
+======

Documentation/security/virtio/core.rst line 22

Quoted 10 lines
Documentation/security/virtio/core.rst new file +10 -0
+
+The virtio core and drivers has done some basic hardening:
+
+* Config callback hardening: The core makes sure the config interrupt
+  callbacks are enabled after the driver is ready and disable before
+  the driver is removed.
+
+* Descriptor ring hardening: The metadata of a descriptor were copied
+  and stored in a driver private memory that can not be accessed by the
+  device. The eliminates the device triggerable behaviours through the

s/The/This ? (not sure)
)

Documentation/security/virtio/core.rst line 26

Quoted 4 lines
Documentation/security/virtio/core.rst new file +4 -0
+  descriptor ring.
+
+* Device configuration space validation: Some of the virtio drivers
+  validates the fields of device configuration space before try to use

s/validates/validate

Documentation/security/virtio/core.rst line 34

Quoted 8 lines
Documentation/security/virtio/core.rst new file +8 -0
+  them.
+
+
+TODO
+====
+
+* Input buffer length validation: The virtio core needs to validate
+  the input buffer length validation before passing them to individual

Remove "validation"?

Documentation/security/virtio/core.rst line 44

Quoted 10 lines
Documentation/security/virtio/core.rst new file +10 -0
+  virtio drivers.
+
+* Virtqueue callback hardening: The virtio core (or with the help of
+  the drivers) should guarantee that the virtqueue callbacks should not
+  be triggered before the driver is ready or after the driver is
+  removed.
+
+* Transport specific data validation: The virtio transport driver should
+  validate the virtio transport specific data provided by the device
+  before trying to use them in the probing.

s/in the probing/during the probe ?

Quoted 10 lines
Documentation/security/virtio/core.rst new file +5 -0
+
+* Device specific validation: Driver should validate the device specific
+  metadata before being used by a specific subsystem.
+
+
MAINTAINERS +0 -0
index 673b9f9b8d8a..b33cc5c751c1 100644
@@ -21516,6 +21516,7 @@ S:	Maintained
Quoted 10 lines

F: Documentation/ABI/testing/sysfs-bus-vdpa
F: Documentation/ABI/testing/sysfs-class-vduse
F: Documentation/devicetree/bindings/virtio/
+F: Documentation/security/virtio/core.rst
F: drivers/block/virtio_blk.c
F: drivers/crypto/virtio/
F: drivers/net/virtio_net.c

Signature · 1 line
2.25.1

Thanks,
Stefano

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization