]> git.ipfire.org Git - thirdparty/qemu.git/commit
Add -f FMT / --format FMT arg to qemu-nbd
authorDaniel P. Berrange <berrange@redhat.com>
Tue, 19 Mar 2013 11:20:20 +0000 (11:20 +0000)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Tue, 9 Apr 2013 15:00:20 +0000 (10:00 -0500)
commit6e8865313f56f54f5a3d3ad54f7b0b7c3587c4a9
tree7a16f084e3a5e11b1ac4eeb10ae629b182982c8d
parent6d0b135a981f052d50a5f151b4c0dde61e4db001
Add -f FMT / --format FMT arg to qemu-nbd

Currently the qemu-nbd program will auto-detect the format of
any disk it is given. This behaviour is known to be insecure.
For example, if qemu-nbd initially exposes a 'raw' file to an
unprivileged app, and that app runs

   'qemu-img create -f qcow2 -o backing_file=/etc/shadow /dev/nbd0'

then the next time the app is started, the qemu-nbd will now
detect it as a 'qcow2' file and expose /etc/shadow to the
unprivileged app.

The only way to avoid this is to explicitly tell qemu-nbd what
disk format to use on the command line, completely disabling
auto-detection. This patch adds a '-f' / '--format' arg for
this purpose, mirroring what is already available via qemu-img
and qemu commands.

  qemu-nbd --format raw -p 9000 evil.img

will now always use raw, regardless of what format 'evil.img'
looks like it contains

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
[Use errx, not err. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
*fixed conflict due to bdrv_open() not supporting "options" param
in v1.4.1

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
qemu-nbd.c
qemu-nbd.texi