Project

General

Profile

Bug #752 ยป execve-leak.diff

corecode, 07/30/2007 02:15 PM

View differences:

emulation/linux/i386/linux_machdep.c 30 Jul 2007 13:09:52 -0000
exec_free_args(&exec_args);
linux_free_path(&path);
if (error < 0) {
/* We hit a leathal error condition. Let's die now. */
exit1(W_EXITCODE(0, SIGABRT));
/* NOTREACHED */
}
return(error);
}
kern/kern_exec.c 30 Jul 2007 13:22:14 -0000
*/
static const struct execsw **execsw;
/*
* Replace current vmspace with a new binary.
* Returns 0 on success, > 0 on recoverable error (use as errno).
* Returns -1 on leathal error which demands killing of the current
* process!
*/
int
kern_execve(struct nlookupdata *nd, struct image_args *args)
{
......
if (imgp->vmspace_destroyed & 2)
p->p_flag &= ~P_INEXEC;
if (imgp->vmspace_destroyed) {
/* sorry, no more process anymore. exit gracefully */
exit1(W_EXITCODE(0, SIGABRT));
/* NOT REACHED */
return(0);
/*
* Sorry, no more process anymore. exit gracefully.
* However we can't die right here, because our
* caller might have to clean up, so indicate a
* leathal error by returning -1.
*/
return(-1);
} else {
return(error);
}
......
nlookup_done(&nd);
exec_free_args(&args);
if (error < 0) {
/* We hit a leathal error condition. Let's die now. */
exit1(W_EXITCODE(0, SIGABRT));
/* NOTREACHED */
}
/*
* The syscall result is returned in registers to the new program.
* Linux will register %edx as an atexit function and we must be
    (1-1/1)