mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vincent Whitchurch <vincent.whitchurch@axis.com>
To: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Vlastimil Babka <vbabka@suse.cz>,
	Kees Cook <keescook@chromium.org>,
	Matthew Wilcox <willy@infradead.org>,
	<linux-kernel@vger.kernel.org>, <linux-fsdevel@vger.kernel.org>
Subject: Re: [RFC] process /proc/PID/smaps vs /proc/PID/smaps_rollup
Date: Thu, 8 Sep 2022 11:42:18 +0200	[thread overview]
Message-ID: <Yxm4+rGMLtHLUmMU@axis.com> (raw)
In-Reply-To: <20200929024018.GA529@jagdpanzerIV.localdomain>

On Tue, Sep 29, 2020 at 11:40:18AM +0900, Sergey Senozhatsky wrote:
> On (20/09/29 11:05), Sergey Senozhatsky wrote:
> > One of our unprivileged daemon process needs process PSS info. That
> > info is usually available in /proc/PID/smaps on per-vma basis, on
> > in /proc/PID/smaps_rollup as a bunch of accumulated per-vma values.
> > The latter one is much faster and simpler to get, but, unlike smaps,
> > smaps_rollup requires PTRACE_MODE_READ, which we don't want to
> > grant to our unprivileged daemon.
> > 
> > So the question is - can we get, somehow, accumulated PSS info from
> > a non-privileged process? (Iterating through all process' smaps
> > vma-s consumes quite a bit of CPU time). This is related to another
> > question - why do smaps and smaps_rollup have different permission
> > requirements?
> 
> Hold on, seems that I misread something, /proc/PID/smaps is also
> unavailable. So the question is, then, how do we get PSS info of
> a random user-space process from an unprivileged daemon?

smaps contains a lot of sensitive information, but perhaps smaps_rollup
could be allowed without ptrace rights if the range information is
masked.  I've posted a patch here:

 https://lore.kernel.org/linux-mm/20220908093919.843346-1-vincent.whitchurch@axis.com/

      reply	other threads:[~2022-09-08  9:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-29  2:05 Sergey Senozhatsky
2020-09-29  2:40 ` Sergey Senozhatsky
2022-09-08  9:42   ` Vincent Whitchurch [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yxm4+rGMLtHLUmMU@axis.com \
    --to=vincent.whitchurch@axis.com \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=keescook@chromium.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sergey.senozhatsky@gmail.com \
    --cc=vbabka@suse.cz \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®