linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vasiliy Kulikov <segoon@openwall.com>
To: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: 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>, Alan Cox <alan@linux.intel.com>,
	Jesper Juhl <jj@chaosbits.net>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [kernel-hardening] Re: [RFC PATCH 2/2] mm: restrict access to /proc/slabinfo
Date: Mon, 19 Sep 2011 20:18:37 +0400	[thread overview]
Message-ID: <20110919161837.GA2232@albatros> (raw)
In-Reply-To: <CAOJsxLGZm+npcR0YgXSE2wLC2iXCtzYyCdTDCt1LN=Z28Rm_UA@mail.gmail.com>

On Mon, Sep 19, 2011 at 19:11 +0300, Pekka Enberg wrote:
> >> What's different about the patch now?
> >
> > The exploitation you're talking about is an exploitation of kernel heap
> > bugs.  Dan's previous "make slabinfo 0400" patch tried to complicate
> > attacker's life by hiding information about how many free object are
> > left in the slab.  With this information an attacker may compute how he
> > should spray the slab to position slab object to increase his chances of
> > overwriting specific memory areas - pointers, etc.
> >
> > I don't speak about how much/whether closing slabinfo complicates this
> > task, though.  My idea is orthogonal to the Dan's idea.  I claim that
> > with 0444 slabinfo any user may get information about in-system activity
> > that he shouldn't learn.  In short, one may learn precisely when other
> > user reads directory contents, opens files, how much files there are in
> > the specific _private_ directory, how much files _private_ ecryptfs or
> > fuse mount point contains, etc.  This breaks user's assumption that
> > the number of files in a private directory is a private information.
> > There are a bit more thoughts in the patch description.
> 
> Yes, I read your patch description and I think it's convincing enough
> to warrant a config option but not changing the default.
> 
> However, if the encryptfs and infoleaks really are serious enough to
> hide /proc/slabinfo, I think you should consider switching over to
> kmalloc() instead of kmem_cache_alloc() to make sure nobody can
> gain access to the information.

kmalloc() is still visible in slabinfo as kmalloc-128 or so.


> >> > One note: only to _kernel_ developers.  It means it is a strictly
> >> > debugging feature, which shouldn't be enabled in the production systems.
> >>
> >> It's pretty much _the_ interface for debugging kernel memory leaks in
> >> production systems and we ask users for it along with /proc/meminfo
> >> when debugging many memory management related issues. When we
> >> temporarily dropped /proc/slabinfo with the introduction of SLUB, people
> >> complained pretty loudly.
> >
> > Could you point to the discussion, please?  I cannot find the patch for
> > 0400 slabinfo even in the linux-history repository.
> 
> We dropped the whole file for SLUB:
> 
> http://lwn.net/Articles/263337/

Ah, I've misunderstood you.


> [ I didn't find the original discussion that motivated the above
>   patch but it should be somewhere in LKML archives around
>   that time. ]
> 
> Making it root-only will have pretty much the same kind of
> out-of-the-box behavior.
> 
> >> I'd be willing to consider this patch if it's a config option that's not enabled
> >> by default; otherwise you need to find someone else to merge the patch.
> >> You can add some nasty warnings to the Kconfig text to scare the users
> >> into enabling it. ;-)
> >
> > How do you see this CONFIG_ option?  CONFIG_PROCFS_COMPAT_MODES (or _PERMS),
> > defaults to Y?  If we find more procfs files with dangerous permissions,
> > we may move it under "ifndef CONFIG_PROCFS_COMPAT_PERMS".
> 
> I guess CONFIG_RESTRICT_PROCFS type of thing makes most sense
> since the problem is not only about SLAB. If you want to make it slab-only
> config option, I'm fine with that too.

OK, then I'll prepare a patch with a configure option, if no other
objections.

> Please note that you need to restrict sysfs files for SLUB as well.

Sure.

Thank you for the comments!

-- 
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-19 16:19 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 [this message]
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
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=20110919161837.GA2232@albatros \
    --to=segoon@openwall.com \
    --cc=akpm@linux-foundation.org \
    --cc=alan@linux.intel.com \
    --cc=cl@linux-foundation.org \
    --cc=drosenberg@vsecurity.com \
    --cc=gorcunov@gmail.com \
    --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=mpm@selenic.com \
    --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).