From owner-freebsd-hackers@FreeBSD.ORG Tue Oct 25 08:25:07 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 72C401065674; Tue, 25 Oct 2011 08:25:07 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id C0B028FC15; Tue, 25 Oct 2011 08:25:06 +0000 (UTC) Received: from alf.home (alf.kiev.zoral.com.ua [10.1.1.177]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id p9P8OqNf057020 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 25 Oct 2011 11:24:52 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from alf.home (kostik@localhost [127.0.0.1]) by alf.home (8.14.5/8.14.5) with ESMTP id p9P8Opkm092429; Tue, 25 Oct 2011 11:24:51 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by alf.home (8.14.5/8.14.5/Submit) id p9P8OpQk092428; Tue, 25 Oct 2011 11:24:51 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: alf.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 25 Oct 2011 11:24:51 +0300 From: Kostik Belousov To: Mikolaj Golub Message-ID: <20111025082451.GO50300@deviant.kiev.zoral.com.ua> References: <86y5wkeuw9.fsf@kopusha.home.net> <20111016171005.GB50300@deviant.kiev.zoral.com.ua> <86aa8qozyx.fsf@kopusha.home.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="7gzJCi2wfhUHVacz" Content-Disposition: inline In-Reply-To: <86aa8qozyx.fsf@kopusha.home.net> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: freebsd-hackers@freebsd.org, Robert Watson 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:25:07 -0000 --7gzJCi2wfhUHVacz Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 wel= l 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 acc= ess is > restricted by the permissions of /proc/pid/mem file). My kern.proc.env sy= sctl > does not have such a restriction. I suppose I should add it? What functio= n 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. I believe that the new sysctl shall use the same check. >=20 > KB> While you are at the code, it would be useful to also export the aux= v vector, > KB> which is immediately before env. >=20 > It looks I can find the location of auxv but what about the size? Or do y= ou > propose to extend struct ps_strings to store location and size of auxv? I > could do this way... No, extending ps_strings is not needed and it is too radical change. The auxv vector must end by the AT_NULL aux entry. You can also artificially limit the amount of read aux vectors to, say, 256, which is much more then it is currently defined. --7gzJCi2wfhUHVacz Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAk6mclMACgkQC3+MBN1Mb4jRxgCgwjXXtNzpDxyeSGSYnSdW+9gD fB8AoK3noTKoVjj+w6FdHsciqmQwsqs3 =PDhD -----END PGP SIGNATURE----- --7gzJCi2wfhUHVacz--