linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vasiliy Kulikov <segoon@openwall.com>
To: Alan Cox <alan@linux.intel.com>
Cc: Valdis.Kletnieks@vt.edu, Pekka Enberg <penberg@cs.helsinki.fi>,
	Andrew Morton <akpm@linux-foundation.org>,
	kernel-hardening@lists.openwall.com, Kees Cook <kees@ubuntu.com>,
	Cyrill Gorcunov <gorcunov@gmail.com>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Christoph Lameter <cl@linux-foundation.org>,
	Matt Mackall <mpm@selenic.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Dan Rosenberg <drosenberg@vsecurity.com>,
	Theodore Tso <tytso@mit.edu>, Jesper Juhl <jj@chaosbits.net>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Greg KH <gregkh@suse.de>, Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@elte.hu>,
	Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Subject: Re: [kernel-hardening] Re: [RFC PATCH 2/2] mm: restrict access to /proc/slabinfo
Date: Wed, 21 Sep 2011 21:05:27 +0400	[thread overview]
Message-ID: <20110921170527.GA15869@albatros> (raw)
In-Reply-To: <20110919205541.1c44f1a3@bob.linux.org.uk>

(I have to increase the CC list by CC'ing Greg and perf guys.  The
motivation for restricting slabinfo is here:

http://www.openwall.com/lists/kernel-hardening/2011/09/10/4)

> Anybody who thinks that debugging tools should be totally disabled on
> "production" systems probably hasn't spent enough time actually
> running production systems.

On Mon, Sep 19, 2011 at 20:55 +0100, Alan Cox wrote:
> Agreed - far better it is simply set root only.

Sorry, I've poorly worded my statement.  Of course I mean root-only
slabinfo, not totally disable it.


So, where are we now?

Linus, Alan, Kees, and Dave are about to simply restrict slabinfo (and
probably similar interfaces) to root.  Pekka is OK too.

Christoph and Valdis are about to create new CONFIG_ option to be able
to restrict the access to slabinfo/etc., but with old relaxed
permissions.


IMO having a compatibility with the old tools using slabinfo/meminfo as
non-root for good things is great, but probably a seamless upgrade
doesn't worth it in this case.  Instead, we can provide a transition
instructions to continue to use non-root monitoring tools:

    groupadd meminfo
    usermod -a -G meminfo $MONITOR_USER

And add these lines to the init scripts between mount /proc and running
monitoring daemon, for Ubuntu's upstart it should fit in mountall.conf:

    chmod g+r /proc/slabinfo /proc/meminfo
    chgrp meminfo /proc/slabinfo /proc/meminfo

Then the daemon may watch for memleaks again.  It requires some actions
from the sysadmin, but no changes to the daemons and it helps to keep
sane kernel defaults.

Are we OK with this solution?


Now about other sources of infoleaks.  Pekka has noticed that the same
information about slabs is accessible from sysfs and 'perf kmem':

http://www.openwall.com/lists/kernel-hardening/2011/09/19/23

For sysfs the solution is relatively simple - the same __ATTR(..., 0600,
...) for SLAB_ATTR() (all __ATTR* in mm/*.c?) with the same chmod in
init scripts.


For the perf the situation differs.  AFAICS (please correct me if I'm
wrong) all performance events are recorded and passed to userspace
without any security checks.  IOW, every event happened in the current
process' context is signalled to the current task if requested.  It
contains k*alloc/kfree, which are the subject of this thread, and
probably much more infoleaks which simply nobody cared about yet.
Probably it's time to develop some rules to identify what events are
safe to signal to user and what are dangerous/private to the
system/other users (probably, potentially)?  I'm not very familiar with
perf events and there might be already such mechanisms, but they're just
not used for memory things, so this is a question to the perf guys.


Other sources of similar infoleaks are fs-specific and IMO we should fix
them after these more "generic" infoleaks (slabinfo, meminfo, sysfs,
perf).


Thanks,

-- 
Vasiliy Kulikov
http://www.openwall.com - bringing security into open computing environments

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2011-09-21 17:06 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20110910164001.GA2342@albatros>
2011-09-10 16:41 ` [RFC PATCH 2/2] mm: restrict access to /proc/slabinfo Vasiliy Kulikov
2011-09-12 15:06   ` Cyrill Gorcunov
2011-09-13  6:28     ` Vasiliy Kulikov
2011-09-14 13:16   ` Vasiliy Kulikov
2011-09-14 15:18     ` Dave Hansen
2011-09-14 15:42       ` [kernel-hardening] " Vasiliy Kulikov
2011-09-14 15:48         ` Vasiliy Kulikov
2011-09-14 18:24         ` Dave Hansen
2011-09-14 18:41   ` Dave Hansen
2011-09-14 19:14     ` Vasiliy Kulikov
2011-09-14 19:27   ` Kees Cook
2011-09-18 17:05     ` [kernel-hardening] " Vasiliy Kulikov
2011-09-19 13:42       ` Christoph Lameter
2011-09-19 14:30       ` Pekka Enberg
2011-09-19 14:46         ` Vasiliy Kulikov
2011-09-19 15:13           ` Pekka Enberg
2011-09-19 15:57             ` Vasiliy Kulikov
2011-09-19 16:11               ` Pekka Enberg
2011-09-19 16:18                 ` Vasiliy Kulikov
2011-09-19 17:31                   ` Pekka Enberg
2011-09-19 17:35                     ` Vasiliy Kulikov
2011-09-19 17:51                       ` Christoph Lameter
2011-09-19 19:59                         ` Valdis.Kletnieks
2011-09-19 20:02                           ` Christoph Lameter
2011-09-19 20:36                             ` Valdis.Kletnieks
2011-09-19 17:51                       ` Pekka Enberg
2011-09-19 17:58                         ` Vasiliy Kulikov
2011-09-19 18:46                           ` Pekka Enberg
2011-09-19 18:55                             ` Vasiliy Kulikov
2011-09-19 19:20                               ` Pekka Enberg
2011-09-19 19:33                               ` Pekka Enberg
2011-09-19 18:55                             ` Linus Torvalds
2011-09-19 19:18                               ` Pekka Enberg
2011-09-19 19:45                                 ` Pekka Enberg
2011-09-19 20:59                                 ` David Rientjes
2011-09-19 18:03                         ` Dave Hansen
2011-09-19 18:21                           ` Pekka Enberg
2011-09-19 19:45           ` Valdis.Kletnieks
2011-09-19 19:55             ` Alan Cox
2011-09-21 17:05               ` Vasiliy Kulikov [this message]
2011-09-22  2:20                 ` Valdis.Kletnieks

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=20110921170527.GA15869@albatros \
    --to=segoon@openwall.com \
    --cc=Valdis.Kletnieks@vt.edu \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@ghostprotocols.net \
    --cc=akpm@linux-foundation.org \
    --cc=alan@linux.intel.com \
    --cc=cl@linux-foundation.org \
    --cc=drosenberg@vsecurity.com \
    --cc=gorcunov@gmail.com \
    --cc=gregkh@suse.de \
    --cc=jj@chaosbits.net \
    --cc=kees@ubuntu.com \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@elte.hu \
    --cc=mpm@selenic.com \
    --cc=paulus@samba.org \
    --cc=penberg@cs.helsinki.fi \
    --cc=torvalds@linux-foundation.org \
    --cc=tytso@mit.edu \
    --cc=viro@zeniv.linux.org.uk \
    /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;
as well as URLs for NNTP newsgroup(s).