linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org,
	Pavel Emelyanov <xemul@parallels.com>,
	Glauber Costa <glommer@parallels.com>,
	Andi Kleen <andi@firstfloor.org>, Tejun Heo <tj@kernel.org>,
	Matt Helsley <matthltc@us.ibm.com>,
	Pekka Enberg <penberg@kernel.org>,
	Eric Dumazet <eric.dumazet@gmail.com>,
	Vasiliy Kulikov <segoon@openwall.com>,
	Alexey Dobriyan <adobriyan@gmail.com>
Subject: Re: [patch 1/4] Add routine for generating an ID for kernel pointer
Date: Wed, 28 Dec 2011 11:42:14 +0400	[thread overview]
Message-ID: <20111228074214.GC27266@moon> (raw)
In-Reply-To: <20111227152344.c8c140d3.akpm@linux-foundation.org>

On Tue, Dec 27, 2011 at 03:23:44PM -0800, Andrew Morton wrote:
> On Fri, 23 Dec 2011 16:47:42 +0400
> Cyrill Gorcunov <gorcunov@openvz.org> wrote:
> 
> > The routine XORs the given pointer with a random value
> > producing an ID (32 or 64 bit, depending on the arch).
> > 
> > Since it's a valuable information -- only CAP_SYS_ADMIN
> > is allowed to obtain it.
> > 
> >  - Tejun worried about the single poison value was a weak side -
> >    leaking one makes all the IDs vulnerable. To address this
> >    several poison values - one per object type - are introduced.
> >    They are stored in a plain array.
> >  - Pekka proposed to initialized poison values in the late_initcall callback
> >  - ... and move the code to mm/util.c
> 
> I'm trying to remember what this is all about, and I don't want to have
> to remember all the discussion from last time this came up!
> 
> Please, do cover all this in the changelogs: tell us what the code is
> all for and try to capture the design decisions thus far.  It's a
> useful reminder for current reviewers and is very valuable for new
> reviewers.
> 

Actually, not much was changed here, but indeed I've missed some changelong
snippets, sorry, will update next time. In short -- if to export these values
to unprivilege users we're to use strong encryption with some expansion of
the former pointers, and even more -- since kernel pointers do cover not
that big space (espec in case of x86-32) one could prehash all possible values
and if (for some reason) the cookie vector become known to an attacker, the
plain encryption would not work, but require some additional security
protection. Ie, none of scheme such as sha1(pointer ^ cookie) will be
enough.

So as a first step I thought root-only access should be better until more
clever scheme would be developed. Actually there is an option to simply
inject counters into kernel structures which we compare (ie vm, files and etc),
but it increase kernel memory consumption too much.

> The root-only restriction sounds like a pretty bad one.  I suspect it
> really isn't that bad but again, the changelog should discuss the pros
> and cons here.
> 
> A thought: if all we're trying to do here is to check for the sameness
> of objects, can we push the comparison into the kernel so we don't have
> this exporting-sensitive-info problem at all?  Just return a boolean to
> userspace?
> 
> Something like
> 
> int sys_pid_fields_equal(pid_t pid1, pid_t pid2, enum pid_field field_id);
> 
> ?
> 
> For /proc/pid/fdinfo/* userspace can open /proc/pid1/fdinfo/0 and
> /proc/pid2/fdinfo/0 and call sys_are_these_files_the_same(fd1, fd2, ...).
> 
> Perhaps sys_pid_fields_equal() can use sys_are_these_files_the_same()
> as well, if we can think up a way of passing it two fds to represent
> the two pids.
> 
> Have a think about it ;)
> 

Good idea! Maybe we could simply extend prctl then?
And thanks a lot for feedback, Andrew!

	Cyrill

  reply	other threads:[~2011-12-28  7:42 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-23 12:47 [patch 0/4] generic object ids, v2 Cyrill Gorcunov
2011-12-23 12:47 ` [patch 1/4] Add routine for generating an ID for kernel pointer Cyrill Gorcunov
2011-12-27 23:23   ` Andrew Morton
2011-12-28  7:42     ` Cyrill Gorcunov [this message]
2011-12-28  9:42       ` Andrew Morton
2011-12-28  9:43         ` Cyrill Gorcunov
2011-12-28  9:47     ` Pavel Emelyanov
2011-12-28 10:41       ` Cyrill Gorcunov
2011-12-27 23:33   ` Andrew Morton
2011-12-28  0:48     ` Randy Dunlap
2011-12-28  7:24       ` Cyrill Gorcunov
2011-12-27 23:54   ` Valdis.Kletnieks
2011-12-28  0:02     ` Andrew Morton
2011-12-28  7:22       ` Cyrill Gorcunov
2011-12-28 16:06   ` Tejun Heo
2011-12-28 16:18     ` Cyrill Gorcunov
2011-12-28 16:26       ` Tejun Heo
2011-12-28 16:40         ` Cyrill Gorcunov
2011-12-28 16:45           ` Tejun Heo
2011-12-28 16:53             ` Cyrill Gorcunov
2011-12-28 17:01               ` Tejun Heo
2011-12-28 17:14                 ` Cyrill Gorcunov
2011-12-29 14:24                   ` Cyrill Gorcunov
2011-12-29 16:14                     ` Tejun Heo
2011-12-29 16:24                       ` Cyrill Gorcunov
2011-12-30  0:23                         ` Herbert Xu
2011-12-30  7:36                           ` Cyrill Gorcunov
2011-12-30 20:31                             ` KOSAKI Motohiro
2011-12-30 20:48                               ` Cyrill Gorcunov
2011-12-30 23:51                                 ` KOSAKI Motohiro
2011-12-31  7:51                                   ` Cyrill Gorcunov
2012-01-02 12:18                                     ` bastien ROUCARIES
2012-01-02 21:14                                       ` Cyrill Gorcunov
2011-12-31  4:55                         ` Kyle Moffett
2011-12-31  7:57                           ` Cyrill Gorcunov
2011-12-23 12:47 ` [patch 2/4] proc: Show namespaces IDs in /proc/pid/ns/* files Cyrill Gorcunov
2012-01-04  6:02   ` Eric W. Biederman
2012-01-04 11:26     ` Cyrill Gorcunov
2012-01-04 17:56       ` Eric W. Biederman
2012-01-04 18:19         ` Cyrill Gorcunov
2011-12-23 12:47 ` [patch 3/4] proc: Show open file ID in /proc/pid/fdinfo/* Cyrill Gorcunov
2011-12-23 12:47 ` [patch 4/4] proc: Show IDs of objects cloned with CLONE_ in proc Cyrill Gorcunov
  -- strict thread matches above, loose matches on Subject: below --
2011-12-22 12:56 [patch 0/4] kernel generic object IDs series Cyrill Gorcunov
2011-12-22 12:56 ` [patch 1/4] Add routine for generating an ID for kernel pointer Cyrill Gorcunov
2011-12-28 16:51   ` Alan Cox
2011-12-28 17:05     ` Cyrill Gorcunov
2011-12-28 17:21       ` Alan Cox
2011-12-28 17:35         ` Cyrill Gorcunov
2011-12-28 19:48           ` Cyrill Gorcunov

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=20111228074214.GC27266@moon \
    --to=gorcunov@gmail.com \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=eric.dumazet@gmail.com \
    --cc=glommer@parallels.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthltc@us.ibm.com \
    --cc=penberg@kernel.org \
    --cc=segoon@openwall.com \
    --cc=tj@kernel.org \
    --cc=xemul@parallels.com \
    /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).