提交 bc858f46 编写于 作者: C Cole Robinson

conf: Drop restrictions on rng backend path

Currently we only allow /dev/random and /dev/hwrng as host input
for <rng><backend model='random'/> device. This was added after
various upstream discussions in commit 4932ef45

However this restriction has generated quite a few complaints over
the years, so a new discussion was initiated:

http://www.redhat.com/archives/libvir-list/2016-April/msg00987.html

Several people suggested removing the restriction, and nobody really
spoke up to defend it. So this patch drops the path restriction
entirely

https://bugzilla.redhat.com/show_bug.cgi?id=1074464
(cherry picked from commit 67f2b727)
上级 b68f421a
...@@ -6116,31 +6116,28 @@ qemu-kvm -net nic,model=? /dev/null ...@@ -6116,31 +6116,28 @@ qemu-kvm -net nic,model=? /dev/null
to be used for the domain. The source model is configured using the to be used for the domain. The source model is configured using the
<code>model</code> attribute. Supported source models are: <code>model</code> attribute. Supported source models are:
</p> </p>
<ul> <dl>
<li>'random' &mdash; /dev/random (default) or /dev/hwrng <dt><code>random</code></dt>
device as source (for now, no other sources are permitted)</li> <dd>
<li>'egd' &mdash; a EGD protocol backend</li> <p>
</ul> This backend type expects a non-blocking character device as
</dd> input. The file name is specified as contents of the
<dt><code>backend model='random'</code></dt> <code>backend</code> element. When no file name is specified
<dd> the hypervisor default is used. For qemu, the default is
<p> /dev/random
This backend type expects a non-blocking character device as input. </p>
The only accepted paths are /dev/random and /dev/hwrng. The file </dd>
name is specified as contents of the <code>backend</code> element. <dt><code>egd</code></dt>
When no file name is specified the hypervisor default is used. <dd>
</p> <p>
</dd> This backend connects to a source using the EGD protocol.
<dt><code>backend model='egd'</code></dt> The source is specified as a character device. Refer to
<dd> <a href='#elementsCharHostInterface'>character device host interface</a>
<p> for more information.
This backend connects to a source using the EGD protocol. </p>
The source is specified as a character device. Refer to </dd>
<a href='#elementsCharHostInterface'>character device host interface</a> </dl>
for more information.
</p>
</dd> </dd>
</dl> </dl>
<h4><a name="elementsTpm">TPM device</a></h4> <h4><a name="elementsTpm">TPM device</a></h4>
......
...@@ -4671,8 +4671,7 @@ ...@@ -4671,8 +4671,7 @@
<value>random</value> <value>random</value>
</attribute> </attribute>
<choice> <choice>
<value>/dev/random</value> <ref name='absFilePath'/>
<value>/dev/hwrng</value>
<empty/> <empty/>
</choice> </choice>
</group> </group>
......
...@@ -11463,14 +11463,6 @@ virDomainRNGDefParseXML(xmlNodePtr node, ...@@ -11463,14 +11463,6 @@ virDomainRNGDefParseXML(xmlNodePtr node,
switch ((virDomainRNGBackend) def->backend) { switch ((virDomainRNGBackend) def->backend) {
case VIR_DOMAIN_RNG_BACKEND_RANDOM: case VIR_DOMAIN_RNG_BACKEND_RANDOM:
def->source.file = virXPathString("string(./backend)", ctxt); def->source.file = virXPathString("string(./backend)", ctxt);
if (def->source.file &&
STRNEQ(def->source.file, "/dev/random") &&
STRNEQ(def->source.file, "/dev/hwrng")) {
virReportError(VIR_ERR_XML_ERROR,
_("file '%s' is not a supported random source"),
def->source.file);
goto error;
}
break; break;
case VIR_DOMAIN_RNG_BACKEND_EGD: case VIR_DOMAIN_RNG_BACKEND_EGD:
......
...@@ -18,6 +18,6 @@ QEMU_AUDIO_DRV=none \ ...@@ -18,6 +18,6 @@ QEMU_AUDIO_DRV=none \
-boot c \ -boot c \
-usb \ -usb \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \ -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \
-object rng-random,id=objrng0,filename=/dev/hwrng \ -object rng-random,id=objrng0,filename=/dev/urandom \
-device virtio-rng-pci,rng=objrng0,id=rng0,max-bytes=123,period=1234,bus=pci.0,\ -device virtio-rng-pci,rng=objrng0,id=rng0,max-bytes=123,period=1234,bus=pci.0,\
addr=0x4 addr=0x4
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<memballoon model='virtio'/> <memballoon model='virtio'/>
<rng model='virtio'> <rng model='virtio'>
<rate bytes='123' period='1234'/> <rate bytes='123' period='1234'/>
<backend model='random'>/dev/hwrng</backend> <backend model='random'>/dev/urandom</backend>
</rng> </rng>
</devices> </devices>
</domain> </domain>
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
</memballoon> </memballoon>
<rng model='virtio'> <rng model='virtio'>
<rate bytes='123' period='1234'/> <rate bytes='123' period='1234'/>
<backend model='random'>/dev/hwrng</backend> <backend model='random'>/dev/urandom</backend>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</rng> </rng>
</devices> </devices>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册