Copy new process argument list in do_execve() before grabbing PROC_LOCK
to avoid touching pageable memory while holding a mutex. Simplify argument list replacement logic. PR: kern/84935 Submitted by: "Antoine Pelisse" apelisse AT gmail.com (in a different form) MFC after: 3 days
This commit is contained in:
parent
e5c4d568a6
commit
5997cae9a4
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=150780
@ -479,8 +479,11 @@ do_execve(td, args, mac_p)
|
||||
newcred = crget();
|
||||
euip = uifind(attr.va_uid);
|
||||
i = imgp->args->begin_envv - imgp->args->begin_argv;
|
||||
if (ps_arg_cache_limit >= i + sizeof(struct pargs))
|
||||
/* Cache arguments if they fit inside our allowance */
|
||||
if (ps_arg_cache_limit >= i + sizeof(struct pargs)) {
|
||||
newargs = pargs_alloc(i);
|
||||
bcopy(imgp->args->begin_argv, newargs->ar_args, i);
|
||||
}
|
||||
|
||||
/* close files on exec */
|
||||
fdcloseexec(td);
|
||||
@ -661,16 +664,13 @@ do_execve(td, args, mac_p)
|
||||
/* clear "fork but no exec" flag, as we _are_ execing */
|
||||
p->p_acflag &= ~AFORK;
|
||||
|
||||
/* Free any previous argument cache */
|
||||
/*
|
||||
* Free any previous argument cache and it with
|
||||
* the new argument cache, if any.
|
||||
*/
|
||||
oldargs = p->p_args;
|
||||
p->p_args = NULL;
|
||||
|
||||
/* Cache arguments if they fit inside our allowance */
|
||||
if (ps_arg_cache_limit >= i + sizeof(struct pargs)) {
|
||||
bcopy(imgp->args->begin_argv, newargs->ar_args, i);
|
||||
p->p_args = newargs;
|
||||
newargs = NULL;
|
||||
}
|
||||
p->p_args = newargs;
|
||||
newargs = NULL;
|
||||
|
||||
#ifdef HWPMC_HOOKS
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user