linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 0/4] generic object ids, v2
@ 2011-12-23 12:47 Cyrill Gorcunov
  2011-12-23 12:47 ` [patch 1/4] Add routine for generating an ID for kernel pointer Cyrill Gorcunov
                   ` (3 more replies)
  0 siblings, 4 replies; 45+ messages in thread
From: Cyrill Gorcunov @ 2011-12-23 12:47 UTC (permalink / raw)
  To: linux-kernel
  Cc: Pavel Emelyanov, Glauber Costa, Andi Kleen, Tejun Heo,
	Matt Helsley, Pekka Enberg, Eric Dumazet, Vasiliy Kulikov,
	Andrew Morton, Alexey Dobriyan

I've been strongly advised to not put things into mm.h
so what about this series which introduces gen_obj_id.c/h.
Does it look better?

Cyrill

^ permalink raw reply	[flat|nested] 45+ messages in thread
* [patch 0/4] kernel generic object IDs series
@ 2011-12-22 12:56 Cyrill Gorcunov
  2011-12-22 12:56 ` [patch 2/4] proc: Show namespaces IDs in /proc/pid/ns/* files Cyrill Gorcunov
  0 siblings, 1 reply; 45+ messages in thread
From: Cyrill Gorcunov @ 2011-12-22 12:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Pavel Emelyanov, Glauber Costa, Andi Kleen, Tejun Heo,
	Matt Helsley, Pekka Enberg, Eric Dumazet, Vasiliy Kulikov,
	Andrew Morton

Hi,

when we do the checkpoint-restore we need to find out if various kernel objects
(like mm_struct-s of file_struct-s) are shared between tasks (and restore them
after).

While at restore time we can use CLONE_XXX flags and unshare syscall there is
no way to find out sharing structures at checkpoint time. Thus, to chop the
knit, we introduce generic-object-ids helpers which do basically encode
kernel pointers into some form (at moment is's simple XOR operation over
a random cookie value) and provide them back to userspace. So one can test
if two resource are shared between different task.

Since such information is pretty valuable -- it's allowed for CAP_SYS_ADMIN
only since xor encoded values has nothing to do with security but used only
to break an impression that ID means something other than random "number"
which should be used for "sameness" test only and nothing else.

The following objects are shown at the moment

 - all namespaces living in /proc/pid/ns/
 - open files (shown in /proc/pid/fdinfo/)
 - objects, that can be shared with CLONE_XXX flags (except for namespaces)

Any kind of comments and especially complains (!) are very appreciated!

Cyrill

^ permalink raw reply	[flat|nested] 45+ messages in thread
* [PATCH v2 0/4] Checkpoint/Restore: Show in proc IDs of objects that can be shared between tasks
@ 2011-11-17  9:55 Pavel Emelyanov
  2011-11-17  9:56 ` [PATCH 2/4] proc: Show namespaces IDs in /proc/pid/ns/* files Pavel Emelyanov
  0 siblings, 1 reply; 45+ messages in thread
From: Pavel Emelyanov @ 2011-11-17  9:55 UTC (permalink / raw)
  To: Linux Kernel Mailing List
  Cc: Cyrill Gorcunov, Glauber Costa, Andi Kleen, Tejun Heo,
	Matt Helsley, Pekka Enberg, Eric Dumazet, Andrew Morton

While doing the checkpoint-restore in the userspace one need to determine
whether various kernel objects (like mm_struct-s of file_struct-s) are shared
between tasks and restore this state.

The 2nd step can for now be solved by using respective CLONE_XXX flags and
the unshare syscall, while there's currently no ways for solving the 1st one.

One of the ways for checking whether two tasks share e.g. an mm_struct is to
provide some mm_struct ID of a task to its proc file. The best from the
performance point of view ID is the object address in the kernel, but showing
them to the userspace is not good for security reasons.

Thus the object address is XOR-ed with a "random" value of the same size and 
then shown in proc. Providing this poison is not leaked into the userspace then
ID seem to be safe. The objects for which the IDs are shown are:

* all namespaces living in /proc/pid/ns/
* open files (shown in /proc/pid/fdinfo/)
* objects, that can be shared with CLONE_XXX flags (except for namespaces)

Changes since
v1: * 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. Tejun, 
      is this enough from your POV, or you'd like to see them widely scattered 
      over the memory?
    * Pekka proposed to initialized poison values in the late_initcall callback
    * ... and move the code to mm/util.c

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>


^ permalink raw reply	[flat|nested] 45+ messages in thread
* [PATCH 0/4] Checkpoint/Restore: Show in proc IDs of objects that can be shared between tasks
@ 2011-11-15 11:35 Pavel Emelyanov
  2011-11-15 11:36 ` [PATCH 2/4] proc: Show namespaces IDs in /proc/pid/ns/* files Pavel Emelyanov
  0 siblings, 1 reply; 45+ messages in thread
From: Pavel Emelyanov @ 2011-11-15 11:35 UTC (permalink / raw)
  To: Linux Kernel Mailing List
  Cc: Cyrill Gorcunov, Glauber Costa, Andi Kleen, Tejun Heo,
	Andrew Morton, Matt Helsley

While doing the checkpoint-restore in the userspace one need to determine
whether various kernel objects (like mm_struct-s of file_struct-s) are shared
between tasks and restore this state.

The 2nd step can for now be solved by using respective CLONE_XXX flags and
the unshare syscall, while there's currently no ways for solving the 1st one.

One of the ways for checking whether two tasks share e.g. an mm_struct is to
provide some mm_struct ID of a task to its proc file. The best from the
performance point of view ID is the object address in the kernel, but showing
them to the userspace is not good for performance reasons.

The previous attempt to solve this was to generate an ID for slab/slub and then
mix it up with the object index on the slab page. This attempt wasn't met
warmly by slab maintainers, so here's the 2nd approach.

The object address is XOR-ed with a "random" value of the same size and then
shown in proc. Providing this poison is not leaked into the userspace then
ID seem to be safe.

The other change from the previous set - this now includes patches from /proc
to show the IDs generated. The objects for which the IDs are shown are:

* all namespaces living in /proc/pid/ns/
* open files (shown in /proc/pid/fdinfo/)
* objects, that can be shared with CLONE_XXX flags (except for namespaces)

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>


^ permalink raw reply	[flat|nested] 45+ messages in thread

end of thread, other threads:[~2012-01-04 18:19 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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 2/4] proc: Show namespaces IDs in /proc/pid/ns/* files Cyrill Gorcunov
2011-11-17  9:55 [PATCH v2 0/4] Checkpoint/Restore: Show in proc IDs of objects that can be shared between tasks Pavel Emelyanov
2011-11-17  9:56 ` [PATCH 2/4] proc: Show namespaces IDs in /proc/pid/ns/* files Pavel Emelyanov
2011-11-15 11:35 [PATCH 0/4] Checkpoint/Restore: Show in proc IDs of objects that can be shared between tasks Pavel Emelyanov
2011-11-15 11:36 ` [PATCH 2/4] proc: Show namespaces IDs in /proc/pid/ns/* files Pavel Emelyanov

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).