|
|
a83cc2 |
From 0739f735f99a6f1760a422023c262c1aa542a2e5 Mon Sep 17 00:00:00 2001
|
|
|
a83cc2 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
a83cc2 |
Date: Fri, 9 Jul 2021 18:41:41 +0200
|
|
|
a83cc2 |
Subject: [PATCH 19/43] block: Add option to use driver whitelist even in tools
|
|
|
a83cc2 |
MIME-Version: 1.0
|
|
|
a83cc2 |
Content-Type: text/plain; charset=UTF-8
|
|
|
a83cc2 |
Content-Transfer-Encoding: 8bit
|
|
|
a83cc2 |
|
|
|
a83cc2 |
RH-Author: Kevin Wolf <None>
|
|
|
a83cc2 |
RH-MergeRequest: 26: block: Disable unsupported/read-only block drivers even in tools
|
|
|
a83cc2 |
RH-Commit: [1/2] 6755d5ff4ef43f275ae530de2b2a568ffd2d3497 (kmwolf/centos-qemu-kvm)
|
|
|
a83cc2 |
RH-Bugzilla: 1957782
|
|
|
a83cc2 |
RH-Acked-by: Max Reitz <None>
|
|
|
a83cc2 |
RH-Acked-by: Richard W.M. Jones <None>
|
|
|
a83cc2 |
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
|
|
a83cc2 |
|
|
|
a83cc2 |
Currently, the block driver whitelists are only applied for the system
|
|
|
a83cc2 |
emulator. All other binaries still give unrestricted access to all block
|
|
|
a83cc2 |
drivers. There are use cases where this made sense because the main
|
|
|
a83cc2 |
concern was avoiding customers running VMs on less optimised block
|
|
|
a83cc2 |
drivers and getting bad performance. Allowing the same image format e.g.
|
|
|
a83cc2 |
as a target for 'qemu-img convert' is not a problem then.
|
|
|
a83cc2 |
|
|
|
a83cc2 |
However, if the concern is the supportability of the driver in general,
|
|
|
a83cc2 |
either in full or when used read-write, not applying the list driver
|
|
|
a83cc2 |
whitelist in tools doesn't help - especially since qemu-nbd and
|
|
|
a83cc2 |
qemu-storage-daemon now give access to more or less the same operations
|
|
|
a83cc2 |
in block drivers as running a system emulator.
|
|
|
a83cc2 |
|
|
|
a83cc2 |
In order to address this, introduce a new configure option that enforces
|
|
|
a83cc2 |
the driver whitelist in all binaries.
|
|
|
a83cc2 |
|
|
|
a83cc2 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
a83cc2 |
Message-Id: <20210709164141.254097-1-kwolf@redhat.com>
|
|
|
a83cc2 |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
a83cc2 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
a83cc2 |
(cherry picked from commit e5f05f8c375157211c7da625a0d3f3ccdb4957d5)
|
|
|
a83cc2 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
a83cc2 |
---
|
|
|
a83cc2 |
block.c | 3 +++
|
|
|
a83cc2 |
configure | 14 ++++++++++++--
|
|
|
a83cc2 |
meson.build | 1 +
|
|
|
a83cc2 |
3 files changed, 16 insertions(+), 2 deletions(-)
|
|
|
a83cc2 |
|
|
|
a83cc2 |
diff --git a/block.c b/block.c
|
|
|
a83cc2 |
index c5b887cec1..76ecede5af 100644
|
|
|
a83cc2 |
--- a/block.c
|
|
|
a83cc2 |
+++ b/block.c
|
|
|
a83cc2 |
@@ -5817,6 +5817,9 @@ BlockDriverState *bdrv_find_backing_image(BlockDriverState *bs,
|
|
|
a83cc2 |
|
|
|
a83cc2 |
void bdrv_init(void)
|
|
|
a83cc2 |
{
|
|
|
a83cc2 |
+#ifdef CONFIG_BDRV_WHITELIST_TOOLS
|
|
|
a83cc2 |
+ use_bdrv_whitelist = 1;
|
|
|
a83cc2 |
+#endif
|
|
|
a83cc2 |
module_call_init(MODULE_INIT_BLOCK);
|
|
|
a83cc2 |
}
|
|
|
a83cc2 |
|
|
|
a83cc2 |
diff --git a/configure b/configure
|
|
|
a83cc2 |
index 53b2fa583a..7edc08afb3 100755
|
|
|
a83cc2 |
--- a/configure
|
|
|
a83cc2 |
+++ b/configure
|
|
|
a83cc2 |
@@ -243,6 +243,7 @@ cross_prefix=""
|
|
|
a83cc2 |
audio_drv_list=""
|
|
|
a83cc2 |
block_drv_rw_whitelist=""
|
|
|
a83cc2 |
block_drv_ro_whitelist=""
|
|
|
a83cc2 |
+block_drv_whitelist_tools="no"
|
|
|
a83cc2 |
host_cc="cc"
|
|
|
a83cc2 |
audio_win_int=""
|
|
|
a83cc2 |
libs_qga=""
|
|
|
a83cc2 |
@@ -1029,6 +1030,10 @@ for opt do
|
|
|
a83cc2 |
;;
|
|
|
a83cc2 |
--block-drv-ro-whitelist=*) block_drv_ro_whitelist=$(echo "$optarg" | sed -e 's/,/ /g')
|
|
|
a83cc2 |
;;
|
|
|
a83cc2 |
+ --enable-block-drv-whitelist-in-tools) block_drv_whitelist_tools="yes"
|
|
|
a83cc2 |
+ ;;
|
|
|
a83cc2 |
+ --disable-block-drv-whitelist-in-tools) block_drv_whitelist_tools="no"
|
|
|
a83cc2 |
+ ;;
|
|
|
a83cc2 |
--enable-debug-tcg) debug_tcg="yes"
|
|
|
a83cc2 |
;;
|
|
|
a83cc2 |
--disable-debug-tcg) debug_tcg="no"
|
|
|
a83cc2 |
@@ -1764,10 +1769,12 @@ Advanced options (experts only):
|
|
|
a83cc2 |
--block-drv-whitelist=L Same as --block-drv-rw-whitelist=L
|
|
|
a83cc2 |
--block-drv-rw-whitelist=L
|
|
|
a83cc2 |
set block driver read-write whitelist
|
|
|
a83cc2 |
- (affects only QEMU, not qemu-img)
|
|
|
a83cc2 |
+ (by default affects only QEMU, not tools like qemu-img)
|
|
|
a83cc2 |
--block-drv-ro-whitelist=L
|
|
|
a83cc2 |
set block driver read-only whitelist
|
|
|
a83cc2 |
- (affects only QEMU, not qemu-img)
|
|
|
a83cc2 |
+ (by default affects only QEMU, not tools like qemu-img)
|
|
|
a83cc2 |
+ --enable-block-drv-whitelist-in-tools
|
|
|
a83cc2 |
+ use block whitelist also in tools instead of only QEMU
|
|
|
a83cc2 |
--enable-trace-backends=B Set trace backend
|
|
|
a83cc2 |
Available backends: $trace_backend_list
|
|
|
a83cc2 |
--with-trace-file=NAME Full PATH,NAME of file to store traces
|
|
|
a83cc2 |
@@ -5571,6 +5578,9 @@ if test "$audio_win_int" = "yes" ; then
|
|
|
a83cc2 |
fi
|
|
|
a83cc2 |
echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak
|
|
|
a83cc2 |
echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak
|
|
|
a83cc2 |
+if test "$block_drv_whitelist_tools" = "yes" ; then
|
|
|
a83cc2 |
+ echo "CONFIG_BDRV_WHITELIST_TOOLS=y" >> $config_host_mak
|
|
|
a83cc2 |
+fi
|
|
|
a83cc2 |
if test "$xfs" = "yes" ; then
|
|
|
a83cc2 |
echo "CONFIG_XFS=y" >> $config_host_mak
|
|
|
a83cc2 |
fi
|
|
|
a83cc2 |
diff --git a/meson.build b/meson.build
|
|
|
a83cc2 |
index 06c15bd6d2..49b8164ade 100644
|
|
|
a83cc2 |
--- a/meson.build
|
|
|
a83cc2 |
+++ b/meson.build
|
|
|
a83cc2 |
@@ -2606,6 +2606,7 @@ summary_info += {'coroutine pool': config_host['CONFIG_COROUTINE_POOL'] == '1
|
|
|
a83cc2 |
if have_block
|
|
|
a83cc2 |
summary_info += {'Block whitelist (rw)': config_host['CONFIG_BDRV_RW_WHITELIST']}
|
|
|
a83cc2 |
summary_info += {'Block whitelist (ro)': config_host['CONFIG_BDRV_RO_WHITELIST']}
|
|
|
a83cc2 |
+ summary_info += {'Use block whitelist in tools': config_host.has_key('CONFIG_BDRV_WHITELIST_TOOLS')}
|
|
|
a83cc2 |
summary_info += {'VirtFS support': have_virtfs}
|
|
|
a83cc2 |
summary_info += {'build virtiofs daemon': have_virtiofsd}
|
|
|
a83cc2 |
summary_info += {'Live block migration': config_host.has_key('CONFIG_LIVE_BLOCK_MIGRATION')}
|
|
|
a83cc2 |
--
|
|
|
a83cc2 |
2.27.0
|
|
|
a83cc2 |
|