From owner-freebsd-hackers@FreeBSD.ORG Tue Oct 25 09:28:00 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 2CBF11065677; Tue, 25 Oct 2011 09:28:00 +0000 (UTC) (envelope-from to.my.trociny@gmail.com) Received: from mail-ey0-f182.google.com (mail-ey0-f182.google.com [209.85.215.182]) by mx1.freebsd.org (Postfix) with ESMTP id 7AE1F8FC16; Tue, 25 Oct 2011 09:27:59 +0000 (UTC) Received: by eyd10 with SMTP id 10so225488eyd.13 for ; Tue, 25 Oct 2011 02:27:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:organization:references:sender:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=XTMmFTlWN5M+vnWBvU8NIybdjz6cK4OhtcMEVJYZwZQ=; b=Z3VEaAO9o1eYW4efTssDb1z+Yzq5RZGborUVRJzH0E5HM51AQRGm0vzIau/3LbuqT9 Lh9qrrWGscryp1lSxxbwzMSBGzLuW5i+sGSSyr2ayjK8q/4xqKU+zXdmSIzgAETMwqcv MR2P1yOfqAFhI2b0X62Odovqv4I1A6QxyQJ7U= Received: by 10.14.2.93 with SMTP id 69mr3309807eee.62.1319534878374; Tue, 25 Oct 2011 02:27:58 -0700 (PDT) Received: from localhost ([94.27.39.186]) by mx.google.com with ESMTPS id q28sm29932420eea.6.2011.10.25.02.27.55 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 25 Oct 2011 02:27:56 -0700 (PDT) From: Mikolaj Golub To: Kostik Belousov Organization: TOA Ukraine 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> Sender: Mikolaj Golub Date: Tue, 25 Oct 2011 12:27:52 +0300 In-Reply-To: <20111025082451.GO50300@deviant.kiev.zoral.com.ua> (Kostik Belousov's message of "Tue, 25 Oct 2011 11:24:51 +0300") Message-ID: <86aa8p1kvb.fsf@in138.ua3> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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 09:28:00 -0000 On Tue, 25 Oct 2011 11:24:51 +0300 Kostik Belousov wrote: KB> On Tue, Oct 25, 2011 at 12:13:10AM +0300, Mikolaj Golub wrote: >> >> On Sun, 16 Oct 2011 20:10:05 +0300 Kostik Belousov wrote: >> >> 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. >> >> Thanks! I am testing a patch (without auxv vector so far) and have some >> questions. >> >> 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? >> >> BTW, linprocfs allows to read other user's environment. KB> linprocfs uses p_cansee() to check the permissions. There are sysctls KB> security.bsd.see_other_{ug}ids that control the behaviour. KB> I believe that the new sysctl shall use the same check. This looks reasonable for me. But I just wanted to be sure that this would be ok for other people, as my patch changes the system behavior: currently with security.bsd.see_other_{ug}ids and procfs (not linprocfs) mounted a user can see other users args but not env; after the change a user will see both args and env (until security.bsd.see_other_{ug}ids is off). >> >> KB> While you are at the code, it would be useful to also export the auxv vector, >> KB> which is immediately before env. >> >> It looks I can find the location of auxv but what about the size? Or do you >> propose to extend struct ps_strings to store location and size of auxv? I >> could do this way... KB> No, extending ps_strings is not needed and it is too radical change. KB> The auxv vector must end by the AT_NULL aux entry. You can also artificially KB> limit the amount of read aux vectors to, say, 256, which is much more then KB> it is currently defined. Thanks. -- Mikolaj Golub