Return empty cmdline/environ string for processes with kernel address

space. This is consistent with the behavior in linux.

PR:		kern/157871
Reported by:	Petr Salinger <Petr Salinger att seznam cz>
Verified on:	GNU/kFreeBSD debian 8.2-1-amd64 (by reporter)
Reviewed by:	kib (some time ago)
MFC after:	2 weeks
This commit is contained in:
Sergey Kandaurov 2011-06-17 07:30:56 +00:00
parent ba2a822490
commit e0607dec4d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=223182

View File

@ -1049,6 +1049,15 @@ linprocfs_doproccmdline(PFS_FILL_ARGS)
PROC_UNLOCK(p);
return (ret);
}
/*
* Mimic linux behavior and pass only processes with usermode
* address space as valid. Return zero silently otherwize.
*/
if (p->p_vmspace == &vmspace0) {
PROC_UNLOCK(p);
return (0);
}
if (p->p_args != NULL) {
sbuf_bcpy(sb, p->p_args->ar_args, p->p_args->ar_length);
PROC_UNLOCK(p);
@ -1073,6 +1082,15 @@ linprocfs_doprocenviron(PFS_FILL_ARGS)
PROC_UNLOCK(p);
return (ret);
}
/*
* Mimic linux behavior and pass only processes with usermode
* address space as valid. Return zero silently otherwize.
*/
if (p->p_vmspace == &vmspace0) {
PROC_UNLOCK(p);
return (0);
}
PROC_UNLOCK(p);
ret = linprocfs_doargv(td, p, sb, ps_string_env);