libexec: detect short files
if an exec() fails partway through reading in the sections, the target process is already gone and a defunct process remains. sanity checking the binary beforehand helps that. test10 mutilates binaries and exec()s them on purpose; making an exec() fail cleanly in such cases seems like acceptable behaviour. fixes test10 on ARM. Change-Id: I1ed9bb200ce469d4d349073cadccad5503b2fcb0
This commit is contained in:
@@ -131,7 +131,7 @@ void arch_boot_proc(struct boot_image *ip, struct proc *rp)
|
||||
execi.stack_size = 32 * 1024; /* not too crazy as it must be preallocated */
|
||||
execi.proc_e = ip->endpoint;
|
||||
execi.hdr = (char *) mod->mod_start; /* phys mem direct */
|
||||
execi.hdr_len = mod->mod_end - mod->mod_start;
|
||||
execi.filesize = execi.hdr_len = mod->mod_end - mod->mod_start;
|
||||
strcpy(execi.progname, ip->proc_name);
|
||||
execi.frame_len = 0;
|
||||
|
||||
|
||||
@@ -407,7 +407,7 @@ void arch_boot_proc(struct boot_image *ip, struct proc *rp)
|
||||
execi.stack_size = 16 * 1024; /* not too crazy as it must be preallocated */
|
||||
execi.proc_e = ip->endpoint;
|
||||
execi.hdr = (char *) mod->mod_start; /* phys mem direct */
|
||||
execi.hdr_len = mod->mod_end - mod->mod_start;
|
||||
execi.filesize = execi.hdr_len = mod->mod_end - mod->mod_start;
|
||||
strlcpy(execi.progname, ip->proc_name, sizeof(execi.progname));
|
||||
execi.frame_len = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user