Bugtraq mailing list archives

Re: ps under FreeBSD


From: Guillaume PELAT <guillaume.pelat () intexxia com>
Date: Sun, 19 May 2002 11:51:08 +0200

On Saturday 18 May 2002 20:40, Jakub Filonik wrote:
Hi,
I was playing with ps on FreeBSD with kern.ps_showallprocs=0 and I was
surprised when I have seen that I may see info about running process, if I
know it's ID
After some investigation, the problem seems to be in sysctl_kern_proc
function in /sys/kern/kern_proc.c

The following patch seems to fix the problem(for freebsd 4.5):

diff -dru sys/kern/kern_proc.c sys.new/kern/kern_proc.c
--- sys/kern/kern_proc.c        Tue May  1 15:39:06 2001
+++ sys.new/kern/kern_proc.c    Sat May 18 15:27:57 2002
@@ -453,6 +453,8 @@
                        return (0);
                if (!PRISON_CHECK(curproc, p))
                        return (0);
+               if ((!ps_showallprocs) && p_trespass(curproc, p))
+                       return (0);
                error = sysctl_out_proc(p, req, 0);
                return (error);
        }

--
Guillaume Pelat


Current thread: