Date: Tue, 14 Jun 2011 10:24:18 GMT From: Petr Salinger <Petr.Salinger@seznam.cz> To: freebsd-gnats-submit@FreeBSD.org Subject: kern/157871: [patch] linprocfs: cmdline/environ for kernel-only processes returns EFAULT instead of empty string Message-ID: <201106141024.p5EAOIQ1037415@red.freebsd.org> Resent-Message-ID: <201106141030.p5EAUCOc023674@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 157871 >Category: kern >Synopsis: [patch] linprocfs: cmdline/environ for kernel-only processes returns EFAULT instead of empty string >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Jun 14 10:30:11 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Petr Salinger >Release: 8.2 >Organization: >Environment: GNU/kFreeBSD debian 8.2-1-amd64 >Description: Between 8.1 and 8.2 have been in linprocfs added support for $PID/environ and changed implementation of $PID/cmdline. Now it for kernel-only processes returns EFAULT instead of empty string. It breaks at least "pstree -a". See Debian GNU/kFreeBSD bug #630104 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=630104 >How-To-Repeat: >Fix: --- a/sys/compat/linprocfs/linprocfs.c +++ b/sys/compat/linprocfs/linprocfs.c @@ -1044,6 +1044,10 @@ PROC_UNLOCK(p); return (ret); } + if (p->p_flag & P_KTHREAD) { + 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); @@ -1068,6 +1072,10 @@ PROC_UNLOCK(p); return (ret); } + if (p->p_flag & P_KTHREAD) { + PROC_UNLOCK(p); + return (0); + } PROC_UNLOCK(p); ret = linprocfs_doargv(td, p, sb, ps_string_env); >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201106141024.p5EAOIQ1037415>