linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] process /proc/PID/smaps vs /proc/PID/smaps_rollup
@ 2020-09-29  2:05 Sergey Senozhatsky
  2020-09-29  2:40 ` Sergey Senozhatsky
  0 siblings, 1 reply; 3+ messages in thread
From: Sergey Senozhatsky @ 2020-09-29  2:05 UTC (permalink / raw)
  To: Alexey Dobriyan, Andrew Morton, Vlastimil Babka, Kees Cook,
	Matthew Wilcox
  Cc: linux-kernel, linux-fsdevel, Sergey Senozhatsky

Hello,

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?

	-ss

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC] process /proc/PID/smaps vs /proc/PID/smaps_rollup
  2020-09-29  2:05 [RFC] process /proc/PID/smaps vs /proc/PID/smaps_rollup Sergey Senozhatsky
@ 2020-09-29  2:40 ` Sergey Senozhatsky
  2022-09-08  9:42   ` Vincent Whitchurch
  0 siblings, 1 reply; 3+ messages in thread
From: Sergey Senozhatsky @ 2020-09-29  2:40 UTC (permalink / raw)
  To: Alexey Dobriyan, Andrew Morton, Vlastimil Babka, Kees Cook,
	Matthew Wilcox
  Cc: Sergey Senozhatsky, linux-kernel, linux-fsdevel

On (20/09/29 11:05), Sergey Senozhatsky wrote:
> Hello,
> 
> 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?

	-ss

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC] process /proc/PID/smaps vs /proc/PID/smaps_rollup
  2020-09-29  2:40 ` Sergey Senozhatsky
@ 2022-09-08  9:42   ` Vincent Whitchurch
  0 siblings, 0 replies; 3+ messages in thread
From: Vincent Whitchurch @ 2022-09-08  9:42 UTC (permalink / raw)
  To: Sergey Senozhatsky
  Cc: Alexey Dobriyan, Andrew Morton, Vlastimil Babka, Kees Cook,
	Matthew Wilcox, linux-kernel, linux-fsdevel

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/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-08  9:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-29  2:05 [RFC] process /proc/PID/smaps vs /proc/PID/smaps_rollup Sergey Senozhatsky
2020-09-29  2:40 ` Sergey Senozhatsky
2022-09-08  9:42   ` Vincent Whitchurch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).