kern/157871: [patch] linprocfs: cmdline/environ for kernel-only processes returns EFAULT instead of empty string

Petr Salinger Petr.Salinger at seznam.cz
Tue Jun 14 10:30:12 UTC 2011


>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:


More information about the freebsd-bugs mailing list