[XEN] Sync Elf parsing with libxc parser.

Signed-off-by: Keir Fraser <keir@xensource.com>
This commit is contained in:
kaf24@firebug.cl.cam.ac.uk committed 2006-06-30 22:23:21 +01:00
1 parent 6b4c5ff3c8
commit 273ffda5b4
1 file changed
+14 -7
+14 -7
View File
@@ -95,7 +95,11 @@ int parseelfimage(struct domain_setup_info *dsi)
elf_pa_off = elf_pa_off_defined ? simple_strtoul(p+17, &p, 0) : virt_base;
if ( elf_pa_off_defined && !virt_base_defined )
goto bad_image;
{
printk("ERROR: Neither ELF_PADDR_OFFSET nor VIRT_BASE found in"
" __xen_guest section.\n");
return -EINVAL;
}
for ( h = 0; h < ehdr->e_phnum; h++ )
{
@@ -104,7 +108,11 @@ int parseelfimage(struct domain_setup_info *dsi)
continue;
vaddr = phdr->p_paddr - elf_pa_off + virt_base;
if ( (vaddr + phdr->p_memsz) < vaddr )
goto bad_image;
{
printk("ERROR: ELF program header %d is too large.\n", h);
return -EINVAL;
}
if ( vaddr < kernstart )
kernstart = vaddr;
if ( (vaddr + phdr->p_memsz) > kernend )
@@ -127,7 +135,10 @@ int parseelfimage(struct domain_setup_info *dsi)
(dsi->v_kernentry < kernstart) ||
(dsi->v_kernentry > kernend) ||
(dsi->v_start > kernstart) )
goto bad_image;
{
printk("ERROR: ELF start or entries are out of bounds.\n");
return -EINVAL;
}
if ( (p = strstr(guestinfo, "BSD_SYMTAB")) != NULL )
dsi->load_symtab = 1;
@@ -139,10 +150,6 @@ int parseelfimage(struct domain_setup_info *dsi)
loadelfsymtab(dsi, 0);
return 0;
bad_image:
printk("Malformed ELF image.\n");
return -EINVAL;
}
int loadelfimage(struct domain_setup_info *dsi)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.