Date: Fri, 1 Jul 2011 10:25:48 +0000 (UTC) From: Sergey Kandaurov <pluknet@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r223707 - stable/8/sys/compat/linprocfs Message-ID: <201107011025.p61APmp1083531@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201107011025.p61APmp1083531>