All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] vl.c: disallow command line fw cfg without opt/
@ 2016-03-15 14:47 Michael S. Tsirkin
  2016-03-16 16:29 ` Markus Armbruster
  2016-03-17 10:09 ` Markus Armbruster
  0 siblings, 2 replies; 36+ messages in thread
From: Michael S. Tsirkin @ 2016-03-15 14:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Gerd Hoffmann

Allowing arbitary file names on command line is setting us up for
failure: future guests will look for a specific QEMU-specified name and
will get confused finding a user file there.

We do warn but people are conditioned to ignore warnings by now,
so at best that will help users debug problem, not avoid it.

Disable this by default, so distros don't get to deal with it,
but leave an option for developers to configure this in,
with scary warnings so people only do it if they know
what they are doing.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---

changes from v1:
    add configure option

 configure | 7 +++++++
 vl.c      | 3 +++
 2 files changed, 10 insertions(+)

diff --git a/configure b/configure
index 2b32876..e5a692f 100755
--- a/configure
+++ b/configure
@@ -256,6 +256,7 @@ sysconfdir="\${prefix}/etc"
 local_statedir="\${prefix}/var"
 confsuffix="/qemu"
 slirp="yes"
+unsafe_fw_cfg="no"
 oss_lib=""
 bsd="no"
 linux="no"
@@ -875,6 +876,8 @@ for opt do
   ;;
   --enable-vnc-png) vnc_png="yes"
   ;;
+  --enable-unsafe-fw-cfg) unsafe_fw_cfg="yes"
+  ;;
   --disable-slirp) slirp="no"
   ;;
   --disable-uuid) uuid="no"
@@ -1286,6 +1289,7 @@ Advanced options (experts only):
                            Available backends: $($python $source_path/scripts/tracetool.py --list-backends)
   --with-trace-file=NAME   Full PATH,NAME of file to store traces
                            Default:trace-<pid>
+  --enable-unsafe-fw-cfg   Enable loading fw cfg entries at unsafe paths (broken! don't use in production!)
   --disable-slirp          disable SLIRP userspace network connectivity
   --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)
   --oss-lib                path to OSS library
@@ -4911,6 +4915,9 @@ fi
 if test "$profiler" = "yes" ; then
   echo "CONFIG_PROFILER=y" >> $config_host_mak
 fi
+if test "$unsafe_fw_cfg" = "yes" ; then
+  echo "CONFIG_UNSAFE_FW_CFG=y" >> $config_host_mak
+fi
 if test "$slirp" = "yes" ; then
   echo "CONFIG_SLIRP=y" >> $config_host_mak
   echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
diff --git a/vl.c b/vl.c
index 7a28982..5adf217 100644
--- a/vl.c
+++ b/vl.c
@@ -2321,6 +2321,9 @@ static int parse_fw_cfg(void *opaque, QemuOpts *opts, Error **errp)
     if (strncmp(name, "opt/", 4) != 0) {
         error_report("warning: externally provided fw_cfg item names "
                      "should be prefixed with \"opt/\"");
+#ifndef CONFIG_UNSAFE_FW_CFG
+        return -1;
+#endif
     }
     if (nonempty_str(str)) {
         size = strlen(str); /* NUL terminator NOT included in fw_cfg blob */
-- 
MST

^ permalink raw reply related	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2016-03-17 19:55 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-15 14:47 [Qemu-devel] [PATCH v2] vl.c: disallow command line fw cfg without opt/ Michael S. Tsirkin
2016-03-16 16:29 ` Markus Armbruster
2016-03-16 16:50   ` Michael S. Tsirkin
2016-03-16 18:15     ` Gabriel L. Somlo
2016-03-16 18:35       ` Laszlo Ersek
2016-03-16 18:43         ` Michael S. Tsirkin
2016-03-16 19:15           ` Laszlo Ersek
2016-03-16 20:22             ` Michael S. Tsirkin
2016-03-16 20:24             ` Michael S. Tsirkin
2016-03-16 20:31         ` Michael S. Tsirkin
2016-03-17  8:49           ` Laszlo Ersek
2016-03-17  9:40             ` Paolo Bonzini
2016-03-17 11:32               ` Michael S. Tsirkin
2016-03-17 13:12                 ` Paolo Bonzini
2016-03-17 13:15                   ` Michael S. Tsirkin
2016-03-17  8:42         ` Gerd Hoffmann
2016-03-17  9:43           ` Laszlo Ersek
2016-03-17 10:22             ` Gerd Hoffmann
2016-03-17 13:28               ` Laszlo Ersek
2016-03-17 13:35                 ` Michael S. Tsirkin
2016-03-17 13:37                   ` Paolo Bonzini
2016-03-17 16:59                 ` Gerd Hoffmann
2016-03-17 13:23             ` Michael S. Tsirkin
2016-03-17  9:49           ` Laszlo Ersek
2016-03-17 10:09 ` Markus Armbruster
2016-03-17 13:13   ` Michael S. Tsirkin
2016-03-17 13:30     ` Paolo Bonzini
2016-03-17 13:49       ` Laszlo Ersek
2016-03-17 13:49       ` Michael S. Tsirkin
2016-03-17 13:55         ` Paolo Bonzini
2016-03-17 14:17           ` Michael S. Tsirkin
2016-03-17 14:50             ` Paolo Bonzini
2016-03-17 15:40               ` Michael S. Tsirkin
2016-03-17 17:17       ` Gerd Hoffmann
2016-03-17 19:35         ` Paolo Bonzini
2016-03-17 19:55           ` Michael S. Tsirkin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.