]> xenbits.xensource.com Git - people/dariof/xen.git/commit
tools/xenstored: Check number of strings passed to do_control() 4.10.0-rc5
authorPawel Wieczorkiewicz <wipawel@amazon.de>
Fri, 27 Oct 2017 16:32:15 +0000 (16:32 +0000)
committerWei Liu <wei.liu2@citrix.com>
Tue, 14 Nov 2017 13:58:16 +0000 (13:58 +0000)
commit36c80e29e36eee02f20f18e7f32267442b18c8bd
tree71a7e93096ed1320002cbe025ecc6879b35b17b4
parent9b4bddc386e744c901dd685fa67be7a77f73f479
tools/xenstored: Check number of strings passed to do_control()

It is possible to send a zero-string message body to xenstore's
XS_CONTROL handling function. Then the number of strings is used
for an array allocation. This leads to a crash in strcmp() in a
CONTROL sub-command invocation loop.
The output of xs_count_string() should be verified and all 0 or
negative values should be rejected with an EINVAL. At least the
sub-command name must be specified.

The xenstore crash can only be triggered from within dom0 (there
is a check in do_control() rejecting all non-dom0 requests with
an EACCES).

Testing: reproduced with the following command:
python -c 'print 16*"\x00"' | nc -U $XENSTORED_RUNDIR/socket

Signed-off-by: Pawel Wieczorkiewicz <wipawel@amazon.de>
Reviewed-by: Martin Pohlack <mpohlack@amazon.de>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Release-acked-by: Julien Grall <julien.grall@linaro.org>
tools/xenstore/xenstored_control.c