qemu-e2k/util
Eric Blake 240f64b6dc qapi: Use strict QMP input visitor in more places
The following uses of a QMP input visitor should be strict
(that is, excess keys in QDict input should be flagged if not
converted to QAPI):

- Testsuite code unrelated to explicitly testing non-strict
mode (test-qmp-commands, test-visitor-serialization); since
we want more code to be strict by default, having more tests
of strict mode doesn't hurt

- Code used for cloning QAPI objects (replay-input.c,
qemu-sockets.c); we are reparsing a QObject just barely
produced by the qmp output visitor and which therefore should
not have any garbage, so while it is extra work to be strict,
it validates that our clone is correct [note that a later patch
series will simplify these two uses by creating an actual
clone visitor that is much more efficient than a
generate/reparse cycle]

- qmp_object_add(), which calls into user_creatable_add_type().
Since command line parsing for '-object' uses the same
user_creatable_add_type() through the OptsVisitor, and that is
always strict, we want to ensure that any nested dictionaries
would be treated the same in QMP and from the command line (I
don't actually know if such nested dictionaries exist).  Note
that on this code change, strictness only matters for nested
dictionaries (if even possible), since we already flag excess
input at the top level during an earlier object_property_set()
on an unknown key, whether from QemuOpts:

$ ./x86_64-softmmu/qemu-system-x86_64 -nographic -nodefaults -qmp stdio -object secret,id=sec0,data=letmein,format=raw,foo=bar
qemu-system-x86_64: -object secret,id=sec0,data=letmein,format=raw,foo=bar: Property '.foo' not found

or from QMP:

$ ./x86_64-softmmu/qemu-system-x86_64 -nographic -nodefaults -qmp stdio
{"QMP": {"version": {"qemu": {"micro": 93, "minor": 5, "major": 2}, "package": ""}, "capabilities": []}}
{"execute":"qmp_capabilities"}
{"return": {}}
{"execute":"object-add","arguments":{"qom-type":"secret","id":"sec0","props":{"format":"raw","data":"letmein","foo":"bar"}}}
{"error": {"class": "GenericError", "desc": "Property '.foo' not found"}}

The only remaining uses of non-strict input visits are:

- QMP 'qom-set' (which eventually executes
object_property_set_qobject()) - mark it as something to revisit
in the future (I didn't want to spend any more time on this patch
auditing if we have any QOM dictionary properties that might be
impacted, and couldn't easily prove whether this code path is
shared with anything else).

- test-qmp-input-visitor: explicit tests of non-strict mode. If
we later get rid of users that don't need strictness, then this
test should be merged with test-qmp-input-strict

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1461879932-9020-7-git-send-email-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2016-05-12 09:47:54 +02:00
..
Makefile.objs log: move qemu-log.c into util/ directory 2016-02-03 09:19:10 +00:00
acl.c util: Clean up includes 2016-02-04 17:01:04 +00:00
base64.c include/qemu/osdep.h: Don't include qapi/error.h 2016-03-22 22:20:15 +01:00
bitmap.c util: Clean up includes 2016-02-04 17:01:04 +00:00
bitops.c util: Clean up includes 2016-02-04 17:01:04 +00:00
buffer.c util: Clean up includes 2016-02-04 17:01:04 +00:00
compatfd.c util: Clean up includes 2016-02-04 17:01:04 +00:00
coroutine-gthread.c util: Clean up includes 2016-02-04 17:01:04 +00:00
coroutine-sigaltstack.c Remove unneeded include statements for setjmp.h 2016-03-22 19:11:15 +01:00
coroutine-ucontext.c Remove unneeded include statements for setjmp.h 2016-03-22 19:11:15 +01:00
coroutine-win32.c util: Clean up includes 2016-02-04 17:01:04 +00:00
crc32c.c util: Clean up includes 2016-02-04 17:01:04 +00:00
cutils.c util: move declarations out of qemu-common.h 2016-03-22 22:20:17 +01:00
envlist.c util: Clean up includes 2016-02-04 17:01:04 +00:00
error.c include/qemu/osdep.h: Don't include qapi/error.h 2016-03-22 22:20:15 +01:00
event_notifier-posix.c event-notifier: Add "is_external" parameter 2016-04-22 16:43:56 +02:00
event_notifier-win32.c event-notifier: Add "is_external" parameter 2016-04-22 16:43:56 +02:00
fifo8.c util: Clean up includes 2016-02-04 17:01:04 +00:00
getauxval.c util: Clean up includes 2016-02-04 17:01:04 +00:00
hbitmap.c util: Clean up includes 2016-02-04 17:01:04 +00:00
hexdump.c util: Improved qemu_hexmap() to include an ascii dump of the buffer 2016-04-06 09:52:07 +08:00
host-utils.c util: Clean up includes 2016-02-04 17:01:04 +00:00
id.c util: move declarations out of qemu-common.h 2016-03-22 22:20:17 +01:00
iov.c util: move declarations out of qemu-common.h 2016-03-22 22:20:17 +01:00
log.c log: move qemu_log_close/qemu_log_flush from header to log.c 2016-03-31 09:58:32 +01:00
memfd.c vhost: add migration block if memfd failed 2015-10-22 14:34:49 +03:00
mmap-alloc.c util: Clean up includes 2016-02-04 17:01:04 +00:00
module.c util: Clean up includes 2016-02-04 17:01:04 +00:00
notify.c util: Clean up includes 2016-02-04 17:01:04 +00:00
osdep.c util: move declarations out of qemu-common.h 2016-03-22 22:20:17 +01:00
oslib-posix.c util: align memory allocations to 2M on AArch64 2016-04-22 12:26:01 +01:00
oslib-win32.c util: move declarations out of qemu-common.h 2016-03-22 22:20:17 +01:00
path.c util: move declarations out of qemu-common.h 2016-03-22 22:20:17 +01:00
qemu-config.c util: Clean up includes 2016-02-04 17:01:04 +00:00
qemu-coroutine-io.c osdep: remove use of socket_error() from all code 2016-03-10 17:19:34 +00:00
qemu-coroutine-lock.c util: Clean up includes 2016-02-04 17:01:04 +00:00
qemu-coroutine-sleep.c util: Clean up includes 2016-02-04 17:01:04 +00:00
qemu-coroutine.c util: Clean up includes 2016-02-04 17:01:04 +00:00
qemu-error.c util: Clean up includes 2016-02-04 17:01:04 +00:00
qemu-openpty.c util: Clean up includes 2016-02-04 17:01:04 +00:00
qemu-option.c QemuOpts: Fix qemu_opts_foreach() dangling location regression 2016-04-28 08:18:56 +02:00
qemu-progress.c util: Clean up includes 2016-02-04 17:01:04 +00:00
qemu-sockets.c qapi: Use strict QMP input visitor in more places 2016-05-12 09:47:54 +02:00
qemu-thread-posix.c util: Clean up includes 2016-02-04 17:01:04 +00:00
qemu-thread-win32.c util: Clean up includes 2016-02-04 17:01:04 +00:00
qemu-timer-common.c util: Clean up includes 2016-02-04 17:01:04 +00:00
rcu.c util: Clean up includes 2016-02-04 17:01:04 +00:00
readline.c util: move declarations out of qemu-common.h 2016-03-22 22:20:17 +01:00
rfifolock.c util: Clean up includes 2016-02-04 17:01:04 +00:00
throttle.c include/qemu/osdep.h: Don't include qapi/error.h 2016-03-22 22:20:15 +01:00
timed-average.c util: Clean up includes 2016-02-04 17:01:04 +00:00
unicode.c util: move declarations out of qemu-common.h 2016-03-22 22:20:17 +01:00
uri.c util: Clean up includes 2016-02-04 17:01:04 +00:00