svn commit: r223707 - stable/8/sys/compat/linprocfs
Sergey Kandaurov
pluknet at FreeBSD.org
Fri Jul 1 10:25:49 UTC 2011
Author: pluknet
Date: Fri Jul 1 10:25:48 2011
New Revision: 223707
URL: http://svn.freebsd.org/changeset/base/223707
Log:
MFC r223182:
Return empty cmdline/environ string for processes with kernel address
space. This is consistent with the behavior in linux.
PR: kern/157871
Modified:
stable/8/sys/compat/linprocfs/linprocfs.c
Directory Properties:
stable/8/sys/ (props changed)
stable/8/sys/amd64/include/xen/ (props changed)
stable/8/sys/cddl/contrib/opensolaris/ (props changed)
stable/8/sys/contrib/dev/acpica/ (props changed)
stable/8/sys/contrib/pf/ (props changed)
Modified: stable/8/sys/compat/linprocfs/linprocfs.c
==============================================================================
--- stable/8/sys/compat/linprocfs/linprocfs.c Fri Jul 1 08:27:03 2011 (r223706)
+++ stable/8/sys/compat/linprocfs/linprocfs.c Fri Jul 1 10:25:48 2011 (r223707)
@@ -1046,6 +1046,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);
@@ -1070,6 +1079,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);
More information about the svn-src-stable
mailing list