libxc: builder: limit maximum size of kernel/ramdisk.
authorIan Jackson <Ian.Jackson@eu.citrix.com>
Fri, 26 Oct 2012 15:09:29 +0000 (16:09 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Fri, 26 Oct 2012 15:09:29 +0000 (16:09 +0100)
commit127c78b8b7615b2e895a879792f4b0b825a02a81
tree067b72c5020d4bd43f7416414f8bffecdb7a2e2e
parentce015753b6b8d00b935a8f75e17cf439ef80c65b
libxc: builder: limit maximum size of kernel/ramdisk.

Allowing user supplied kernels of arbitrary sizes, especially during
decompression, can swallow up dom0 memory leading to either virtual
address space exhaustion in the builder process or allocation
failures/OOM killing of both toolstack and unrelated processes.

We disable these checks when building in a stub domain for pvgrub
since this uses the guest's own memory and is isolated.

Decompression of gzip compressed kernels and ramdisks has been safe
since 14954:58205257517d (Xen 3.1.0 onwards).

This is XSA-25 / CVE-2012-4544.

Also make explicit checks for buffer overflows in various
decompression routines. These were already ruled out due to other
properties of the code but check them as a belt-and-braces measure.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
stubdom/grub/kexec.c
tools/libxc/xc_dom.h
tools/libxc/xc_dom_bzimageloader.c
tools/libxc/xc_dom_core.c