public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kirill Korotaev <dev@openvz.org>
To: unlisted-recipients:; (no To-header on input)
Cc: Linus Torvalds <torvalds@osdl.org>,
	akpm@osdl.org, linux-kernel@vger.kernel.org,
	frankeh@watson.ibm.com, clg@fr.ibm.com, haveblue@us.ibm.com,
	greg@kroah.com, alan@lxorguk.ukuu.org.uk, serue@us.ibm.com,
	arjan@infradead.org, riel@redhat.com, kuznet@ms2.inr.ac.ru,
	saw@sawoct.com, devel@openvz.org, Dmitry Mishin <dim@sw.ru>
Subject: [PATCH 3/4] Virtualization/containers: UID hash
Date: Tue, 07 Feb 2006 01:17:22 +0300	[thread overview]
Message-ID: <43E7CAF2.5010705@openvz.org> (raw)
In-Reply-To: <43E7C65F.3050609@openvz.org>

[-- Attachment #1: Type: text/plain, Size: 225 bytes --]

This patch virtualizes UID hash, so that processes in container can use 
it's own UID set.
Can be done as an option if some virtualization solutions do not require it.

Signed-Off-By: Kirill Korotaev <dev@openvz.org>

Kirill

[-- Attachment #2: diff-container-uidhash --]
[-- Type: text/plain, Size: 1474 bytes --]

--- ./include/linux/container.h.uids	2006-02-06 23:46:40.000000000 +0300
+++ ./include/linux/container.h	2006-02-07 00:05:33.000000000 +0300
@@ -6,11 +6,14 @@
 #include <asm/atomic.h>
 
 struct task_struct;
+struct list_head;
 
 struct container {
 	u32 id;
 	struct task_struct *init_task;
 	atomic_t refcnt;
+
+	struct list_head *c_uid_hash;
 };
 
 extern struct container init_container;
--- ./kernel/user.c.uids	2006-02-06 22:15:06.000000000 +0300
+++ ./kernel/user.c	2006-02-06 23:58:06.000000000 +0300
@@ -14,6 +14,7 @@
 #include <linux/bitops.h>
 #include <linux/key.h>
 #include <linux/interrupt.h>
+#include <linux/container.h>
 
 /*
  * UID task count cache, to get fast user lookup in "alloc_uid"
@@ -24,7 +25,12 @@
 #define UIDHASH_SZ		(1 << UIDHASH_BITS)
 #define UIDHASH_MASK		(UIDHASH_SZ - 1)
 #define __uidhashfn(uid)	(((uid >> UIDHASH_BITS) + uid) & UIDHASH_MASK)
+
+#ifdef CONFIG_CONTAINER
+#define uidhashentry(uid)	(econtainer()->c_uid_hash + __uidhashfn((uid)))
+#else
 #define uidhashentry(uid)	(uidhash_table + __uidhashfn((uid)))
+#endif
 
 static kmem_cache_t *uid_cachep;
 static struct list_head uidhash_table[UIDHASH_SZ];
@@ -200,6 +206,9 @@ static int __init uid_cache_init(void)
 
 	/* Insert the root user immediately (init already runs as root) */
 	spin_lock_irq(&uidhash_lock);
+#ifdef CONFIG_CONTAINER
+	init_container.c_uid_hash = uidhash_table;
+#endif
 	uid_hash_insert(&root_user, uidhashentry(0));
 	spin_unlock_irq(&uidhash_lock);
 

  parent reply	other threads:[~2006-02-06 22:15 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-06 21:57 [PATCH 1/4] Virtualization/containers: introduction Kirill Korotaev
2006-02-06 22:12 ` [PATCH 2/4] Virtualization/containers: CONFIG_CONTAINER Kirill Korotaev
2006-02-06 22:17 ` Kirill Korotaev [this message]
2006-02-06 22:22 ` [PATCH 4/4] Virtualization/containers: uts name Kirill Korotaev
2006-02-06 23:00 ` [PATCH 1/4] Virtualization/containers: introduction Dave Hansen
2006-02-07 12:24   ` Kirill Korotaev
2006-02-07  3:34 ` Eric W. Biederman
2006-02-07  3:40   ` Rik van Riel
2006-02-07  6:30     ` Sam Vilain
2006-02-07 11:51       ` Kirill Korotaev
2006-02-07 14:31         ` Eric W. Biederman
2006-02-07 15:42       ` Eric W. Biederman
2006-02-07 16:18         ` Kirill Korotaev
2006-02-07 17:20           ` Eric W. Biederman
2006-02-07 22:43         ` Sam Vilain
2006-02-07 16:57       ` Hubertus Franke
2006-02-07 20:19         ` Serge E. Hallyn
2006-02-07 20:46           ` Hubertus Franke
2006-02-07 22:00             ` Eric W. Biederman
2006-02-07 22:19               ` Hubertus Franke
2006-02-07 22:06             ` The issues for agreeing on a virtualization/namespaces implementation Eric W. Biederman
2006-02-07 23:35               ` Hubertus Franke
2006-02-08  0:43                 ` Alexey Kuznetsov
2006-02-08  2:49                   ` Eric W. Biederman
2006-02-08  3:36                     ` Serge E. Hallyn
2006-02-08  3:52                       ` Eric W. Biederman
2006-02-08  4:37                         ` Herbert Poetzl
2006-02-08  4:46                           ` Eric W. Biederman
2006-02-08 19:24                         ` Stephen Hemminger
2006-02-08  5:23                 ` Eric W. Biederman
2006-02-08 14:40                   ` Hubertus Franke
2006-02-08 15:17                     ` Serge E. Hallyn
2006-02-08 15:35                       ` Kirill Korotaev
2006-02-08 15:57                         ` Hubertus Franke
2006-02-08 19:02                           ` Herbert Poetzl
2006-02-08 16:48                         ` Eric W. Biederman
2006-02-08 17:46                     ` Eric W. Biederman
2006-02-08 18:03                     ` Serge E. Hallyn
2006-02-08 18:31                       ` Hubertus Franke
2006-02-08 20:21                       ` Dave Hansen
2006-02-08 21:22                         ` Serge E. Hallyn
2006-02-08 22:28                     ` Eric W. Biederman
2006-02-20 12:11                 ` Kirill Korotaev
2006-02-20 12:41                   ` Herbert Poetzl
2006-02-20 14:26                     ` Kirill Korotaev
2006-02-20 15:16                       ` Herbert Poetzl
2006-02-08  4:56               ` Herbert Poetzl
2006-02-08 14:38                 ` Serge E. Hallyn
2006-02-08 14:51                   ` Hubertus Franke
2006-02-09  4:45               ` Kyle Moffett
2006-02-09  5:41                 ` Eric W. Biederman
2006-02-09 22:25               ` Eric W. Biederman
2006-02-07 22:58         ` [PATCH 1/4] Virtualization/containers: introduction Sam Vilain
2006-02-07 23:18           ` Hubertus Franke
2006-02-08  5:03             ` Eric W. Biederman
2006-02-08 14:13               ` Hubertus Franke
2006-02-08 15:44                 ` Kirill Korotaev
2006-02-08 16:39                   ` Eric W. Biederman
2006-02-08  2:08           ` Kevin Fox
2006-02-08  1:16             ` Sam Vilain
2006-02-08  4:21               ` Paul Jackson
2006-02-08 15:36         ` Kirill Korotaev
2006-02-08 17:16           ` Eric W. Biederman
2006-02-08 20:43           ` Dave Hansen
2006-02-08 21:04             ` Eric W. Biederman
2006-02-07 12:14   ` Kirill Korotaev
2006-02-07 14:06     ` Eric W. Biederman
2006-02-07 14:52       ` Rik van Riel
2006-02-07 15:13         ` Eric W. Biederman
2006-02-09  0:24 ` Eric W. Biederman
2006-02-09  2:18   ` Jeff Dike
2006-02-09  3:16     ` Eric W. Biederman
2006-02-09 14:28     ` Kirill Korotaev
2006-02-09 15:40       ` Jeff Dike
2006-02-09 15:49         ` Kirill Korotaev
2006-02-09 17:50           ` Jeff Dike
2006-02-09 16:38     ` Hubertus Franke
2006-02-09 17:48       ` Jeff Dike
2006-02-09 22:09         ` Sam Vilain
2006-02-09 21:56   ` 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=43E7CAF2.5010705@openvz.org \
    --to=dev@openvz.org \
    --cc=akpm@osdl.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=arjan@infradead.org \
    --cc=clg@fr.ibm.com \
    --cc=devel@openvz.org \
    --cc=dim@sw.ru \
    --cc=frankeh@watson.ibm.com \
    --cc=greg@kroah.com \
    --cc=haveblue@us.ibm.com \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=riel@redhat.com \
    --cc=saw@sawoct.com \
    --cc=serue@us.ibm.com \
    --cc=torvalds@osdl.org \
    /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