From: ebiederm@xmission.com (Eric W. Biederman)
To: Dave Hansen <dave@sr71.net>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Kees Cook <keescook@chromium.org>,
tytso@mit.edu, Oleg Nesterov <oleg@redhat.com>,
linux-kernel@vger.kernel.org, dave.hansen@linux.intel.com
Subject: Re: [RFC][PATCH 1/2] fs proc: make pagemap a privileged interface
Date: Mon, 09 Mar 2015 17:13:55 -0500 [thread overview]
Message-ID: <878uf5vmxo.fsf@x220.int.ebiederm.org> (raw)
In-Reply-To: <20150309204321.AAF412E0@viggo.jf.intel.com> (Dave Hansen's message of "Mon, 09 Mar 2015 13:43:21 -0700")
Dave Hansen <dave@sr71.net> writes:
> From: Dave Hansen <dave.hansen@linux.intel.com>
>
> Physical addresses are sensitive information. There are
> existing, known exploits that are made easier if physical
> information is available. Here is one example:
>
> http://www.cs.columbia.edu/~vpk/papers/ret2dir.sec14.pdf
>
> If you know the physical address of something you also know at
> which kernel virtual address you can find something (modulo
> highmem). It means that things that keep the kernel from
> accessing user mappings (like SMAP/SMEP) can be worked around
> because the _kernel_ mapping can get used instead.
>
> But, /proc/$pid/pagemap exposes the physical addresses of all
> pages accessible to userspace. This works against all of the
> efforts to keep kernel addresses out of places where unprivileged
> apps can find them.
>
> This patch introduces a "paranoid" option for /proc. It can be
> enabled like this:
>
> mount -o remount,paranoid /proc
>
> Or when /proc is mounted initially. When 'paranoid' mode is
> active, opens to /proc/$pid/pagemap will return -EPERM for users
> without CAP_SYS_RAWIO. It can be disabled like this:
>
> mount -o remount,notparanoid /proc
>
> The option is applied to the pid namespace, so an app that wanted
> a separate policy from the rest of the system could get run in
> its own pid namespace.
>
> I'm not really that stuck on the name. I'm not opposed to making
> it apply only to pagemap or to giving it a pagemap-specific
> name.
>
> pagemap is also the kind of feature that could be used to escalate
> privileged from root in to the kernel. It probably needs to be
> protected in the same way that /dev/mem or module loading is in
> cases where the kernel needs to be protected from root, thus the
> choice to use CAP_SYS_RAWIO.
There is already a way to make pagemap go away. It is called
CONFIG_PROC_PAGE_MONITOR.
I suspect the right answer here is if you enable kernel address
randomization you disable CONFIG_PROC_PAGE_MONTIOR. Aka you make the
two options conflict with each other.
That is a lot less code and a lot less to maintain.
On the other hand if this is truly a valuable interface that you can't
part with we need an alternative to pagemaps that does the same job
with out the exploit potential. And I don't how to do that.
Arguing in favor of just making the options conflict is the fact that
kernel address randomization is pretty much snake oil. At least on
x86_64 the address pool is so small it can be trivially brute forced. I
think there are maybe 10 bits you can randomize within.
As for a way to disable this I expect it would do better with something
like a set once flag that prevents a process and all of it's children
from accessing this file.
*Blink* *Blink* Did you say you are worried about escalting privileges
from root into the kernel space. That is non-sense. We give root the
power to shot themselves in the foot and any proc option will be
something that root will be able to get around.
The pieces of the patch description don't add up.
Nacked-by: "Eric W. Biederman" <ebiederm@xmission.com>
Eric
next prev parent reply other threads:[~2015-03-09 22:17 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20150309204321.AAF412E0@viggo.jf.intel.com>
2015-03-09 21:31 ` Kees Cook
[not found] ` <20150309204322.50DA6B5D@viggo.jf.intel.com>
2015-03-09 21:32 ` [RFC][PATCH 2/2] proc: config options for making privileged /proc the default Kees Cook
2015-03-09 22:13 ` Eric W. Biederman [this message]
2015-03-09 22:22 ` [RFC][PATCH 1/2] fs proc: make pagemap a privileged interface Kees Cook
2015-03-09 23:08 ` Eric W. Biederman
2015-03-09 23:40 ` Kees Cook
2015-03-09 23:43 ` Eric W. Biederman
2015-03-10 0:03 ` Kees Cook
2015-03-10 2:51 ` Dave Hansen
2015-03-10 4:49 ` Eric W. Biederman
2015-03-10 2:28 ` Dave Hansen
2015-03-12 22:35 ` Andrew Morton
2015-03-13 15:56 ` Dave Hansen
2015-03-13 17:16 ` Eric W. Biederman
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=878uf5vmxo.fsf@x220.int.ebiederm.org \
--to=ebiederm@xmission.com \
--cc=akpm@linux-foundation.org \
--cc=dave.hansen@linux.intel.com \
--cc=dave@sr71.net \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@redhat.com \
--cc=tytso@mit.edu \
/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
Powered by JetHome