aboutsummaryrefslogtreecommitdiffstats
path: root/stubdom
diff options
context:
space:
mode:
authorIan Jackson <Ian.Jackson@eu.citrix.com>2012-10-26 16:10:55 +0100
committerIan Jackson <Ian.Jackson@eu.citrix.com>2012-10-26 16:10:55 +0100
commitfdd0127ae221c1d7da709a7a5b2321fd7c239652 (patch)
treeaedd464ab667d23988372cab3e21734e081911e2 /stubdom
parenta86c702cce598aa182200eba297b4b07ca684af9 (diff)
downloadxen-fdd0127ae221c1d7da709a7a5b2321fd7c239652.tar.gz
xen-fdd0127ae221c1d7da709a7a5b2321fd7c239652.tar.bz2
xen-fdd0127ae221c1d7da709a7a5b2321fd7c239652.zip
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>
Diffstat (limited to 'stubdom')
-rw-r--r--stubdom/grub/kexec.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/stubdom/grub/kexec.c b/stubdom/grub/kexec.c
index 06bef52ac2..b21c91ae99 100644
--- a/stubdom/grub/kexec.c
+++ b/stubdom/grub/kexec.c
@@ -137,6 +137,10 @@ void kexec(void *kernel, long kernel_size, void *module, long module_size, char
dom = xc_dom_allocate(xc_handle, cmdline, features);
dom->allocate = kexec_allocate;
+ /* We are using guest owned memory, therefore no limits. */
+ xc_dom_kernel_max_size(dom, 0);
+ xc_dom_ramdisk_max_size(dom, 0);
+
dom->kernel_blob = kernel;
dom->kernel_size = kernel_size;