From owner-freebsd-hackers@FreeBSD.ORG Tue Oct 25 08:40:37 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 18CDD106566B; Tue, 25 Oct 2011 08:40:37 +0000 (UTC) (envelope-from rwatson@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id E78C68FC1B; Tue, 25 Oct 2011 08:40:36 +0000 (UTC) Received: from [192.168.2.115] (host86-161-235-163.range86-161.btcentralplus.com [86.161.235.163]) by cyrus.watson.org (Postfix) with ESMTPSA id 1579A46B0D; Tue, 25 Oct 2011 04:40:35 -0400 (EDT) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: "Robert N. M. Watson" In-Reply-To: <20111025082451.GO50300@deviant.kiev.zoral.com.ua> Date: Tue, 25 Oct 2011 09:40:34 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <7292FA7A-60A4-4D29-87B5-894AF0ED9C0E@freebsd.org> References: <86y5wkeuw9.fsf@kopusha.home.net> <20111016171005.GB50300@deviant.kiev.zoral.com.ua> <86aa8qozyx.fsf@kopusha.home.net> <20111025082451.GO50300@deviant.kiev.zoral.com.ua> To: Kostik Belousov X-Mailer: Apple Mail (2.1084) Cc: Mikolaj Golub , freebsd-hackers@freebsd.org Subject: Re: "ps -e" without procfs(5) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Oct 2011 08:40:37 -0000 On 25 Oct 2011, at 09:24, Kostik Belousov wrote: > On Tue, Oct 25, 2011 at 12:13:10AM +0300, Mikolaj Golub wrote: >>=20 >> On Sun, 16 Oct 2011 20:10:05 +0300 Kostik Belousov wrote: >>=20 >> KB> In my opinion, the way to implement the feature is to (re)use >> KB> linprocfs_doargv() and provide another kern.proc sysctl to = retrieve the >> KB> argv and env vectors. Then, ps(1) and procstat(1) can use it, as = well as >> KB> procfs and linprocfs inside the kernel. >>=20 >> Thanks! I am testing a patch (without auxv vector so far) and have = some >> questions. >>=20 >> Original ps -e returns environment only for user owned processes (the = access is >> restricted by the permissions of /proc/pid/mem file). My = kern.proc.env sysctl >> does not have such a restriction. I suppose I should add it? What = function I >> could use for this? >>=20 >> BTW, linprocfs allows to read other user's environment. > linprocfs uses p_cansee() to check the permissions. There are sysctls > security.bsd.see_other_{ug}ids that control the behaviour. >=20 > I believe that the new sysctl shall use the same check. To be honest, I'd be far more comfortable if the environment check used = p_candebug(). Environmental variables sometimes contain passwords, etc, = that shouldn't be visible to other users on the system. Even showing = command lines is a bit dubious, but widely accepted, whereas seeing the = contents of environmental variables is not widely known in user = communities. Robert=