aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lib/sys_string.h
diff options
context:
space:
mode:
authorIan Jackson <ian.jackson@eu.citrix.com>2013-06-14 16:43:18 +0100
committerIan Jackson <Ian.Jackson@eu.citrix.com>2013-06-14 16:43:18 +0100
commit52d8cc2dd3bb3e0f6d51e00280da934e8d91653a (patch)
tree5820a28eebdf8cfe795e0af127962e9cb9fce630 /tools/lib/sys_string.h
parente673ca50127b6c1263727aa31de0b8bb966ca7a2 (diff)
downloadxen-52d8cc2dd3bb3e0f6d51e00280da934e8d91653a.tar.gz
xen-52d8cc2dd3bb3e0f6d51e00280da934e8d91653a.tar.bz2
xen-52d8cc2dd3bb3e0f6d51e00280da934e8d91653a.zip
libelf: check loops for running away
Ensure that libelf does not have any loops which can run away indefinitely even if the input is bogus. (Grepped for \bfor, \bwhile and \bgoto in libelf and xc_dom_*loader*.c.) Changes needed: * elf_note_next uses the note's unchecked alleged length, which might wrap round. If it does, return ELF_MAX_PTRVAL (0xfff..fff) instead, which will be beyond the end of the section and so terminate the caller's loop. Also check that the returned psuedopointer is sane. * In various loops over section and program headers, check that the calculated header pointer is still within the image, and quit the loop if it isn't. * Some fixed limits to avoid potentially O(image_size^2) loops: - maximum length of strings: 4K (longer ones ignored totally) - maximum total number of ELF notes: 65536 (any more are ignored) * Check that the total program contents (text, data) we copy or initialise doesn't exceed twice the output image area size. * Remove an entirely useless loop from elf_xen_parse (!) * Replace a nested search loop in in xc_dom_load_elf_symtab in xc_dom_elfloader.c by a precomputation of a bitmap of referenced symtabs. We have not changed loops which might, in principle, iterate over the whole image - even if they might do so one byte at a time with a nontrivial access check function in the middle. This is part of the fix to a security issue, XSA-55. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/lib/sys_string.h')
0 files changed, 0 insertions, 0 deletions