Date: Sun, 14 Jul 2002 12:11:47 -0700 From: "Crist J. Clark" <crist.clark@attbi.com> To: Robert Watson <rwatson@FreeBSD.org> Cc: David Malone <dwmalone@maths.tcd.ie>, Luigi Rizzo <luigi@FreeBSD.org>, Giorgos Keramidas <keramida@FreeBSD.org>, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/usr.bin/talk display.c talk.1 talk.c Message-ID: <20020714191147.GE56656@blossom.cjclark.org> In-Reply-To: <Pine.NEB.3.96L.1020714123154.25880D-100000@fledge.watson.org> References: <20020714153536.GA97536@walton.maths.tcd.ie> <Pine.NEB.3.96L.1020714123154.25880D-100000@fledge.watson.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Jul 14, 2002 at 12:33:20PM -0400, Robert Watson wrote: > On Sun, 14 Jul 2002, David Malone wrote: [snip] > > Isn't this what kern.ps_showallprocs is for? I've always considered ps > > and w showing what other people are doing a good way for users to learn > > new commands. > > kern.ps_showallprocs in -stable was simply a mib setting to tell ps to > ignore other users. kern.ps_showallprocs is enforced in the kernel. It prevents the kernel from returning a list of all processes to ps(1) or anything else (see src/sys/kern/kern_proc.c). _However,_ it does not prevent one from doing, $ ps -p <pid> On any process, regardless of the owner. We can simulate the '-a' switch by enumerating all PIDs, ps-a () { I=0 while [ $I -lt 100000 ]; do ps -p $I I=$(($I + 1)) done | grep -v '^ PID' } 'Course, that takes a few minutes to run. This simple patch will stop that too. Think it's worth adding? I've been running it for weeks on several RELENG_4 boxes. Index: src/sys/kern/kern_proc.c =================================================================== RCS file: /export/freebsd/ncvs/src/sys/kern/kern_proc.c,v retrieving revision 1.63.2.8 diff -u -r1.63.2.8 kern_proc.c --- src/sys/kern/kern_proc.c 1 May 2001 13:39:06 -0000 1.63.2.8 +++ src/sys/kern/kern_proc.c 20 May 2002 07:36:15 -0000 @@ -451,7 +451,8 @@ p = pfind((pid_t)name[0]); if (!p) return (0); - if (!PRISON_CHECK(curproc, p)) + if (!PRISON_CHECK(curproc, p) || + (!ps_showallprocs) && p_trespass(curproc, p)) return (0); error = sysctl_out_proc(p, req, 0); return (error); -- Crist J. Clark | cjclark@alum.mit.edu | cjclark@jhu.edu http://people.freebsd.org/~cjc/ | cjc@freebsd.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020714191147.GE56656>