[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202404251724.47A3F5ADF@keescook>
Date: Thu, 25 Apr 2024 17:39:03 -0700
From: Kees Cook <keescook@...omium.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Kent Overstreet <kent.overstreet@...ux.dev>,
Matthew Wilcox <willy@...radead.org>,
Suren Baghdasaryan <surenb@...gle.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH] alloc_tag: Tighten file permissions on /proc/allocinfo
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@...omium.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
Powered by blists - more mailing lists