From owner-cvs-all Sun Jul 14 12:11:59 2002 Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 289A637B400; Sun, 14 Jul 2002 12:11:51 -0700 (PDT) Received: from rwcrmhc51.attbi.com (rwcrmhc51.attbi.com [204.127.198.38]) by mx1.FreeBSD.org (Postfix) with ESMTP id 91EE943E72; Sun, 14 Jul 2002 12:11:50 -0700 (PDT) (envelope-from crist.clark@attbi.com) Received: from blossom.cjclark.org ([12.234.91.48]) by rwcrmhc51.attbi.com (InterMail vM.4.01.03.27 201-229-121-127-20010626) with ESMTP id <20020714191149.BCZO24728.rwcrmhc51.attbi.com@blossom.cjclark.org>; Sun, 14 Jul 2002 19:11:49 +0000 Received: from blossom.cjclark.org (localhost. [127.0.0.1]) by blossom.cjclark.org (8.12.3/8.12.3) with ESMTP id g6EJBmJK010780; Sun, 14 Jul 2002 12:11:48 -0700 (PDT) (envelope-from crist.clark@attbi.com) Received: (from cjc@localhost) by blossom.cjclark.org (8.12.3/8.12.3/Submit) id g6EJBlgr010779; Sun, 14 Jul 2002 12:11:47 -0700 (PDT) X-Authentication-Warning: blossom.cjclark.org: cjc set sender to crist.clark@attbi.com using -f Date: Sun, 14 Jul 2002 12:11:47 -0700 From: "Crist J. Clark" To: Robert Watson Cc: David Malone , Luigi Rizzo , Giorgos Keramidas , 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> Reply-To: "Crist J. Clark" References: <20020714153536.GA97536@walton.maths.tcd.ie> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4i X-URL: http://people.freebsd.org/~cjc/ Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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 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