Subject: Re: fork1(), uvm_fork() and cpu_fork()
To: NetBSD Kernel Technical Discussion List <tech-kern@netbsd.org>
From: Alan Barrett <apb@cequrux.com>
List: tech-kern
Date: 12/01/2002 19:11:48
On Sat, 30 Nov 2002, Greg A. Woods wrote:
> > FreeBSD's "ps" has a "-f" option for this.
> [...]
> Hmmm -- I wonder why it is restricted to root....  If you don't define
> LAZY_PS when compiling then forceuread defaults to '1' all the time.

LAZY_PS is the default in the relevant FreeBSD Makefile,

> It looks like restricting '-f' to root or wheel members is simply a
> policy decision to hide command-line args and environment values from
> unprivileged users (as per what the manual text you quote says), which
> seems a bit silly, especially given the interaction with -DLAZY_PS.

No, that can't be the reason, because the code is quite willing to
display that stuff to unprivileged users if it's in memory.  There's a
macro that tests whether either the forceuread flag is set or a bit in
some structure says that data is in memory; sorry I can't easily find
the exact macro or variable names right now, but grep for forceuread to
find it.

I expect that the original reason was more like limiting the amount of
paging activity done by ps on behalf of unprivileged users.

--apb (Alan Barrett)