Date: Fri, 17 Jun 2011 07:30:56 +0000 (UTC) From: Sergey Kandaurov <pluknet@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r223182 - head/sys/compat/linprocfs Message-ID: <201106170730.p5H7Uux5070716@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pluknet Date: Fri Jun 17 07:30:56 2011 New Revision: 223182 URL: http://svn.freebsd.org/changeset/base/223182 Log: 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 Modified: head/sys/compat/linprocfs/linprocfs.c Modified: head/sys/compat/linprocfs/linprocfs.c ============================================================================== --- head/sys/compat/linprocfs/linprocfs.c Fri Jun 17 07:07:26 2011 (r223181) +++ head/sys/compat/linprocfs/linprocfs.c Fri Jun 17 07:30:56 2011 (r223182) @@ -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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201106170730.p5H7Uux5070716>