From: Kees Cook <keescook@chromium.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Kent Overstreet <kent.overstreet@linux.dev>,
Matthew Wilcox <willy@infradead.org>,
Suren Baghdasaryan <surenb@google.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
linux-hardening@vger.kernel.org
Subject: Re: [PATCH] alloc_tag: Tighten file permissions on /proc/allocinfo
Date: Thu, 25 Apr 2024 17:39:03 -0700 [thread overview]
Message-ID: <202404251724.47A3F5ADF@keescook> (raw)
In-Reply-To: <20240425164718.e8e187dd0c5b0a87371d8316@linux-foundation.org>
On Thu, Apr 25, 2024 at 04:47:18PM -0700, Andrew Morton wrote:
> On Thu, 25 Apr 2024 15:42:30 -0700 Kees Cook <keescook@chromium.org> wrote:
>
> > > The concern about leaking image layout could be addressed by sorting the
> > > output before returning to userspace.
> >
> > It's trivial to change permissions from the default 0400 at boot time.
> > It can even have groups and ownership changed, etc. This is why we have
> > per-mount-namespace /proc instances:
> >
> > # chgrp sysmonitor /proc/allocinfo
> > # chmod 0440 /proc/allocinfo
> >
> > Poof, instant role-based access control. :)
>
> Conversely, the paranoid could set it to 0400 at boot also.
>
> > I'm just trying to make the _default_ safe.
>
> Agree with this.
>
> Semi-seriously, how about we set the permissions to 0000 and force
> distributors/users to make a decision.
That seems an overly unfriendly default, but I guess if you wanted it as
a Kconfig setting? Just seems easiest to make distros that enable alloc
profiling safe by default but trivially available to root, and specialized
monitoring systems can do whatever they want with their /proc file ACLs.
This is kind of how all of this stuff works. There's nothing unique to
/proc/allocinfo. We do the same for slabinfo, vmallocinfo, timer_list,
etc. And I think it's totally reasonable to have paranoid defaults,
give the kind of outrageous stuff attackers have figured out how to reverse
engineer. Take for example "we can bypass SLUB randomization for the slab
from which struct file is allocated [by examining the /proc/$pid/fdinfo/
file contents]" Jann Horn demonstrated[1].
-Kees
[1] https://googleprojectzero.blogspot.com/2021/10/how-simple-linux-kernel-memory.html
--
Kees Cook
next prev parent reply other threads:[~2024-04-26 0:39 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-25 20:08 Kees Cook
2024-04-25 20:45 ` Kent Overstreet
2024-04-25 20:51 ` Matthew Wilcox
2024-04-25 21:04 ` Kent Overstreet
2024-04-25 21:21 ` Suren Baghdasaryan
2024-04-25 21:25 ` Kent Overstreet
2024-04-25 21:38 ` Andrew Morton
2024-04-25 21:45 ` Kent Overstreet
2024-04-26 8:32 ` Pavel Machek
2024-04-26 8:46 ` Kent Overstreet
2024-04-25 22:42 ` Kees Cook
2024-04-25 23:02 ` Kent Overstreet
2024-04-25 23:47 ` Andrew Morton
2024-04-26 0:27 ` Kent Overstreet
2024-04-26 0:43 ` Kees Cook
2024-04-26 0:58 ` Kent Overstreet
2024-04-26 3:25 ` Matthew Wilcox
2024-04-26 3:35 ` Kent Overstreet
2024-04-26 8:34 ` Pavel Machek
2024-04-26 0:39 ` Kees Cook [this message]
2024-04-25 20:57 ` Kees Cook
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=202404251724.47A3F5ADF@keescook \
--to=keescook@chromium.org \
--cc=akpm@linux-foundation.org \
--cc=kent.overstreet@linux.dev \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=surenb@google.com \
--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