balloon: add VIRTIO_BALLOON_F_DEVICE_INIT_ON_INFLATE and Security Considerations
PATCH v2 1/1 balloon: add VIRTIO_BALLOON_F_DEVICE_INIT_ON_INFLATE and Security Considerations
Add VIRTIO_BALLOON_F_DEVICE_INIT_ON_INFLATE (bit 6): the device initializes inflated pages and returns a per-page bitmap indicating which pages were successfully initialized.
When negotiated, the driver appends a device-writable bitmap buffer to each inflate descriptor chain. Bit N corresponds to PFN N. The device sets a bit to 1 if it successfully initialized the page.
Also add Security Considerations section for the balloon device, covering information leakage and data integrity concerns with untrusted devices.
---
Changes from v1:
- reporting does not need a feature bit! we already have all info
- in practice hypervisors zero (unmap) on inflate. change spec to match
content.tex | 28 ++++-- device-types/balloon/description.tex | 100 ++++++++++++++++++++ device-types/balloon/device-conformance.tex | 2 + device-types/balloon/driver-conformance.tex | 2 + 4 files changed, 125 insertions(+), 7 deletions(-)
content.tex +21 -7
@@ -39,7 +39,7 @@ \section{\field{Device Status} Field}\label{sec:Basic Facilities of a Virtio Dev \item[DRIVER_OK (4)] Indicates that the driver is set up and ready to drive the device. -\item[FEATURES_OK (8)] Indicates that the driver has acknowledged all the +\item[FEATURES_OK (8)] Indicates that the driver has accepted all the features it understands, and feature negotiation is complete. \item[SUSPEND (16)] When VIRTIO_F_SUSPEND is negotiated, indicates that the
@@ -89,13 +89,16 @@ \section{Feature Bits}\label{sec:Basic Facilities of a Virtio Device / Feature B Each virtio device offers all the features it understands. During device initialization, the driver reads this and tells the device the -subset that it accepts. The only way to renegotiate is to reset -the device. +subset that it accepts. The device validates this subset and +either completes the negotiation successfully (the last subset of features +that the driver accepted is considered negotiated then) or fails, +leaving the feature negotiation incomplete. Once the negotiation is +complete, the only way to renegotiate is to reset the device. This allows for forwards and backwards compatibility: if the device is enhanced with a new feature bit, older drivers will not write that feature bit back to the device. Similarly, if a driver is enhanced with a feature -that the device doesn't support, it see the new feature is not offered. +that the device doesn't support, it will see that the new feature is not offered. Feature bits are allocated as follows:
@@ -189,8 +192,8 @@ \subsection{Legacy Interface: A Note on Feature Transitional Drivers MUST detect Legacy Devices by detecting that the feature bit VIRTIO_F_VERSION_1 is not offered. -Transitional devices MUST detect Legacy drivers by detecting that -VIRTIO_F_VERSION_1 has not been acknowledged by the driver. +Transitional devices MUST detect Legacy drivers, e.g. by detecting that +VIRTIO_F_VERSION_1 has not been accepted by the driver. In this case device is used through the legacy interface.
@@ -314,6 +317,11 @@ \section{Device Configuration Space}\label{sec:Basic Facilities of a Virtio Devi greater than the specified 8-bit size. \end{note} +\drivernormative{\subsection}{Device Configuration Space}{Basic Facilities of a Virtio Device / Device Configuration Space} +Before reading a device-specific configuration field that is +conditional on a feature bit, the driver SHOULD first accept +that feature bit. + \devicenormative{\subsection}{Device Configuration Space}{Basic Facilities of a Virtio Device / Device Configuration Space} The device MUST allow reading of any device-specific configuration field before FEATURES_OK is set by the driver. This includes fields which are
@@ -530,7 +538,13 @@ \section{Device Initialization}\label{sec:General Initialization And Device Oper \item\label{itm:General Initialization And Device Operation / Device Initialization / Read feature bits} Read device feature bits, and write the subset of feature bits understood by the OS and driver to the device. During this step the - driver MAY read (but MUST NOT write) the device-specific configuration fields to check that it can support the device before accepting it. + driver MAY read (but MUST NOT write) the device-specific configuration + fields to check that it can support the device before setting FEATURES_OK. + The driver SHOULD accept feature bits before reading configuration + fields conditional on them. The driver MAY then accept a different + subset of feature bits (e.g., deciding, based on the configuration + fields, not to use a certain feature), tell the device about the + updated subset, and repeat this process. \item\label{itm:General Initialization And Device Operation / Device Initialization / Set FEATURES-OK} Set the FEATURES_OK status bit. The driver MUST NOT accept new feature bits after this step.
device-types/balloon/description.tex +100 -0
109 lines not on this page · raw message
device-types/balloon/device-conformance.tex +2 -0
@@ -9,4 +9,6 @@ \item \ref{devicenormative:Device Types / Memory Balloon Device / Device Operation / Free Page Hinting} \item \ref{devicenormative:Device Types / Memory Balloon Device / Device Operation / Page Poison} \item \ref{devicenormative:Device Types / Memory Balloon Device / Device Operation / Free Page Reporting} +\item \ref{devicenormative:Device Types / Memory Balloon Device / Device Operation / Device Initialized Reported Pages} +\item \ref{devicenormative:Device Types / Memory Balloon Device / Device Operation / Device Initialized Deflated Pages} \end{itemize}
device-types/balloon/driver-conformance.tex +2 -0
@@ -9,4 +9,6 @@ \item \ref{drivernormative:Device Types / Memory Balloon Device / Device Operation / Free Page Hinting} \item \ref{drivernormative:Device Types / Memory Balloon Device / Device Operation / Page Poison} \item \ref{drivernormative:Device Types / Memory Balloon Device / Device Operation / Free Page Reporting} +\item \ref{drivernormative:Device Types / Memory Balloon Device / Device Operation / Device Initialized Reported Pages} +\item \ref{drivernormative:Device Types / Memory Balloon Device / Device Operation / Device Initialized Deflated Pages} \end{itemize}
Signature · 1 line
MST