Fix information leakage.

Without this fix it is possible to cheat policies like:
- sysctl security.bsd.see_other_[gu]ids=0,
- mac_seeotheruids(4),
- jail(2)
and get full processes list with their arguments.

This problem exists from revision 1.62 of kern_proc.c when it was
introduced.

Reviewed by:	nectar, rwatson.
This commit is contained in:
Pawel Jakub Dawidek 2004-03-17 13:19:43 +00:00
parent 34f74e1ed8
commit 9cdb62160b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=127123

View file

@ -1106,11 +1106,16 @@ sysctl_kern_proc_args(SYSCTL_HANDLER_ARGS)
if (!p)
return (ESRCH);
if ((!ps_argsopen) && (error = p_cansee(curthread, p))) {
if ((error = p_cansee(curthread, p)) != 0) {
PROC_UNLOCK(p);
return (error);
}
if (!ps_argsopen) {
PROC_UNLOCK(p);
return (EPERM);
}
if (req->newptr && curproc != p) {
PROC_UNLOCK(p);
return (EPERM);