* [RFC][PATCH 0/5] uts namespaces: Introduction @ 2006-04-07 18:36 Serge E. Hallyn 2006-04-07 18:36 ` [RFC][PATCH 5/5] uts namespaces: Enable UTS namespaces debugging Serge E. Hallyn ` (6 more replies) 0 siblings, 7 replies; 50+ messages in thread From: Serge E. Hallyn @ 2006-04-07 18:36 UTC (permalink / raw) To: linux-kernel, Kirill Korotaev, herbert, devel, sam, Eric W. Biederman, xemul, devel, James Morris Introduce utsname namespaces. Instead of a single system_utsname containing hostname domainname etc, a process can request it's copy of the uts info to be cloned. The data will be copied from it's original, but any further changes will not be seen by processes which are not it's children, and vice versa. This is useful, for instance, for vserver/openvz, which can now clone a new uts namespace for each new virtual server. This patchset is based on Kirill Korotaev's Mar 24 submission, taking comments (in particular from James Morris and Eric Biederman) into account. Some performance results are attached. I was mainly curious whether it would be worth putting the task_struct->uts_ns pointer inside a #ifdef CONFIG_UTS_NS. The result show that leaving it in when CONFIG_UTS_NS=n has negligable performance impact, so that is the approach this patch takes. -serge Performance testing was done on a 2-cpu hyperthreaded x86 box with 16G ram. The following tests were run: dbench (20 times, four clients, on reiser fs non-isolated partition) tbench (20 times, 5 connections) kernbench (20 times) reaim (20 times ranging from 1 to 15 users) They were run on 2.6.17-rc1: pristine patched, but with !CONFIG_UTS_NS ("disabled") patched with CONFIG_UTS_NS=y ("enabled") All results are presented as means +/- 95% confidence interval. Dbench results: pristine: 387.080727 +/- 9.344585 patched disabled: 389.524364 +/- 9.574921 patched enabled: 370.155600 +/- 30.127808 Tbench results: pristine: 388.940100 +/- 18.095104 patched disabled: 389.173700 +/- 23.658035 patched enabled: 394.333200 +/- 25.813393 Kernbench results: pristine: 70.317500 +/- 0.210833 patched, disabled: 70.860000 +/- 0.179292 patched, enabled: 70.346500 +/- 0.184784 Reaim results: pristine: Nclients Mean 95% CI 1 106080.000000 11327.896029 3 236057.142000 18205.544810 5 247867.136000 23536.800062 7 265370.000000 21284.335743 9 262969.936000 18225.497529 11 278256.000000 6230.342816 13 284288.016000 8924.589388 15 286987.170000 7881.034658 patched, disabled: Nclients Mean 95% CI 1 105400.000000 8739.978241 3 229500.000000 0.000000 5 252325.176667 16685.663423 7 265125.000000 6747.777319 9 271258.645000 11715.635212 11 280662.608333 7775.229351 13 277719.706667 8173.390359 15 278515.421667 10963.211450 patched, enabled: Nclients Mean 95% CI 1 102000.000000 0.000000 3 224400.000000 14159.870036 5 242963.288000 40529.490781 7 255150.000000 8745.802081 9 270154.284000 8918.863136 11 283134.260000 12239.361252 13 288497.540000 11336.550964 15 280022.728000 8804.882369 ^ permalink raw reply [flat|nested] 50+ messages in thread
* [RFC][PATCH 5/5] uts namespaces: Enable UTS namespaces debugging 2006-04-07 18:36 [RFC][PATCH 0/5] uts namespaces: Introduction Serge E. Hallyn @ 2006-04-07 18:36 ` Serge E. Hallyn 2006-04-07 18:36 ` [RFC][PATCH 2/5] uts namespaces: Switch to using uts namespaces Serge E. Hallyn ` (5 subsequent siblings) 6 siblings, 0 replies; 50+ messages in thread From: Serge E. Hallyn @ 2006-04-07 18:36 UTC (permalink / raw) To: linux-kernel, Kirill Korotaev, herbert, devel, sam, Eric W. Biederman, xemul, devel, James Morris Adds a /uts directory in debugfs which exposes the current UTS namespace. If a file in this directory is changed, it will unshare and modify the UTS namespace of the current process. Clearly this is purely for testing purposes. Testing namespaces in this fashion allows us to postpone concensus on a namespace unsharing mechanism. Signed-off-by: Cedric Le Goater <clg@fr.ibm.com> --- fs/debugfs/Makefile | 2 - fs/debugfs/uts.c | 170 +++++++++++++++++++++++++++++++++++++++++++++++++++ lib/Kconfig.debug | 11 +++ 3 files changed, 182 insertions(+), 1 deletions(-) create mode 100644 fs/debugfs/uts.c 67f3dc966381313f31ee3643183161a8c230199b diff --git a/fs/debugfs/Makefile b/fs/debugfs/Makefile index 840c456..e5df8b9 100644 --- a/fs/debugfs/Makefile +++ b/fs/debugfs/Makefile @@ -1,4 +1,4 @@ debugfs-objs := inode.o file.o obj-$(CONFIG_DEBUG_FS) += debugfs.o - +obj-$(CONFIG_DEBUG_UTS_NS) += uts.o diff --git a/fs/debugfs/uts.c b/fs/debugfs/uts.c new file mode 100644 index 0000000..45b29af --- /dev/null +++ b/fs/debugfs/uts.c @@ -0,0 +1,170 @@ +/* + * uts.c - adds a uts/ directory to debug UTS namespaces + * + * Copyright (C) 2006 IBM + * + * Author: Cedric Le Goater <clg@fr.ibm.com> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation, version 2 of the + * License. + */ + +#include <linux/module.h> +#include <linux/kernel.h> +#include <linux/pagemap.h> +#include <linux/debugfs.h> +#include <linux/utsname.h> + +static struct dentry *uts_dentry; +static struct dentry *uts_dentry_sysname; +static struct dentry *uts_dentry_nodename; +static struct dentry *uts_dentry_release; +static struct dentry *uts_dentry_version; +static struct dentry *uts_dentry_machine; +static struct dentry *uts_dentry_domainname; + +static inline char* uts_buffer(struct dentry *dentry) +{ + if (dentry == uts_dentry_sysname) + return utsname()->sysname; + else if (dentry == uts_dentry_nodename) + return utsname()->nodename; + else if (dentry == uts_dentry_release) + return utsname()->release; + else if (dentry == uts_dentry_version) + return utsname()->version; + else if (dentry == uts_dentry_machine) + return utsname()->machine; + else if (dentry == uts_dentry_domainname) + return utsname()->domainname; + else + return NULL; +} + +static ssize_t uts_read_file(struct file *file, char __user *user_buf, + size_t count, loff_t *ppos) +{ + size_t len; + char* buf; + + if (*ppos < 0) + return -EINVAL; + if (*ppos >= count) + return 0; + + buf = uts_buffer(file->f_dentry); + if (!buf) + return -ENOENT; + + len = strlen(buf); + if (len > count) + len = count; + if (len) + if (copy_to_user(user_buf, buf, len)) + return -EFAULT; + if (len < count) { + if (put_user('\n', ((char __user *) user_buf) + len)) + return -EFAULT; + len++; + } + + *ppos += count; + return count; +} + + +static ssize_t uts_write_file(struct file * file, const char __user * user_buf, + size_t count, loff_t *ppos) + +{ + size_t len; + const char __user *p; + char c; + char* buf; + + if (!unshare_uts_ns()) + return -ENOMEM; + + buf = uts_buffer(file->f_dentry); + if (!buf) + return -ENOENT; + + len = 0; + p = user_buf; + while (len < count) { + if (get_user(c, p++)) + return -EFAULT; + if (c == 0 || c == '\n') + break; + len++; + } + + if (len >= __NEW_UTS_LEN) + len = __NEW_UTS_LEN - 1; + + if (copy_from_user(buf, user_buf, len)) + return -EFAULT; + + buf[len] = 0; + + *ppos += count; + return count; +} + +static int uts_open(struct inode *inode, struct file *file) +{ + return 0; +} + +static struct file_operations uts_file_operations = { + .read = uts_read_file, + .write = uts_write_file, + .open = uts_open, +}; + +static int __init uts_init(void) +{ + uts_dentry = debugfs_create_dir("uts", NULL); + + uts_dentry_sysname = debugfs_create_file("sysname", 0666, + uts_dentry, NULL, + &uts_file_operations); + uts_dentry_nodename = debugfs_create_file("nodename", 0666, + uts_dentry, NULL, + &uts_file_operations); + uts_dentry_release = debugfs_create_file("release", 0666, + uts_dentry, NULL, + &uts_file_operations); + uts_dentry_version = debugfs_create_file("version", 0666, + uts_dentry, NULL, + &uts_file_operations); + uts_dentry_machine = debugfs_create_file("machine", 0666, + uts_dentry, NULL, + &uts_file_operations); + uts_dentry_domainname = debugfs_create_file("domainname", 0666, + uts_dentry, NULL, + &uts_file_operations); + return 0; +} + +static void __exit uts_exit(void) +{ + debugfs_remove(uts_dentry_sysname); + debugfs_remove(uts_dentry_nodename); + debugfs_remove(uts_dentry_release); + debugfs_remove(uts_dentry_version); + debugfs_remove(uts_dentry_machine); + debugfs_remove(uts_dentry_domainname); + debugfs_remove(uts_dentry); +} + +module_init(uts_init); +module_exit(uts_exit); + + +MODULE_DESCRIPTION("UTS namespace debugfs"); +MODULE_AUTHOR("Cedric Le Goater <clg@fr.ibm.com>"); +MODULE_LICENSE("GPL"); + diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index d57fd91..5ed09b8 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -223,3 +223,14 @@ config RCU_TORTURE_TEST at boot time (you probably don't). Say M if you want the RCU torture tests to build as a module. Say N if you are unsure. + +config DEBUG_UTS_NS + tristate "UTS Namespaces debugging" + depends on UTS_NS + select DEBUG_FS + default n + help + This option provides a kernel module that adds a uts/ directory + in debugfs which can be used to unshare and modify the uts namespace + of the current process and children. If unsure, say N. + -- 1.2.4 ^ permalink raw reply related [flat|nested] 50+ messages in thread
* [RFC][PATCH 2/5] uts namespaces: Switch to using uts namespaces 2006-04-07 18:36 [RFC][PATCH 0/5] uts namespaces: Introduction Serge E. Hallyn 2006-04-07 18:36 ` [RFC][PATCH 5/5] uts namespaces: Enable UTS namespaces debugging Serge E. Hallyn @ 2006-04-07 18:36 ` Serge E. Hallyn 2006-04-07 19:17 ` Sam Ravnborg 2006-04-11 12:26 ` Kirill Korotaev 2006-04-07 18:36 ` [RFC][PATCH 3/5] uts namespaces: Use init uts_namespace when appropriate Serge E. Hallyn ` (4 subsequent siblings) 6 siblings, 2 replies; 50+ messages in thread From: Serge E. Hallyn @ 2006-04-07 18:36 UTC (permalink / raw) To: linux-kernel, Kirill Korotaev, herbert, devel, sam, Eric W. Biederman, xemul, devel, James Morris Replace references to system_utsname to the per-process uts namespace where appropriate. This includes things like uname. Signed-off-by: Serge E. Hallyn <serue@us.ibm.com> --- arch/alpha/kernel/osf_sys.c | 24 ++++++++++++------------ arch/i386/kernel/sys_i386.c | 12 ++++++------ arch/ia64/sn/kernel/sn2/sn_hwperf.c | 2 +- arch/m32r/kernel/sys_m32r.c | 2 +- arch/mips/kernel/linux32.c | 2 +- arch/mips/kernel/syscall.c | 18 +++++++++--------- arch/mips/kernel/sysirix.c | 12 ++++++------ arch/parisc/hpux/sys_hpux.c | 22 +++++++++++----------- arch/powerpc/kernel/syscalls.c | 14 +++++++------- arch/sh/kernel/sys_sh.c | 2 +- arch/sh64/kernel/sys_sh64.c | 2 +- arch/sparc/kernel/sys_sparc.c | 4 ++-- arch/sparc/kernel/sys_sunos.c | 10 +++++----- arch/sparc64/kernel/sys_sparc.c | 4 ++-- arch/sparc64/kernel/sys_sunos32.c | 10 +++++----- arch/sparc64/solaris/misc.c | 6 +++--- arch/um/drivers/mconsole_kern.c | 6 +++--- arch/um/kernel/syscall_kern.c | 12 ++++++------ arch/um/sys-x86_64/syscalls.c | 2 +- arch/x86_64/ia32/sys_ia32.c | 10 +++++----- arch/x86_64/kernel/sys_x86_64.c | 2 +- arch/xtensa/kernel/syscalls.c | 2 +- drivers/char/random.c | 4 ++-- fs/cifs/connect.c | 28 ++++++++++++++-------------- fs/exec.c | 2 +- fs/lockd/clntproc.c | 4 ++-- fs/lockd/mon.c | 2 +- fs/lockd/svclock.c | 2 +- fs/lockd/xdr.c | 2 +- fs/nfs/nfsroot.c | 2 +- include/linux/lockd/lockd.h | 2 +- kernel/sys.c | 14 +++++++------- 32 files changed, 121 insertions(+), 121 deletions(-) 92a8cf13a78415ed5ec9068698b5039ddcc00210 diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c index 31afe3d..b793b96 100644 --- a/arch/alpha/kernel/osf_sys.c +++ b/arch/alpha/kernel/osf_sys.c @@ -402,15 +402,15 @@ osf_utsname(char __user *name) down_read(&uts_sem); error = -EFAULT; - if (copy_to_user(name + 0, system_utsname.sysname, 32)) + if (copy_to_user(name + 0, utsname()->sysname, 32)) goto out; - if (copy_to_user(name + 32, system_utsname.nodename, 32)) + if (copy_to_user(name + 32, utsname()->nodename, 32)) goto out; - if (copy_to_user(name + 64, system_utsname.release, 32)) + if (copy_to_user(name + 64, utsname()->release, 32)) goto out; - if (copy_to_user(name + 96, system_utsname.version, 32)) + if (copy_to_user(name + 96, utsname()->version, 32)) goto out; - if (copy_to_user(name + 128, system_utsname.machine, 32)) + if (copy_to_user(name + 128, utsname()->machine, 32)) goto out; error = 0; @@ -449,8 +449,8 @@ osf_getdomainname(char __user *name, int down_read(&uts_sem); for (i = 0; i < len; ++i) { - __put_user(system_utsname.domainname[i], name + i); - if (system_utsname.domainname[i] == '\0') + __put_user(utsname()->domainname[i], name + i); + if (utsname()->domainname[i] == '\0') break; } up_read(&uts_sem); @@ -608,11 +608,11 @@ asmlinkage long osf_sysinfo(int command, char __user *buf, long count) { static char * sysinfo_table[] = { - system_utsname.sysname, - system_utsname.nodename, - system_utsname.release, - system_utsname.version, - system_utsname.machine, + utsname()->sysname, + utsname()->nodename, + utsname()->release, + utsname()->version, + utsname()->machine, "alpha", /* instruction set architecture */ "dummy", /* hardware serial number */ "dummy", /* hardware manufacturer */ diff --git a/arch/i386/kernel/sys_i386.c b/arch/i386/kernel/sys_i386.c index 8fdb1fb..4af731d 100644 --- a/arch/i386/kernel/sys_i386.c +++ b/arch/i386/kernel/sys_i386.c @@ -210,7 +210,7 @@ asmlinkage int sys_uname(struct old_utsn if (!name) return -EFAULT; down_read(&uts_sem); - err=copy_to_user(name, &system_utsname, sizeof (*name)); + err=copy_to_user(name, utsname(), sizeof (*name)); up_read(&uts_sem); return err?-EFAULT:0; } @@ -226,15 +226,15 @@ asmlinkage int sys_olduname(struct oldol down_read(&uts_sem); - error = __copy_to_user(&name->sysname,&system_utsname.sysname,__OLD_UTS_LEN); + error = __copy_to_user(&name->sysname,&utsname()->sysname,__OLD_UTS_LEN); error |= __put_user(0,name->sysname+__OLD_UTS_LEN); - error |= __copy_to_user(&name->nodename,&system_utsname.nodename,__OLD_UTS_LEN); + error |= __copy_to_user(&name->nodename,&utsname()->nodename,__OLD_UTS_LEN); error |= __put_user(0,name->nodename+__OLD_UTS_LEN); - error |= __copy_to_user(&name->release,&system_utsname.release,__OLD_UTS_LEN); + error |= __copy_to_user(&name->release,&utsname()->release,__OLD_UTS_LEN); error |= __put_user(0,name->release+__OLD_UTS_LEN); - error |= __copy_to_user(&name->version,&system_utsname.version,__OLD_UTS_LEN); + error |= __copy_to_user(&name->version,&utsname()->version,__OLD_UTS_LEN); error |= __put_user(0,name->version+__OLD_UTS_LEN); - error |= __copy_to_user(&name->machine,&system_utsname.machine,__OLD_UTS_LEN); + error |= __copy_to_user(&name->machine,&utsname()->machine,__OLD_UTS_LEN); error |= __put_user(0,name->machine+__OLD_UTS_LEN); up_read(&uts_sem); diff --git a/arch/ia64/sn/kernel/sn2/sn_hwperf.c b/arch/ia64/sn/kernel/sn2/sn_hwperf.c index d917afa..a0632a9 100644 --- a/arch/ia64/sn/kernel/sn2/sn_hwperf.c +++ b/arch/ia64/sn/kernel/sn2/sn_hwperf.c @@ -420,7 +420,7 @@ static int sn_topology_show(struct seq_f "coherency_domain %d, " "region_size %d\n", - partid, system_utsname.nodename, + partid, utsname()->nodename, shubtype ? "shub2" : "shub1", (u64)nasid_mask << nasid_shift, nasid_msb, nasid_shift, system_size, sharing_size, coher, region_size); diff --git a/arch/m32r/kernel/sys_m32r.c b/arch/m32r/kernel/sys_m32r.c index 670cb49..11412c0 100644 --- a/arch/m32r/kernel/sys_m32r.c +++ b/arch/m32r/kernel/sys_m32r.c @@ -206,7 +206,7 @@ asmlinkage int sys_uname(struct old_utsn if (!name) return -EFAULT; down_read(&uts_sem); - err=copy_to_user(name, &system_utsname, sizeof (*name)); + err=copy_to_user(name, utsname(), sizeof (*name)); up_read(&uts_sem); return err?-EFAULT:0; } diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c index 3f40c37..b9b702f 100644 --- a/arch/mips/kernel/linux32.c +++ b/arch/mips/kernel/linux32.c @@ -1100,7 +1100,7 @@ asmlinkage long sys32_newuname(struct ne int ret = 0; down_read(&uts_sem); - if (copy_to_user(name,&system_utsname,sizeof *name)) + if (copy_to_user(name,utsname(),sizeof *name)) ret = -EFAULT; up_read(&uts_sem); diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c index 2aeaa2f..8b13d57 100644 --- a/arch/mips/kernel/syscall.c +++ b/arch/mips/kernel/syscall.c @@ -232,7 +232,7 @@ out: */ asmlinkage int sys_uname(struct old_utsname __user * name) { - if (name && !copy_to_user(name, &system_utsname, sizeof (*name))) + if (name && !copy_to_user(name, utsname(), sizeof (*name))) return 0; return -EFAULT; } @@ -249,15 +249,15 @@ asmlinkage int sys_olduname(struct oldol if (!access_ok(VERIFY_WRITE,name,sizeof(struct oldold_utsname))) return -EFAULT; - error = __copy_to_user(&name->sysname,&system_utsname.sysname,__OLD_UTS_LEN); + error = __copy_to_user(&name->sysname,&utsname()->sysname,__OLD_UTS_LEN); error -= __put_user(0,name->sysname+__OLD_UTS_LEN); - error -= __copy_to_user(&name->nodename,&system_utsname.nodename,__OLD_UTS_LEN); + error -= __copy_to_user(&name->nodename,&utsname()->nodename,__OLD_UTS_LEN); error -= __put_user(0,name->nodename+__OLD_UTS_LEN); - error -= __copy_to_user(&name->release,&system_utsname.release,__OLD_UTS_LEN); + error -= __copy_to_user(&name->release,&utsname()->release,__OLD_UTS_LEN); error -= __put_user(0,name->release+__OLD_UTS_LEN); - error -= __copy_to_user(&name->version,&system_utsname.version,__OLD_UTS_LEN); + error -= __copy_to_user(&name->version,&utsname()->version,__OLD_UTS_LEN); error -= __put_user(0,name->version+__OLD_UTS_LEN); - error -= __copy_to_user(&name->machine,&system_utsname.machine,__OLD_UTS_LEN); + error -= __copy_to_user(&name->machine,&utsname()->machine,__OLD_UTS_LEN); error = __put_user(0,name->machine+__OLD_UTS_LEN); error = error ? -EFAULT : 0; @@ -293,10 +293,10 @@ asmlinkage int _sys_sysmips(int cmd, lon return -EFAULT; down_write(&uts_sem); - strncpy(system_utsname.nodename, nodename, len); + strncpy(utsname()->nodename, nodename, len); nodename[__NEW_UTS_LEN] = '\0'; - strlcpy(system_utsname.nodename, nodename, - sizeof(system_utsname.nodename)); + strlcpy(utsname()->nodename, nodename, + sizeof(utsname()->nodename)); up_write(&uts_sem); return 0; } diff --git a/arch/mips/kernel/sysirix.c b/arch/mips/kernel/sysirix.c index 5407b78..1b4e7e7 100644 --- a/arch/mips/kernel/sysirix.c +++ b/arch/mips/kernel/sysirix.c @@ -884,7 +884,7 @@ asmlinkage int irix_getdomainname(char _ down_read(&uts_sem); if (len > __NEW_UTS_LEN) len = __NEW_UTS_LEN; - err = copy_to_user(name, system_utsname.domainname, len) ? -EFAULT : 0; + err = copy_to_user(name, utsname()->domainname, len) ? -EFAULT : 0; up_read(&uts_sem); return err; @@ -1127,11 +1127,11 @@ struct iuname { asmlinkage int irix_uname(struct iuname __user *buf) { down_read(&uts_sem); - if (copy_from_user(system_utsname.sysname, buf->sysname, 65) - || copy_from_user(system_utsname.nodename, buf->nodename, 65) - || copy_from_user(system_utsname.release, buf->release, 65) - || copy_from_user(system_utsname.version, buf->version, 65) - || copy_from_user(system_utsname.machine, buf->machine, 65)) { + if (copy_from_user(utsname()->sysname, buf->sysname, 65) + || copy_from_user(utsname()->nodename, buf->nodename, 65) + || copy_from_user(utsname()->release, buf->release, 65) + || copy_from_user(utsname()->version, buf->version, 65) + || copy_from_user(utsname()->machine, buf->machine, 65)) { return -EFAULT; } up_read(&uts_sem); diff --git a/arch/parisc/hpux/sys_hpux.c b/arch/parisc/hpux/sys_hpux.c index 05273cc..9fc2c08 100644 --- a/arch/parisc/hpux/sys_hpux.c +++ b/arch/parisc/hpux/sys_hpux.c @@ -266,15 +266,15 @@ static int hpux_uname(struct hpux_utsnam down_read(&uts_sem); - error = __copy_to_user(&name->sysname,&system_utsname.sysname,HPUX_UTSLEN-1); + error = __copy_to_user(&name->sysname,&utsname()->sysname,HPUX_UTSLEN-1); error |= __put_user(0,name->sysname+HPUX_UTSLEN-1); - error |= __copy_to_user(&name->nodename,&system_utsname.nodename,HPUX_UTSLEN-1); + error |= __copy_to_user(&name->nodename,&utsname()->nodename,HPUX_UTSLEN-1); error |= __put_user(0,name->nodename+HPUX_UTSLEN-1); - error |= __copy_to_user(&name->release,&system_utsname.release,HPUX_UTSLEN-1); + error |= __copy_to_user(&name->release,&utsname()->release,HPUX_UTSLEN-1); error |= __put_user(0,name->release+HPUX_UTSLEN-1); - error |= __copy_to_user(&name->version,&system_utsname.version,HPUX_UTSLEN-1); + error |= __copy_to_user(&name->version,&utsname()->version,HPUX_UTSLEN-1); error |= __put_user(0,name->version+HPUX_UTSLEN-1); - error |= __copy_to_user(&name->machine,&system_utsname.machine,HPUX_UTSLEN-1); + error |= __copy_to_user(&name->machine,&utsname()->machine,HPUX_UTSLEN-1); error |= __put_user(0,name->machine+HPUX_UTSLEN-1); up_read(&uts_sem); @@ -373,8 +373,8 @@ int hpux_utssys(char *ubuf, int n, int t /* TODO: print a warning about using this? */ down_write(&uts_sem); error = -EFAULT; - if (!copy_from_user(system_utsname.sysname, ubuf, len)) { - system_utsname.sysname[len] = 0; + if (!copy_from_user(utsname()->sysname, ubuf, len)) { + utsname()->sysname[len] = 0; error = 0; } up_write(&uts_sem); @@ -400,8 +400,8 @@ int hpux_utssys(char *ubuf, int n, int t /* TODO: print a warning about this? */ down_write(&uts_sem); error = -EFAULT; - if (!copy_from_user(system_utsname.release, ubuf, len)) { - system_utsname.release[len] = 0; + if (!copy_from_user(utsname()->release, ubuf, len)) { + utsname()->release[len] = 0; error = 0; } up_write(&uts_sem); @@ -422,13 +422,13 @@ int hpux_getdomainname(char *name, int l down_read(&uts_sem); - nlen = strlen(system_utsname.domainname) + 1; + nlen = strlen(utsname()->domainname) + 1; if (nlen < len) len = nlen; if(len > __NEW_UTS_LEN) goto done; - if(copy_to_user(name, system_utsname.domainname, len)) + if(copy_to_user(name, utsname()->domainname, len)) goto done; err = 0; done: diff --git a/arch/powerpc/kernel/syscalls.c b/arch/powerpc/kernel/syscalls.c index 9b69d99..d358866 100644 --- a/arch/powerpc/kernel/syscalls.c +++ b/arch/powerpc/kernel/syscalls.c @@ -260,7 +260,7 @@ long ppc_newuname(struct new_utsname __u int err = 0; down_read(&uts_sem); - if (copy_to_user(name, &system_utsname, sizeof(*name))) + if (copy_to_user(name, utsname(), sizeof(*name))) err = -EFAULT; up_read(&uts_sem); if (!err) @@ -273,7 +273,7 @@ int sys_uname(struct old_utsname __user int err = 0; down_read(&uts_sem); - if (copy_to_user(name, &system_utsname, sizeof(*name))) + if (copy_to_user(name, utsname(), sizeof(*name))) err = -EFAULT; up_read(&uts_sem); if (!err) @@ -289,19 +289,19 @@ int sys_olduname(struct oldold_utsname _ return -EFAULT; down_read(&uts_sem); - error = __copy_to_user(&name->sysname, &system_utsname.sysname, + error = __copy_to_user(&name->sysname, &utsname()->sysname, __OLD_UTS_LEN); error |= __put_user(0, name->sysname + __OLD_UTS_LEN); - error |= __copy_to_user(&name->nodename, &system_utsname.nodename, + error |= __copy_to_user(&name->nodename, &utsname()->nodename, __OLD_UTS_LEN); error |= __put_user(0, name->nodename + __OLD_UTS_LEN); - error |= __copy_to_user(&name->release, &system_utsname.release, + error |= __copy_to_user(&name->release, &utsname()->release, __OLD_UTS_LEN); error |= __put_user(0, name->release + __OLD_UTS_LEN); - error |= __copy_to_user(&name->version, &system_utsname.version, + error |= __copy_to_user(&name->version, &utsname()->version, __OLD_UTS_LEN); error |= __put_user(0, name->version + __OLD_UTS_LEN); - error |= __copy_to_user(&name->machine, &system_utsname.machine, + error |= __copy_to_user(&name->machine, &utsname()->machine, __OLD_UTS_LEN); error |= override_machine(name->machine); up_read(&uts_sem); diff --git a/arch/sh/kernel/sys_sh.c b/arch/sh/kernel/sys_sh.c index 917b2f3..e4966b2 100644 --- a/arch/sh/kernel/sys_sh.c +++ b/arch/sh/kernel/sys_sh.c @@ -267,7 +267,7 @@ asmlinkage int sys_uname(struct old_utsn if (!name) return -EFAULT; down_read(&uts_sem); - err=copy_to_user(name, &system_utsname, sizeof (*name)); + err=copy_to_user(name, utsname(), sizeof (*name)); up_read(&uts_sem); return err?-EFAULT:0; } diff --git a/arch/sh64/kernel/sys_sh64.c b/arch/sh64/kernel/sys_sh64.c index 58ff7d5..a8dc88c 100644 --- a/arch/sh64/kernel/sys_sh64.c +++ b/arch/sh64/kernel/sys_sh64.c @@ -279,7 +279,7 @@ asmlinkage int sys_uname(struct old_utsn if (!name) return -EFAULT; down_read(&uts_sem); - err=copy_to_user(name, &system_utsname, sizeof (*name)); + err=copy_to_user(name, utsname(), sizeof (*name)); up_read(&uts_sem); return err?-EFAULT:0; } diff --git a/arch/sparc/kernel/sys_sparc.c b/arch/sparc/kernel/sys_sparc.c index 0cdfc9d..c8ad73c 100644 --- a/arch/sparc/kernel/sys_sparc.c +++ b/arch/sparc/kernel/sys_sparc.c @@ -470,13 +470,13 @@ asmlinkage int sys_getdomainname(char __ down_read(&uts_sem); - nlen = strlen(system_utsname.domainname) + 1; + nlen = strlen(utsname()->domainname) + 1; if (nlen < len) len = nlen; if (len > __NEW_UTS_LEN) goto done; - if (copy_to_user(name, system_utsname.domainname, len)) + if (copy_to_user(name, utsname()->domainname, len)) goto done; err = 0; done: diff --git a/arch/sparc/kernel/sys_sunos.c b/arch/sparc/kernel/sys_sunos.c index 288de27..9f9206f 100644 --- a/arch/sparc/kernel/sys_sunos.c +++ b/arch/sparc/kernel/sys_sunos.c @@ -483,13 +483,13 @@ asmlinkage int sunos_uname(struct sunos_ { int ret; down_read(&uts_sem); - ret = copy_to_user(&name->sname[0], &system_utsname.sysname[0], sizeof(name->sname) - 1); + ret = copy_to_user(&name->sname[0], &utsname()->sysname[0], sizeof(name->sname) - 1); if (!ret) { - ret |= __copy_to_user(&name->nname[0], &system_utsname.nodename[0], sizeof(name->nname) - 1); + ret |= __copy_to_user(&name->nname[0], &utsname()->nodename[0], sizeof(name->nname) - 1); ret |= __put_user('\0', &name->nname[8]); - ret |= __copy_to_user(&name->rel[0], &system_utsname.release[0], sizeof(name->rel) - 1); - ret |= __copy_to_user(&name->ver[0], &system_utsname.version[0], sizeof(name->ver) - 1); - ret |= __copy_to_user(&name->mach[0], &system_utsname.machine[0], sizeof(name->mach) - 1); + ret |= __copy_to_user(&name->rel[0], &utsname()->release[0], sizeof(name->rel) - 1); + ret |= __copy_to_user(&name->ver[0], &utsname()->version[0], sizeof(name->ver) - 1); + ret |= __copy_to_user(&name->mach[0], &utsname()->machine[0], sizeof(name->mach) - 1); } up_read(&uts_sem); return ret ? -EFAULT : 0; diff --git a/arch/sparc64/kernel/sys_sparc.c b/arch/sparc64/kernel/sys_sparc.c index 7a86913..0453bd2 100644 --- a/arch/sparc64/kernel/sys_sparc.c +++ b/arch/sparc64/kernel/sys_sparc.c @@ -707,13 +707,13 @@ asmlinkage long sys_getdomainname(char _ down_read(&uts_sem); - nlen = strlen(system_utsname.domainname) + 1; + nlen = strlen(utsname()->domainname) + 1; if (nlen < len) len = nlen; if (len > __NEW_UTS_LEN) goto done; - if (copy_to_user(name, system_utsname.domainname, len)) + if (copy_to_user(name, utsname()->domainname, len)) goto done; err = 0; done: diff --git a/arch/sparc64/kernel/sys_sunos32.c b/arch/sparc64/kernel/sys_sunos32.c index ae5b32f..ba98c47 100644 --- a/arch/sparc64/kernel/sys_sunos32.c +++ b/arch/sparc64/kernel/sys_sunos32.c @@ -439,16 +439,16 @@ asmlinkage int sunos_uname(struct sunos_ int ret; down_read(&uts_sem); - ret = copy_to_user(&name->sname[0], &system_utsname.sysname[0], + ret = copy_to_user(&name->sname[0], &utsname()->sysname[0], sizeof(name->sname) - 1); - ret |= copy_to_user(&name->nname[0], &system_utsname.nodename[0], + ret |= copy_to_user(&name->nname[0], &utsname()->nodename[0], sizeof(name->nname) - 1); ret |= put_user('\0', &name->nname[8]); - ret |= copy_to_user(&name->rel[0], &system_utsname.release[0], + ret |= copy_to_user(&name->rel[0], &utsname()->release[0], sizeof(name->rel) - 1); - ret |= copy_to_user(&name->ver[0], &system_utsname.version[0], + ret |= copy_to_user(&name->ver[0], &utsname()->version[0], sizeof(name->ver) - 1); - ret |= copy_to_user(&name->mach[0], &system_utsname.machine[0], + ret |= copy_to_user(&name->mach[0], &utsname()->machine[0], sizeof(name->mach) - 1); up_read(&uts_sem); return (ret ? -EFAULT : 0); diff --git a/arch/sparc64/solaris/misc.c b/arch/sparc64/solaris/misc.c index 5284996..5d0162a 100644 --- a/arch/sparc64/solaris/misc.c +++ b/arch/sparc64/solaris/misc.c @@ -239,7 +239,7 @@ asmlinkage int solaris_utssys(u32 buf, u /* Let's cheat */ err = set_utsfield(v->sysname, "SunOS", 1, 0); down_read(&uts_sem); - err |= set_utsfield(v->nodename, system_utsname.nodename, + err |= set_utsfield(v->nodename, utsname()->nodename, 1, 1); up_read(&uts_sem); err |= set_utsfield(v->release, "2.6", 0, 0); @@ -263,7 +263,7 @@ asmlinkage int solaris_utsname(u32 buf) /* Why should we not lie a bit? */ down_read(&uts_sem); err = set_utsfield(v->sysname, "SunOS", 0, 0); - err |= set_utsfield(v->nodename, system_utsname.nodename, 1, 1); + err |= set_utsfield(v->nodename, utsname()->nodename, 1, 1); err |= set_utsfield(v->release, "5.6", 0, 0); err |= set_utsfield(v->version, "Generic", 0, 0); err |= set_utsfield(v->machine, machine(), 0, 0); @@ -295,7 +295,7 @@ asmlinkage int solaris_sysinfo(int cmd, case SI_HOSTNAME: r = buffer + 256; down_read(&uts_sem); - for (p = system_utsname.nodename, q = buffer; + for (p = utsname()->nodename, q = buffer; q < r && *p && *p != '.'; *q++ = *p++); up_read(&uts_sem); *q = 0; diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c index 28e3760..5f87323 100644 --- a/arch/um/drivers/mconsole_kern.c +++ b/arch/um/drivers/mconsole_kern.c @@ -106,9 +106,9 @@ void mconsole_version(struct mc_request { char version[256]; - sprintf(version, "%s %s %s %s %s", system_utsname.sysname, - system_utsname.nodename, system_utsname.release, - system_utsname.version, system_utsname.machine); + sprintf(version, "%s %s %s %s %s", utsname()->sysname, + utsname()->nodename, utsname()->release, + utsname()->version, utsname()->machine); mconsole_reply(req, version, 0, 0); } diff --git a/arch/um/kernel/syscall_kern.c b/arch/um/kernel/syscall_kern.c index 37d3978..d90e9ed 100644 --- a/arch/um/kernel/syscall_kern.c +++ b/arch/um/kernel/syscall_kern.c @@ -110,7 +110,7 @@ long sys_uname(struct old_utsname __user if (!name) return -EFAULT; down_read(&uts_sem); - err=copy_to_user(name, &system_utsname, sizeof (*name)); + err=copy_to_user(name, utsname(), sizeof (*name)); up_read(&uts_sem); return err?-EFAULT:0; } @@ -126,19 +126,19 @@ long sys_olduname(struct oldold_utsname down_read(&uts_sem); - error = __copy_to_user(&name->sysname,&system_utsname.sysname, + error = __copy_to_user(&name->sysname,&utsname()->sysname, __OLD_UTS_LEN); error |= __put_user(0,name->sysname+__OLD_UTS_LEN); - error |= __copy_to_user(&name->nodename,&system_utsname.nodename, + error |= __copy_to_user(&name->nodename,&utsname()->nodename, __OLD_UTS_LEN); error |= __put_user(0,name->nodename+__OLD_UTS_LEN); - error |= __copy_to_user(&name->release,&system_utsname.release, + error |= __copy_to_user(&name->release,&utsname()->release, __OLD_UTS_LEN); error |= __put_user(0,name->release+__OLD_UTS_LEN); - error |= __copy_to_user(&name->version,&system_utsname.version, + error |= __copy_to_user(&name->version,&utsname()->version, __OLD_UTS_LEN); error |= __put_user(0,name->version+__OLD_UTS_LEN); - error |= __copy_to_user(&name->machine,&system_utsname.machine, + error |= __copy_to_user(&name->machine,&utsname()->machine, __OLD_UTS_LEN); error |= __put_user(0,name->machine+__OLD_UTS_LEN); diff --git a/arch/um/sys-x86_64/syscalls.c b/arch/um/sys-x86_64/syscalls.c index 6acee5c..3ad014e 100644 --- a/arch/um/sys-x86_64/syscalls.c +++ b/arch/um/sys-x86_64/syscalls.c @@ -21,7 +21,7 @@ asmlinkage long sys_uname64(struct new_u { int err; down_read(&uts_sem); - err = copy_to_user(name, &system_utsname, sizeof (*name)); + err = copy_to_user(name, utsname(), sizeof (*name)); up_read(&uts_sem); if (personality(current->personality) == PER_LINUX32) err |= copy_to_user(&name->machine, "i686", 5); diff --git a/arch/x86_64/ia32/sys_ia32.c b/arch/x86_64/ia32/sys_ia32.c index f182b20..6e0a19d 100644 --- a/arch/x86_64/ia32/sys_ia32.c +++ b/arch/x86_64/ia32/sys_ia32.c @@ -801,13 +801,13 @@ asmlinkage long sys32_olduname(struct ol down_read(&uts_sem); - error = __copy_to_user(&name->sysname,&system_utsname.sysname,__OLD_UTS_LEN); + error = __copy_to_user(&name->sysname,&utsname()->sysname,__OLD_UTS_LEN); __put_user(0,name->sysname+__OLD_UTS_LEN); - __copy_to_user(&name->nodename,&system_utsname.nodename,__OLD_UTS_LEN); + __copy_to_user(&name->nodename,&utsname()->nodename,__OLD_UTS_LEN); __put_user(0,name->nodename+__OLD_UTS_LEN); - __copy_to_user(&name->release,&system_utsname.release,__OLD_UTS_LEN); + __copy_to_user(&name->release,&utsname()->release,__OLD_UTS_LEN); __put_user(0,name->release+__OLD_UTS_LEN); - __copy_to_user(&name->version,&system_utsname.version,__OLD_UTS_LEN); + __copy_to_user(&name->version,&utsname()->version,__OLD_UTS_LEN); __put_user(0,name->version+__OLD_UTS_LEN); { char *arch = "x86_64"; @@ -830,7 +830,7 @@ long sys32_uname(struct old_utsname __us if (!name) return -EFAULT; down_read(&uts_sem); - err=copy_to_user(name, &system_utsname, sizeof (*name)); + err=copy_to_user(name, utsname(), sizeof (*name)); up_read(&uts_sem); if (personality(current->personality) == PER_LINUX32) err |= copy_to_user(&name->machine, "i686", 5); diff --git a/arch/x86_64/kernel/sys_x86_64.c b/arch/x86_64/kernel/sys_x86_64.c index 6449ea8..76bf7c2 100644 --- a/arch/x86_64/kernel/sys_x86_64.c +++ b/arch/x86_64/kernel/sys_x86_64.c @@ -148,7 +148,7 @@ asmlinkage long sys_uname(struct new_uts { int err; down_read(&uts_sem); - err = copy_to_user(name, &system_utsname, sizeof (*name)); + err = copy_to_user(name, utsname(), sizeof (*name)); up_read(&uts_sem); if (personality(current->personality) == PER_LINUX32) err |= copy_to_user(&name->machine, "i686", 5); diff --git a/arch/xtensa/kernel/syscalls.c b/arch/xtensa/kernel/syscalls.c index f20c649..30060c1 100644 --- a/arch/xtensa/kernel/syscalls.c +++ b/arch/xtensa/kernel/syscalls.c @@ -129,7 +129,7 @@ out: int sys_uname(struct old_utsname * name) { - if (name && !copy_to_user(name, &system_utsname, sizeof (*name))) + if (name && !copy_to_user(name, utsname(), sizeof (*name))) return 0; return -EFAULT; } diff --git a/drivers/char/random.c b/drivers/char/random.c index 86be04b..ec4c11d 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -888,8 +888,8 @@ static void init_std_data(struct entropy do_gettimeofday(&tv); add_entropy_words(r, (__u32 *)&tv, sizeof(tv)/4); - add_entropy_words(r, (__u32 *)&system_utsname, - sizeof(system_utsname)/4); + add_entropy_words(r, (__u32 *)utsname(), + sizeof(*(utsname()))/4); } static int __init rand_initialize(void) diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 0b86d5c..852ff41 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -765,12 +765,12 @@ cifs_parse_mount_options(char *options, separator[1] = 0; memset(vol->source_rfc1001_name,0x20,15); - for(i=0;i < strnlen(system_utsname.nodename,15);i++) { + for(i=0;i < strnlen(utsname()->nodename,15);i++) { /* does not have to be a perfect mapping since the field is informational, only used for servers that do not support port 445 and it can be overridden at mount time */ vol->source_rfc1001_name[i] = - toupper(system_utsname.nodename[i]); + toupper(utsname()->nodename[i]); } vol->source_rfc1001_name[15] = 0; /* null target name indicates to use *SMBSERVR default called name @@ -2077,7 +2077,7 @@ CIFSSessSetup(unsigned int xid, struct c 32, nls_codepage); bcc_ptr += 2 * bytes_returned; bytes_returned = - cifs_strtoUCS((__le16 *) bcc_ptr, system_utsname.release, + cifs_strtoUCS((__le16 *) bcc_ptr, utsname()->release, 32, nls_codepage); bcc_ptr += 2 * bytes_returned; bcc_ptr += 2; @@ -2104,8 +2104,8 @@ CIFSSessSetup(unsigned int xid, struct c } strcpy(bcc_ptr, "Linux version "); bcc_ptr += strlen("Linux version "); - strcpy(bcc_ptr, system_utsname.release); - bcc_ptr += strlen(system_utsname.release) + 1; + strcpy(bcc_ptr, utsname()->release); + bcc_ptr += strlen(utsname()->release) + 1; strcpy(bcc_ptr, CIFS_NETWORK_OPSYS); bcc_ptr += strlen(CIFS_NETWORK_OPSYS) + 1; } @@ -2346,7 +2346,7 @@ CIFSSpnegoSessSetup(unsigned int xid, st 32, nls_codepage); bcc_ptr += 2 * bytes_returned; bytes_returned = - cifs_strtoUCS((__le16 *) bcc_ptr, system_utsname.release, 32, + cifs_strtoUCS((__le16 *) bcc_ptr, utsname()->release, 32, nls_codepage); bcc_ptr += 2 * bytes_returned; bcc_ptr += 2; @@ -2371,8 +2371,8 @@ CIFSSpnegoSessSetup(unsigned int xid, st } strcpy(bcc_ptr, "Linux version "); bcc_ptr += strlen("Linux version "); - strcpy(bcc_ptr, system_utsname.release); - bcc_ptr += strlen(system_utsname.release) + 1; + strcpy(bcc_ptr, utsname()->release); + bcc_ptr += strlen(utsname()->release) + 1; strcpy(bcc_ptr, CIFS_NETWORK_OPSYS); bcc_ptr += strlen(CIFS_NETWORK_OPSYS) + 1; } @@ -2622,7 +2622,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned i 32, nls_codepage); bcc_ptr += 2 * bytes_returned; bytes_returned = - cifs_strtoUCS((__le16 *) bcc_ptr, system_utsname.release, 32, + cifs_strtoUCS((__le16 *) bcc_ptr, utsname()->release, 32, nls_codepage); bcc_ptr += 2 * bytes_returned; bcc_ptr += 2; /* null terminate Linux version */ @@ -2639,8 +2639,8 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned i } else { /* ASCII */ strcpy(bcc_ptr, "Linux version "); bcc_ptr += strlen("Linux version "); - strcpy(bcc_ptr, system_utsname.release); - bcc_ptr += strlen(system_utsname.release) + 1; + strcpy(bcc_ptr, utsname()->release); + bcc_ptr += strlen(utsname()->release) + 1; strcpy(bcc_ptr, CIFS_NETWORK_OPSYS); bcc_ptr += strlen(CIFS_NETWORK_OPSYS) + 1; bcc_ptr++; /* empty domain field */ @@ -3001,7 +3001,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xi 32, nls_codepage); bcc_ptr += 2 * bytes_returned; bytes_returned = - cifs_strtoUCS((__le16 *) bcc_ptr, system_utsname.release, 32, + cifs_strtoUCS((__le16 *) bcc_ptr, utsname()->release, 32, nls_codepage); bcc_ptr += 2 * bytes_returned; bcc_ptr += 2; /* null term version string */ @@ -3053,8 +3053,8 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xi strcpy(bcc_ptr, "Linux version "); bcc_ptr += strlen("Linux version "); - strcpy(bcc_ptr, system_utsname.release); - bcc_ptr += strlen(system_utsname.release) + 1; + strcpy(bcc_ptr, utsname()->release); + bcc_ptr += strlen(utsname()->release) + 1; strcpy(bcc_ptr, CIFS_NETWORK_OPSYS); bcc_ptr += strlen(CIFS_NETWORK_OPSYS) + 1; bcc_ptr++; /* null domain */ diff --git a/fs/exec.c b/fs/exec.c index 0291a68..d881479 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -1347,7 +1347,7 @@ static void format_corename(char *corena case 'h': down_read(&uts_sem); rc = snprintf(out_ptr, out_end - out_ptr, - "%s", system_utsname.nodename); + "%s", utsname()->nodename); up_read(&uts_sem); if (rc > out_end - out_ptr) goto out; diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c index f96e381..915e596 100644 --- a/fs/lockd/clntproc.c +++ b/fs/lockd/clntproc.c @@ -130,11 +130,11 @@ static void nlmclnt_setlockargs(struct n nlmclnt_next_cookie(&argp->cookie); argp->state = nsm_local_state; memcpy(&lock->fh, NFS_FH(fl->fl_file->f_dentry->d_inode), sizeof(struct nfs_fh)); - lock->caller = system_utsname.nodename; + lock->caller = utsname()->nodename; lock->oh.data = req->a_owner; lock->oh.len = snprintf(req->a_owner, sizeof(req->a_owner), "%u@%s", (unsigned int)fl->fl_u.nfs_fl.owner->pid, - system_utsname.nodename); + utsname()->nodename); lock->svid = fl->fl_u.nfs_fl.owner->pid; lock->fl.fl_start = fl->fl_start; lock->fl.fl_end = fl->fl_end; diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c index 3fc683f..547aaa3 100644 --- a/fs/lockd/mon.c +++ b/fs/lockd/mon.c @@ -152,7 +152,7 @@ xdr_encode_common(struct rpc_rqst *rqstp */ sprintf(buffer, "%u.%u.%u.%u", NIPQUAD(argp->addr)); if (!(p = xdr_encode_string(p, buffer)) - || !(p = xdr_encode_string(p, system_utsname.nodename))) + || !(p = xdr_encode_string(p, utsname()->nodename))) return ERR_PTR(-EIO); *p++ = htonl(argp->prog); *p++ = htonl(argp->vers); diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c index d2b66ba..61b4791 100644 --- a/fs/lockd/svclock.c +++ b/fs/lockd/svclock.c @@ -326,7 +326,7 @@ static int nlmsvc_setgrantargs(struct nl { locks_copy_lock(&call->a_args.lock.fl, &lock->fl); memcpy(&call->a_args.lock.fh, &lock->fh, sizeof(call->a_args.lock.fh)); - call->a_args.lock.caller = system_utsname.nodename; + call->a_args.lock.caller = utsname()->nodename; call->a_args.lock.oh.len = lock->oh.len; /* set default data area */ diff --git a/fs/lockd/xdr.c b/fs/lockd/xdr.c index f22a376..4eec051 100644 --- a/fs/lockd/xdr.c +++ b/fs/lockd/xdr.c @@ -516,7 +516,7 @@ nlmclt_decode_res(struct rpc_rqst *req, */ #define NLM_void_sz 0 #define NLM_cookie_sz 1+XDR_QUADLEN(NLM_MAXCOOKIELEN) -#define NLM_caller_sz 1+XDR_QUADLEN(sizeof(system_utsname.nodename)) +#define NLM_caller_sz 1+XDR_QUADLEN(sizeof(utsname()->nodename)) #define NLM_netobj_sz 1+XDR_QUADLEN(XDR_MAX_NETOBJ) /* #define NLM_owner_sz 1+XDR_QUADLEN(NLM_MAXOWNER) */ #define NLM_fhandle_sz 1+XDR_QUADLEN(NFS2_FHSIZE) diff --git a/fs/nfs/nfsroot.c b/fs/nfs/nfsroot.c index c0a754e..1d656a6 100644 --- a/fs/nfs/nfsroot.c +++ b/fs/nfs/nfsroot.c @@ -312,7 +312,7 @@ static int __init root_nfs_name(char *na /* Override them by options set on kernel command-line */ root_nfs_parse(name, buf); - cp = system_utsname.nodename; + cp = utsname()->nodename; if (strlen(buf) + strlen(cp) > NFS_MAXPATHLEN) { printk(KERN_ERR "Root-NFS: Pathname for remote directory too long.\n"); return -1; diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h index 995f89d..ac15b87 100644 --- a/include/linux/lockd/lockd.h +++ b/include/linux/lockd/lockd.h @@ -80,7 +80,7 @@ struct nlm_wait; /* * Memory chunk for NLM client RPC request. */ -#define NLMCLNT_OHSIZE (sizeof(system_utsname.nodename)+10) +#define NLMCLNT_OHSIZE (sizeof(utsname()->nodename)+10) struct nlm_rqst { unsigned int a_flags; /* initial RPC task flags */ struct nlm_host * a_host; /* host handle */ diff --git a/kernel/sys.c b/kernel/sys.c index 0b6ec0e..bcaa48e 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -1671,7 +1671,7 @@ asmlinkage long sys_newuname(struct new_ int errno = 0; down_read(&uts_sem); - if (copy_to_user(name,&system_utsname,sizeof *name)) + if (copy_to_user(name,utsname(),sizeof *name)) errno = -EFAULT; up_read(&uts_sem); return errno; @@ -1689,8 +1689,8 @@ asmlinkage long sys_sethostname(char __u down_write(&uts_sem); errno = -EFAULT; if (!copy_from_user(tmp, name, len)) { - memcpy(system_utsname.nodename, tmp, len); - system_utsname.nodename[len] = 0; + memcpy(utsname()->nodename, tmp, len); + utsname()->nodename[len] = 0; errno = 0; } up_write(&uts_sem); @@ -1706,11 +1706,11 @@ asmlinkage long sys_gethostname(char __u if (len < 0) return -EINVAL; down_read(&uts_sem); - i = 1 + strlen(system_utsname.nodename); + i = 1 + strlen(utsname()->nodename); if (i > len) i = len; errno = 0; - if (copy_to_user(name, system_utsname.nodename, i)) + if (copy_to_user(name, utsname()->nodename, i)) errno = -EFAULT; up_read(&uts_sem); return errno; @@ -1735,8 +1735,8 @@ asmlinkage long sys_setdomainname(char _ down_write(&uts_sem); errno = -EFAULT; if (!copy_from_user(tmp, name, len)) { - memcpy(system_utsname.domainname, tmp, len); - system_utsname.domainname[len] = 0; + memcpy(utsname()->domainname, tmp, len); + utsname()->domainname[len] = 0; errno = 0; } up_write(&uts_sem); -- 1.2.4 ^ permalink raw reply related [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 2/5] uts namespaces: Switch to using uts namespaces 2006-04-07 18:36 ` [RFC][PATCH 2/5] uts namespaces: Switch to using uts namespaces Serge E. Hallyn @ 2006-04-07 19:17 ` Sam Ravnborg 2006-04-07 19:25 ` Serge E. Hallyn 2006-04-11 12:26 ` Kirill Korotaev 1 sibling, 1 reply; 50+ messages in thread From: Sam Ravnborg @ 2006-04-07 19:17 UTC (permalink / raw) To: Serge E. Hallyn Cc: linux-kernel, Kirill Korotaev, herbert, devel, sam, Eric W. Biederman, xemul, James Morris On Fri, Apr 07, 2006 at 01:36:00PM -0500, Serge E. Hallyn wrote: > Replace references to system_utsname to the per-process uts namespace > where appropriate. This includes things like uname. If you define helpers that operates on system_utsname and then apply this patch the kernel will still compile, and only later you can introduce the new stuff. Sam ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 2/5] uts namespaces: Switch to using uts namespaces 2006-04-07 19:17 ` Sam Ravnborg @ 2006-04-07 19:25 ` Serge E. Hallyn 0 siblings, 0 replies; 50+ messages in thread From: Serge E. Hallyn @ 2006-04-07 19:25 UTC (permalink / raw) To: Sam Ravnborg Cc: Serge E. Hallyn, linux-kernel, Kirill Korotaev, herbert, devel, sam, Eric W. Biederman, xemul, James Morris Quoting Sam Ravnborg (sam@ravnborg.org): > On Fri, Apr 07, 2006 at 01:36:00PM -0500, Serge E. Hallyn wrote: > > Replace references to system_utsname to the per-process uts namespace > > where appropriate. This includes things like uname. > If you define helpers that operates on system_utsname and then apply > this patch the kernel will still compile, and only later you can > introduce the new stuff. Ok, will try structuring the patches that way. thanks, -serge ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 2/5] uts namespaces: Switch to using uts namespaces 2006-04-07 18:36 ` [RFC][PATCH 2/5] uts namespaces: Switch to using uts namespaces Serge E. Hallyn 2006-04-07 19:17 ` Sam Ravnborg @ 2006-04-11 12:26 ` Kirill Korotaev 2006-04-11 21:04 ` Sam Vilain 1 sibling, 1 reply; 50+ messages in thread From: Kirill Korotaev @ 2006-04-11 12:26 UTC (permalink / raw) To: Serge E. Hallyn Cc: linux-kernel, herbert, devel, sam, Eric W. Biederman, xemul, James Morris Serge, BTW, have you noticed that NFS is using utsname for internal processes and in general case this makes NFS ns to be coupled with uts ns? Kirill > Replace references to system_utsname to the per-process uts namespace > where appropriate. This includes things like uname. > > Signed-off-by: Serge E. Hallyn <serue@us.ibm.com> > --- > arch/alpha/kernel/osf_sys.c | 24 ++++++++++++------------ > arch/i386/kernel/sys_i386.c | 12 ++++++------ > arch/ia64/sn/kernel/sn2/sn_hwperf.c | 2 +- > arch/m32r/kernel/sys_m32r.c | 2 +- > arch/mips/kernel/linux32.c | 2 +- > arch/mips/kernel/syscall.c | 18 +++++++++--------- > arch/mips/kernel/sysirix.c | 12 ++++++------ > arch/parisc/hpux/sys_hpux.c | 22 +++++++++++----------- > arch/powerpc/kernel/syscalls.c | 14 +++++++------- > arch/sh/kernel/sys_sh.c | 2 +- > arch/sh64/kernel/sys_sh64.c | 2 +- > arch/sparc/kernel/sys_sparc.c | 4 ++-- > arch/sparc/kernel/sys_sunos.c | 10 +++++----- > arch/sparc64/kernel/sys_sparc.c | 4 ++-- > arch/sparc64/kernel/sys_sunos32.c | 10 +++++----- > arch/sparc64/solaris/misc.c | 6 +++--- > arch/um/drivers/mconsole_kern.c | 6 +++--- > arch/um/kernel/syscall_kern.c | 12 ++++++------ > arch/um/sys-x86_64/syscalls.c | 2 +- > arch/x86_64/ia32/sys_ia32.c | 10 +++++----- > arch/x86_64/kernel/sys_x86_64.c | 2 +- > arch/xtensa/kernel/syscalls.c | 2 +- > drivers/char/random.c | 4 ++-- > fs/cifs/connect.c | 28 ++++++++++++++-------------- > fs/exec.c | 2 +- > fs/lockd/clntproc.c | 4 ++-- > fs/lockd/mon.c | 2 +- > fs/lockd/svclock.c | 2 +- > fs/lockd/xdr.c | 2 +- > fs/nfs/nfsroot.c | 2 +- > include/linux/lockd/lockd.h | 2 +- > kernel/sys.c | 14 +++++++------- > 32 files changed, 121 insertions(+), 121 deletions(-) > > 92a8cf13a78415ed5ec9068698b5039ddcc00210 > diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c > index 31afe3d..b793b96 100644 > --- a/arch/alpha/kernel/osf_sys.c > +++ b/arch/alpha/kernel/osf_sys.c > @@ -402,15 +402,15 @@ osf_utsname(char __user *name) > > down_read(&uts_sem); > error = -EFAULT; > - if (copy_to_user(name + 0, system_utsname.sysname, 32)) > + if (copy_to_user(name + 0, utsname()->sysname, 32)) > goto out; > - if (copy_to_user(name + 32, system_utsname.nodename, 32)) > + if (copy_to_user(name + 32, utsname()->nodename, 32)) > goto out; > - if (copy_to_user(name + 64, system_utsname.release, 32)) > + if (copy_to_user(name + 64, utsname()->release, 32)) > goto out; > - if (copy_to_user(name + 96, system_utsname.version, 32)) > + if (copy_to_user(name + 96, utsname()->version, 32)) > goto out; > - if (copy_to_user(name + 128, system_utsname.machine, 32)) > + if (copy_to_user(name + 128, utsname()->machine, 32)) > goto out; > > error = 0; > @@ -449,8 +449,8 @@ osf_getdomainname(char __user *name, int > > down_read(&uts_sem); > for (i = 0; i < len; ++i) { > - __put_user(system_utsname.domainname[i], name + i); > - if (system_utsname.domainname[i] == '\0') > + __put_user(utsname()->domainname[i], name + i); > + if (utsname()->domainname[i] == '\0') > break; > } > up_read(&uts_sem); > @@ -608,11 +608,11 @@ asmlinkage long > osf_sysinfo(int command, char __user *buf, long count) > { > static char * sysinfo_table[] = { > - system_utsname.sysname, > - system_utsname.nodename, > - system_utsname.release, > - system_utsname.version, > - system_utsname.machine, > + utsname()->sysname, > + utsname()->nodename, > + utsname()->release, > + utsname()->version, > + utsname()->machine, > "alpha", /* instruction set architecture */ > "dummy", /* hardware serial number */ > "dummy", /* hardware manufacturer */ > diff --git a/arch/i386/kernel/sys_i386.c b/arch/i386/kernel/sys_i386.c > index 8fdb1fb..4af731d 100644 > --- a/arch/i386/kernel/sys_i386.c > +++ b/arch/i386/kernel/sys_i386.c > @@ -210,7 +210,7 @@ asmlinkage int sys_uname(struct old_utsn > if (!name) > return -EFAULT; > down_read(&uts_sem); > - err=copy_to_user(name, &system_utsname, sizeof (*name)); > + err=copy_to_user(name, utsname(), sizeof (*name)); > up_read(&uts_sem); > return err?-EFAULT:0; > } > @@ -226,15 +226,15 @@ asmlinkage int sys_olduname(struct oldol > > down_read(&uts_sem); > > - error = __copy_to_user(&name->sysname,&system_utsname.sysname,__OLD_UTS_LEN); > + error = __copy_to_user(&name->sysname,&utsname()->sysname,__OLD_UTS_LEN); > error |= __put_user(0,name->sysname+__OLD_UTS_LEN); > - error |= __copy_to_user(&name->nodename,&system_utsname.nodename,__OLD_UTS_LEN); > + error |= __copy_to_user(&name->nodename,&utsname()->nodename,__OLD_UTS_LEN); > error |= __put_user(0,name->nodename+__OLD_UTS_LEN); > - error |= __copy_to_user(&name->release,&system_utsname.release,__OLD_UTS_LEN); > + error |= __copy_to_user(&name->release,&utsname()->release,__OLD_UTS_LEN); > error |= __put_user(0,name->release+__OLD_UTS_LEN); > - error |= __copy_to_user(&name->version,&system_utsname.version,__OLD_UTS_LEN); > + error |= __copy_to_user(&name->version,&utsname()->version,__OLD_UTS_LEN); > error |= __put_user(0,name->version+__OLD_UTS_LEN); > - error |= __copy_to_user(&name->machine,&system_utsname.machine,__OLD_UTS_LEN); > + error |= __copy_to_user(&name->machine,&utsname()->machine,__OLD_UTS_LEN); > error |= __put_user(0,name->machine+__OLD_UTS_LEN); > > up_read(&uts_sem); > diff --git a/arch/ia64/sn/kernel/sn2/sn_hwperf.c b/arch/ia64/sn/kernel/sn2/sn_hwperf.c > index d917afa..a0632a9 100644 > --- a/arch/ia64/sn/kernel/sn2/sn_hwperf.c > +++ b/arch/ia64/sn/kernel/sn2/sn_hwperf.c > @@ -420,7 +420,7 @@ static int sn_topology_show(struct seq_f > "coherency_domain %d, " > "region_size %d\n", > > - partid, system_utsname.nodename, > + partid, utsname()->nodename, > shubtype ? "shub2" : "shub1", > (u64)nasid_mask << nasid_shift, nasid_msb, nasid_shift, > system_size, sharing_size, coher, region_size); > diff --git a/arch/m32r/kernel/sys_m32r.c b/arch/m32r/kernel/sys_m32r.c > index 670cb49..11412c0 100644 > --- a/arch/m32r/kernel/sys_m32r.c > +++ b/arch/m32r/kernel/sys_m32r.c > @@ -206,7 +206,7 @@ asmlinkage int sys_uname(struct old_utsn > if (!name) > return -EFAULT; > down_read(&uts_sem); > - err=copy_to_user(name, &system_utsname, sizeof (*name)); > + err=copy_to_user(name, utsname(), sizeof (*name)); > up_read(&uts_sem); > return err?-EFAULT:0; > } > diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c > index 3f40c37..b9b702f 100644 > --- a/arch/mips/kernel/linux32.c > +++ b/arch/mips/kernel/linux32.c > @@ -1100,7 +1100,7 @@ asmlinkage long sys32_newuname(struct ne > int ret = 0; > > down_read(&uts_sem); > - if (copy_to_user(name,&system_utsname,sizeof *name)) > + if (copy_to_user(name,utsname(),sizeof *name)) > ret = -EFAULT; > up_read(&uts_sem); > > diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c > index 2aeaa2f..8b13d57 100644 > --- a/arch/mips/kernel/syscall.c > +++ b/arch/mips/kernel/syscall.c > @@ -232,7 +232,7 @@ out: > */ > asmlinkage int sys_uname(struct old_utsname __user * name) > { > - if (name && !copy_to_user(name, &system_utsname, sizeof (*name))) > + if (name && !copy_to_user(name, utsname(), sizeof (*name))) > return 0; > return -EFAULT; > } > @@ -249,15 +249,15 @@ asmlinkage int sys_olduname(struct oldol > if (!access_ok(VERIFY_WRITE,name,sizeof(struct oldold_utsname))) > return -EFAULT; > > - error = __copy_to_user(&name->sysname,&system_utsname.sysname,__OLD_UTS_LEN); > + error = __copy_to_user(&name->sysname,&utsname()->sysname,__OLD_UTS_LEN); > error -= __put_user(0,name->sysname+__OLD_UTS_LEN); > - error -= __copy_to_user(&name->nodename,&system_utsname.nodename,__OLD_UTS_LEN); > + error -= __copy_to_user(&name->nodename,&utsname()->nodename,__OLD_UTS_LEN); > error -= __put_user(0,name->nodename+__OLD_UTS_LEN); > - error -= __copy_to_user(&name->release,&system_utsname.release,__OLD_UTS_LEN); > + error -= __copy_to_user(&name->release,&utsname()->release,__OLD_UTS_LEN); > error -= __put_user(0,name->release+__OLD_UTS_LEN); > - error -= __copy_to_user(&name->version,&system_utsname.version,__OLD_UTS_LEN); > + error -= __copy_to_user(&name->version,&utsname()->version,__OLD_UTS_LEN); > error -= __put_user(0,name->version+__OLD_UTS_LEN); > - error -= __copy_to_user(&name->machine,&system_utsname.machine,__OLD_UTS_LEN); > + error -= __copy_to_user(&name->machine,&utsname()->machine,__OLD_UTS_LEN); > error = __put_user(0,name->machine+__OLD_UTS_LEN); > error = error ? -EFAULT : 0; > > @@ -293,10 +293,10 @@ asmlinkage int _sys_sysmips(int cmd, lon > return -EFAULT; > > down_write(&uts_sem); > - strncpy(system_utsname.nodename, nodename, len); > + strncpy(utsname()->nodename, nodename, len); > nodename[__NEW_UTS_LEN] = '\0'; > - strlcpy(system_utsname.nodename, nodename, > - sizeof(system_utsname.nodename)); > + strlcpy(utsname()->nodename, nodename, > + sizeof(utsname()->nodename)); > up_write(&uts_sem); > return 0; > } > diff --git a/arch/mips/kernel/sysirix.c b/arch/mips/kernel/sysirix.c > index 5407b78..1b4e7e7 100644 > --- a/arch/mips/kernel/sysirix.c > +++ b/arch/mips/kernel/sysirix.c > @@ -884,7 +884,7 @@ asmlinkage int irix_getdomainname(char _ > down_read(&uts_sem); > if (len > __NEW_UTS_LEN) > len = __NEW_UTS_LEN; > - err = copy_to_user(name, system_utsname.domainname, len) ? -EFAULT : 0; > + err = copy_to_user(name, utsname()->domainname, len) ? -EFAULT : 0; > up_read(&uts_sem); > > return err; > @@ -1127,11 +1127,11 @@ struct iuname { > asmlinkage int irix_uname(struct iuname __user *buf) > { > down_read(&uts_sem); > - if (copy_from_user(system_utsname.sysname, buf->sysname, 65) > - || copy_from_user(system_utsname.nodename, buf->nodename, 65) > - || copy_from_user(system_utsname.release, buf->release, 65) > - || copy_from_user(system_utsname.version, buf->version, 65) > - || copy_from_user(system_utsname.machine, buf->machine, 65)) { > + if (copy_from_user(utsname()->sysname, buf->sysname, 65) > + || copy_from_user(utsname()->nodename, buf->nodename, 65) > + || copy_from_user(utsname()->release, buf->release, 65) > + || copy_from_user(utsname()->version, buf->version, 65) > + || copy_from_user(utsname()->machine, buf->machine, 65)) { > return -EFAULT; > } > up_read(&uts_sem); > diff --git a/arch/parisc/hpux/sys_hpux.c b/arch/parisc/hpux/sys_hpux.c > index 05273cc..9fc2c08 100644 > --- a/arch/parisc/hpux/sys_hpux.c > +++ b/arch/parisc/hpux/sys_hpux.c > @@ -266,15 +266,15 @@ static int hpux_uname(struct hpux_utsnam > > down_read(&uts_sem); > > - error = __copy_to_user(&name->sysname,&system_utsname.sysname,HPUX_UTSLEN-1); > + error = __copy_to_user(&name->sysname,&utsname()->sysname,HPUX_UTSLEN-1); > error |= __put_user(0,name->sysname+HPUX_UTSLEN-1); > - error |= __copy_to_user(&name->nodename,&system_utsname.nodename,HPUX_UTSLEN-1); > + error |= __copy_to_user(&name->nodename,&utsname()->nodename,HPUX_UTSLEN-1); > error |= __put_user(0,name->nodename+HPUX_UTSLEN-1); > - error |= __copy_to_user(&name->release,&system_utsname.release,HPUX_UTSLEN-1); > + error |= __copy_to_user(&name->release,&utsname()->release,HPUX_UTSLEN-1); > error |= __put_user(0,name->release+HPUX_UTSLEN-1); > - error |= __copy_to_user(&name->version,&system_utsname.version,HPUX_UTSLEN-1); > + error |= __copy_to_user(&name->version,&utsname()->version,HPUX_UTSLEN-1); > error |= __put_user(0,name->version+HPUX_UTSLEN-1); > - error |= __copy_to_user(&name->machine,&system_utsname.machine,HPUX_UTSLEN-1); > + error |= __copy_to_user(&name->machine,&utsname()->machine,HPUX_UTSLEN-1); > error |= __put_user(0,name->machine+HPUX_UTSLEN-1); > > up_read(&uts_sem); > @@ -373,8 +373,8 @@ int hpux_utssys(char *ubuf, int n, int t > /* TODO: print a warning about using this? */ > down_write(&uts_sem); > error = -EFAULT; > - if (!copy_from_user(system_utsname.sysname, ubuf, len)) { > - system_utsname.sysname[len] = 0; > + if (!copy_from_user(utsname()->sysname, ubuf, len)) { > + utsname()->sysname[len] = 0; > error = 0; > } > up_write(&uts_sem); > @@ -400,8 +400,8 @@ int hpux_utssys(char *ubuf, int n, int t > /* TODO: print a warning about this? */ > down_write(&uts_sem); > error = -EFAULT; > - if (!copy_from_user(system_utsname.release, ubuf, len)) { > - system_utsname.release[len] = 0; > + if (!copy_from_user(utsname()->release, ubuf, len)) { > + utsname()->release[len] = 0; > error = 0; > } > up_write(&uts_sem); > @@ -422,13 +422,13 @@ int hpux_getdomainname(char *name, int l > > down_read(&uts_sem); > > - nlen = strlen(system_utsname.domainname) + 1; > + nlen = strlen(utsname()->domainname) + 1; > > if (nlen < len) > len = nlen; > if(len > __NEW_UTS_LEN) > goto done; > - if(copy_to_user(name, system_utsname.domainname, len)) > + if(copy_to_user(name, utsname()->domainname, len)) > goto done; > err = 0; > done: > diff --git a/arch/powerpc/kernel/syscalls.c b/arch/powerpc/kernel/syscalls.c > index 9b69d99..d358866 100644 > --- a/arch/powerpc/kernel/syscalls.c > +++ b/arch/powerpc/kernel/syscalls.c > @@ -260,7 +260,7 @@ long ppc_newuname(struct new_utsname __u > int err = 0; > > down_read(&uts_sem); > - if (copy_to_user(name, &system_utsname, sizeof(*name))) > + if (copy_to_user(name, utsname(), sizeof(*name))) > err = -EFAULT; > up_read(&uts_sem); > if (!err) > @@ -273,7 +273,7 @@ int sys_uname(struct old_utsname __user > int err = 0; > > down_read(&uts_sem); > - if (copy_to_user(name, &system_utsname, sizeof(*name))) > + if (copy_to_user(name, utsname(), sizeof(*name))) > err = -EFAULT; > up_read(&uts_sem); > if (!err) > @@ -289,19 +289,19 @@ int sys_olduname(struct oldold_utsname _ > return -EFAULT; > > down_read(&uts_sem); > - error = __copy_to_user(&name->sysname, &system_utsname.sysname, > + error = __copy_to_user(&name->sysname, &utsname()->sysname, > __OLD_UTS_LEN); > error |= __put_user(0, name->sysname + __OLD_UTS_LEN); > - error |= __copy_to_user(&name->nodename, &system_utsname.nodename, > + error |= __copy_to_user(&name->nodename, &utsname()->nodename, > __OLD_UTS_LEN); > error |= __put_user(0, name->nodename + __OLD_UTS_LEN); > - error |= __copy_to_user(&name->release, &system_utsname.release, > + error |= __copy_to_user(&name->release, &utsname()->release, > __OLD_UTS_LEN); > error |= __put_user(0, name->release + __OLD_UTS_LEN); > - error |= __copy_to_user(&name->version, &system_utsname.version, > + error |= __copy_to_user(&name->version, &utsname()->version, > __OLD_UTS_LEN); > error |= __put_user(0, name->version + __OLD_UTS_LEN); > - error |= __copy_to_user(&name->machine, &system_utsname.machine, > + error |= __copy_to_user(&name->machine, &utsname()->machine, > __OLD_UTS_LEN); > error |= override_machine(name->machine); > up_read(&uts_sem); > diff --git a/arch/sh/kernel/sys_sh.c b/arch/sh/kernel/sys_sh.c > index 917b2f3..e4966b2 100644 > --- a/arch/sh/kernel/sys_sh.c > +++ b/arch/sh/kernel/sys_sh.c > @@ -267,7 +267,7 @@ asmlinkage int sys_uname(struct old_utsn > if (!name) > return -EFAULT; > down_read(&uts_sem); > - err=copy_to_user(name, &system_utsname, sizeof (*name)); > + err=copy_to_user(name, utsname(), sizeof (*name)); > up_read(&uts_sem); > return err?-EFAULT:0; > } > diff --git a/arch/sh64/kernel/sys_sh64.c b/arch/sh64/kernel/sys_sh64.c > index 58ff7d5..a8dc88c 100644 > --- a/arch/sh64/kernel/sys_sh64.c > +++ b/arch/sh64/kernel/sys_sh64.c > @@ -279,7 +279,7 @@ asmlinkage int sys_uname(struct old_utsn > if (!name) > return -EFAULT; > down_read(&uts_sem); > - err=copy_to_user(name, &system_utsname, sizeof (*name)); > + err=copy_to_user(name, utsname(), sizeof (*name)); > up_read(&uts_sem); > return err?-EFAULT:0; > } > diff --git a/arch/sparc/kernel/sys_sparc.c b/arch/sparc/kernel/sys_sparc.c > index 0cdfc9d..c8ad73c 100644 > --- a/arch/sparc/kernel/sys_sparc.c > +++ b/arch/sparc/kernel/sys_sparc.c > @@ -470,13 +470,13 @@ asmlinkage int sys_getdomainname(char __ > > down_read(&uts_sem); > > - nlen = strlen(system_utsname.domainname) + 1; > + nlen = strlen(utsname()->domainname) + 1; > > if (nlen < len) > len = nlen; > if (len > __NEW_UTS_LEN) > goto done; > - if (copy_to_user(name, system_utsname.domainname, len)) > + if (copy_to_user(name, utsname()->domainname, len)) > goto done; > err = 0; > done: > diff --git a/arch/sparc/kernel/sys_sunos.c b/arch/sparc/kernel/sys_sunos.c > index 288de27..9f9206f 100644 > --- a/arch/sparc/kernel/sys_sunos.c > +++ b/arch/sparc/kernel/sys_sunos.c > @@ -483,13 +483,13 @@ asmlinkage int sunos_uname(struct sunos_ > { > int ret; > down_read(&uts_sem); > - ret = copy_to_user(&name->sname[0], &system_utsname.sysname[0], sizeof(name->sname) - 1); > + ret = copy_to_user(&name->sname[0], &utsname()->sysname[0], sizeof(name->sname) - 1); > if (!ret) { > - ret |= __copy_to_user(&name->nname[0], &system_utsname.nodename[0], sizeof(name->nname) - 1); > + ret |= __copy_to_user(&name->nname[0], &utsname()->nodename[0], sizeof(name->nname) - 1); > ret |= __put_user('\0', &name->nname[8]); > - ret |= __copy_to_user(&name->rel[0], &system_utsname.release[0], sizeof(name->rel) - 1); > - ret |= __copy_to_user(&name->ver[0], &system_utsname.version[0], sizeof(name->ver) - 1); > - ret |= __copy_to_user(&name->mach[0], &system_utsname.machine[0], sizeof(name->mach) - 1); > + ret |= __copy_to_user(&name->rel[0], &utsname()->release[0], sizeof(name->rel) - 1); > + ret |= __copy_to_user(&name->ver[0], &utsname()->version[0], sizeof(name->ver) - 1); > + ret |= __copy_to_user(&name->mach[0], &utsname()->machine[0], sizeof(name->mach) - 1); > } > up_read(&uts_sem); > return ret ? -EFAULT : 0; > diff --git a/arch/sparc64/kernel/sys_sparc.c b/arch/sparc64/kernel/sys_sparc.c > index 7a86913..0453bd2 100644 > --- a/arch/sparc64/kernel/sys_sparc.c > +++ b/arch/sparc64/kernel/sys_sparc.c > @@ -707,13 +707,13 @@ asmlinkage long sys_getdomainname(char _ > > down_read(&uts_sem); > > - nlen = strlen(system_utsname.domainname) + 1; > + nlen = strlen(utsname()->domainname) + 1; > > if (nlen < len) > len = nlen; > if (len > __NEW_UTS_LEN) > goto done; > - if (copy_to_user(name, system_utsname.domainname, len)) > + if (copy_to_user(name, utsname()->domainname, len)) > goto done; > err = 0; > done: > diff --git a/arch/sparc64/kernel/sys_sunos32.c b/arch/sparc64/kernel/sys_sunos32.c > index ae5b32f..ba98c47 100644 > --- a/arch/sparc64/kernel/sys_sunos32.c > +++ b/arch/sparc64/kernel/sys_sunos32.c > @@ -439,16 +439,16 @@ asmlinkage int sunos_uname(struct sunos_ > int ret; > > down_read(&uts_sem); > - ret = copy_to_user(&name->sname[0], &system_utsname.sysname[0], > + ret = copy_to_user(&name->sname[0], &utsname()->sysname[0], > sizeof(name->sname) - 1); > - ret |= copy_to_user(&name->nname[0], &system_utsname.nodename[0], > + ret |= copy_to_user(&name->nname[0], &utsname()->nodename[0], > sizeof(name->nname) - 1); > ret |= put_user('\0', &name->nname[8]); > - ret |= copy_to_user(&name->rel[0], &system_utsname.release[0], > + ret |= copy_to_user(&name->rel[0], &utsname()->release[0], > sizeof(name->rel) - 1); > - ret |= copy_to_user(&name->ver[0], &system_utsname.version[0], > + ret |= copy_to_user(&name->ver[0], &utsname()->version[0], > sizeof(name->ver) - 1); > - ret |= copy_to_user(&name->mach[0], &system_utsname.machine[0], > + ret |= copy_to_user(&name->mach[0], &utsname()->machine[0], > sizeof(name->mach) - 1); > up_read(&uts_sem); > return (ret ? -EFAULT : 0); > diff --git a/arch/sparc64/solaris/misc.c b/arch/sparc64/solaris/misc.c > index 5284996..5d0162a 100644 > --- a/arch/sparc64/solaris/misc.c > +++ b/arch/sparc64/solaris/misc.c > @@ -239,7 +239,7 @@ asmlinkage int solaris_utssys(u32 buf, u > /* Let's cheat */ > err = set_utsfield(v->sysname, "SunOS", 1, 0); > down_read(&uts_sem); > - err |= set_utsfield(v->nodename, system_utsname.nodename, > + err |= set_utsfield(v->nodename, utsname()->nodename, > 1, 1); > up_read(&uts_sem); > err |= set_utsfield(v->release, "2.6", 0, 0); > @@ -263,7 +263,7 @@ asmlinkage int solaris_utsname(u32 buf) > /* Why should we not lie a bit? */ > down_read(&uts_sem); > err = set_utsfield(v->sysname, "SunOS", 0, 0); > - err |= set_utsfield(v->nodename, system_utsname.nodename, 1, 1); > + err |= set_utsfield(v->nodename, utsname()->nodename, 1, 1); > err |= set_utsfield(v->release, "5.6", 0, 0); > err |= set_utsfield(v->version, "Generic", 0, 0); > err |= set_utsfield(v->machine, machine(), 0, 0); > @@ -295,7 +295,7 @@ asmlinkage int solaris_sysinfo(int cmd, > case SI_HOSTNAME: > r = buffer + 256; > down_read(&uts_sem); > - for (p = system_utsname.nodename, q = buffer; > + for (p = utsname()->nodename, q = buffer; > q < r && *p && *p != '.'; *q++ = *p++); > up_read(&uts_sem); > *q = 0; > diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c > index 28e3760..5f87323 100644 > --- a/arch/um/drivers/mconsole_kern.c > +++ b/arch/um/drivers/mconsole_kern.c > @@ -106,9 +106,9 @@ void mconsole_version(struct mc_request > { > char version[256]; > > - sprintf(version, "%s %s %s %s %s", system_utsname.sysname, > - system_utsname.nodename, system_utsname.release, > - system_utsname.version, system_utsname.machine); > + sprintf(version, "%s %s %s %s %s", utsname()->sysname, > + utsname()->nodename, utsname()->release, > + utsname()->version, utsname()->machine); > mconsole_reply(req, version, 0, 0); > } > > diff --git a/arch/um/kernel/syscall_kern.c b/arch/um/kernel/syscall_kern.c > index 37d3978..d90e9ed 100644 > --- a/arch/um/kernel/syscall_kern.c > +++ b/arch/um/kernel/syscall_kern.c > @@ -110,7 +110,7 @@ long sys_uname(struct old_utsname __user > if (!name) > return -EFAULT; > down_read(&uts_sem); > - err=copy_to_user(name, &system_utsname, sizeof (*name)); > + err=copy_to_user(name, utsname(), sizeof (*name)); > up_read(&uts_sem); > return err?-EFAULT:0; > } > @@ -126,19 +126,19 @@ long sys_olduname(struct oldold_utsname > > down_read(&uts_sem); > > - error = __copy_to_user(&name->sysname,&system_utsname.sysname, > + error = __copy_to_user(&name->sysname,&utsname()->sysname, > __OLD_UTS_LEN); > error |= __put_user(0,name->sysname+__OLD_UTS_LEN); > - error |= __copy_to_user(&name->nodename,&system_utsname.nodename, > + error |= __copy_to_user(&name->nodename,&utsname()->nodename, > __OLD_UTS_LEN); > error |= __put_user(0,name->nodename+__OLD_UTS_LEN); > - error |= __copy_to_user(&name->release,&system_utsname.release, > + error |= __copy_to_user(&name->release,&utsname()->release, > __OLD_UTS_LEN); > error |= __put_user(0,name->release+__OLD_UTS_LEN); > - error |= __copy_to_user(&name->version,&system_utsname.version, > + error |= __copy_to_user(&name->version,&utsname()->version, > __OLD_UTS_LEN); > error |= __put_user(0,name->version+__OLD_UTS_LEN); > - error |= __copy_to_user(&name->machine,&system_utsname.machine, > + error |= __copy_to_user(&name->machine,&utsname()->machine, > __OLD_UTS_LEN); > error |= __put_user(0,name->machine+__OLD_UTS_LEN); > > diff --git a/arch/um/sys-x86_64/syscalls.c b/arch/um/sys-x86_64/syscalls.c > index 6acee5c..3ad014e 100644 > --- a/arch/um/sys-x86_64/syscalls.c > +++ b/arch/um/sys-x86_64/syscalls.c > @@ -21,7 +21,7 @@ asmlinkage long sys_uname64(struct new_u > { > int err; > down_read(&uts_sem); > - err = copy_to_user(name, &system_utsname, sizeof (*name)); > + err = copy_to_user(name, utsname(), sizeof (*name)); > up_read(&uts_sem); > if (personality(current->personality) == PER_LINUX32) > err |= copy_to_user(&name->machine, "i686", 5); > diff --git a/arch/x86_64/ia32/sys_ia32.c b/arch/x86_64/ia32/sys_ia32.c > index f182b20..6e0a19d 100644 > --- a/arch/x86_64/ia32/sys_ia32.c > +++ b/arch/x86_64/ia32/sys_ia32.c > @@ -801,13 +801,13 @@ asmlinkage long sys32_olduname(struct ol > > down_read(&uts_sem); > > - error = __copy_to_user(&name->sysname,&system_utsname.sysname,__OLD_UTS_LEN); > + error = __copy_to_user(&name->sysname,&utsname()->sysname,__OLD_UTS_LEN); > __put_user(0,name->sysname+__OLD_UTS_LEN); > - __copy_to_user(&name->nodename,&system_utsname.nodename,__OLD_UTS_LEN); > + __copy_to_user(&name->nodename,&utsname()->nodename,__OLD_UTS_LEN); > __put_user(0,name->nodename+__OLD_UTS_LEN); > - __copy_to_user(&name->release,&system_utsname.release,__OLD_UTS_LEN); > + __copy_to_user(&name->release,&utsname()->release,__OLD_UTS_LEN); > __put_user(0,name->release+__OLD_UTS_LEN); > - __copy_to_user(&name->version,&system_utsname.version,__OLD_UTS_LEN); > + __copy_to_user(&name->version,&utsname()->version,__OLD_UTS_LEN); > __put_user(0,name->version+__OLD_UTS_LEN); > { > char *arch = "x86_64"; > @@ -830,7 +830,7 @@ long sys32_uname(struct old_utsname __us > if (!name) > return -EFAULT; > down_read(&uts_sem); > - err=copy_to_user(name, &system_utsname, sizeof (*name)); > + err=copy_to_user(name, utsname(), sizeof (*name)); > up_read(&uts_sem); > if (personality(current->personality) == PER_LINUX32) > err |= copy_to_user(&name->machine, "i686", 5); > diff --git a/arch/x86_64/kernel/sys_x86_64.c b/arch/x86_64/kernel/sys_x86_64.c > index 6449ea8..76bf7c2 100644 > --- a/arch/x86_64/kernel/sys_x86_64.c > +++ b/arch/x86_64/kernel/sys_x86_64.c > @@ -148,7 +148,7 @@ asmlinkage long sys_uname(struct new_uts > { > int err; > down_read(&uts_sem); > - err = copy_to_user(name, &system_utsname, sizeof (*name)); > + err = copy_to_user(name, utsname(), sizeof (*name)); > up_read(&uts_sem); > if (personality(current->personality) == PER_LINUX32) > err |= copy_to_user(&name->machine, "i686", 5); > diff --git a/arch/xtensa/kernel/syscalls.c b/arch/xtensa/kernel/syscalls.c > index f20c649..30060c1 100644 > --- a/arch/xtensa/kernel/syscalls.c > +++ b/arch/xtensa/kernel/syscalls.c > @@ -129,7 +129,7 @@ out: > > int sys_uname(struct old_utsname * name) > { > - if (name && !copy_to_user(name, &system_utsname, sizeof (*name))) > + if (name && !copy_to_user(name, utsname(), sizeof (*name))) > return 0; > return -EFAULT; > } > diff --git a/drivers/char/random.c b/drivers/char/random.c > index 86be04b..ec4c11d 100644 > --- a/drivers/char/random.c > +++ b/drivers/char/random.c > @@ -888,8 +888,8 @@ static void init_std_data(struct entropy > > do_gettimeofday(&tv); > add_entropy_words(r, (__u32 *)&tv, sizeof(tv)/4); > - add_entropy_words(r, (__u32 *)&system_utsname, > - sizeof(system_utsname)/4); > + add_entropy_words(r, (__u32 *)utsname(), > + sizeof(*(utsname()))/4); > } > > static int __init rand_initialize(void) > diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c > index 0b86d5c..852ff41 100644 > --- a/fs/cifs/connect.c > +++ b/fs/cifs/connect.c > @@ -765,12 +765,12 @@ cifs_parse_mount_options(char *options, > separator[1] = 0; > > memset(vol->source_rfc1001_name,0x20,15); > - for(i=0;i < strnlen(system_utsname.nodename,15);i++) { > + for(i=0;i < strnlen(utsname()->nodename,15);i++) { > /* does not have to be a perfect mapping since the field is > informational, only used for servers that do not support > port 445 and it can be overridden at mount time */ > vol->source_rfc1001_name[i] = > - toupper(system_utsname.nodename[i]); > + toupper(utsname()->nodename[i]); > } > vol->source_rfc1001_name[15] = 0; > /* null target name indicates to use *SMBSERVR default called name > @@ -2077,7 +2077,7 @@ CIFSSessSetup(unsigned int xid, struct c > 32, nls_codepage); > bcc_ptr += 2 * bytes_returned; > bytes_returned = > - cifs_strtoUCS((__le16 *) bcc_ptr, system_utsname.release, > + cifs_strtoUCS((__le16 *) bcc_ptr, utsname()->release, > 32, nls_codepage); > bcc_ptr += 2 * bytes_returned; > bcc_ptr += 2; > @@ -2104,8 +2104,8 @@ CIFSSessSetup(unsigned int xid, struct c > } > strcpy(bcc_ptr, "Linux version "); > bcc_ptr += strlen("Linux version "); > - strcpy(bcc_ptr, system_utsname.release); > - bcc_ptr += strlen(system_utsname.release) + 1; > + strcpy(bcc_ptr, utsname()->release); > + bcc_ptr += strlen(utsname()->release) + 1; > strcpy(bcc_ptr, CIFS_NETWORK_OPSYS); > bcc_ptr += strlen(CIFS_NETWORK_OPSYS) + 1; > } > @@ -2346,7 +2346,7 @@ CIFSSpnegoSessSetup(unsigned int xid, st > 32, nls_codepage); > bcc_ptr += 2 * bytes_returned; > bytes_returned = > - cifs_strtoUCS((__le16 *) bcc_ptr, system_utsname.release, 32, > + cifs_strtoUCS((__le16 *) bcc_ptr, utsname()->release, 32, > nls_codepage); > bcc_ptr += 2 * bytes_returned; > bcc_ptr += 2; > @@ -2371,8 +2371,8 @@ CIFSSpnegoSessSetup(unsigned int xid, st > } > strcpy(bcc_ptr, "Linux version "); > bcc_ptr += strlen("Linux version "); > - strcpy(bcc_ptr, system_utsname.release); > - bcc_ptr += strlen(system_utsname.release) + 1; > + strcpy(bcc_ptr, utsname()->release); > + bcc_ptr += strlen(utsname()->release) + 1; > strcpy(bcc_ptr, CIFS_NETWORK_OPSYS); > bcc_ptr += strlen(CIFS_NETWORK_OPSYS) + 1; > } > @@ -2622,7 +2622,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned i > 32, nls_codepage); > bcc_ptr += 2 * bytes_returned; > bytes_returned = > - cifs_strtoUCS((__le16 *) bcc_ptr, system_utsname.release, 32, > + cifs_strtoUCS((__le16 *) bcc_ptr, utsname()->release, 32, > nls_codepage); > bcc_ptr += 2 * bytes_returned; > bcc_ptr += 2; /* null terminate Linux version */ > @@ -2639,8 +2639,8 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned i > } else { /* ASCII */ > strcpy(bcc_ptr, "Linux version "); > bcc_ptr += strlen("Linux version "); > - strcpy(bcc_ptr, system_utsname.release); > - bcc_ptr += strlen(system_utsname.release) + 1; > + strcpy(bcc_ptr, utsname()->release); > + bcc_ptr += strlen(utsname()->release) + 1; > strcpy(bcc_ptr, CIFS_NETWORK_OPSYS); > bcc_ptr += strlen(CIFS_NETWORK_OPSYS) + 1; > bcc_ptr++; /* empty domain field */ > @@ -3001,7 +3001,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xi > 32, nls_codepage); > bcc_ptr += 2 * bytes_returned; > bytes_returned = > - cifs_strtoUCS((__le16 *) bcc_ptr, system_utsname.release, 32, > + cifs_strtoUCS((__le16 *) bcc_ptr, utsname()->release, 32, > nls_codepage); > bcc_ptr += 2 * bytes_returned; > bcc_ptr += 2; /* null term version string */ > @@ -3053,8 +3053,8 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xi > > strcpy(bcc_ptr, "Linux version "); > bcc_ptr += strlen("Linux version "); > - strcpy(bcc_ptr, system_utsname.release); > - bcc_ptr += strlen(system_utsname.release) + 1; > + strcpy(bcc_ptr, utsname()->release); > + bcc_ptr += strlen(utsname()->release) + 1; > strcpy(bcc_ptr, CIFS_NETWORK_OPSYS); > bcc_ptr += strlen(CIFS_NETWORK_OPSYS) + 1; > bcc_ptr++; /* null domain */ > diff --git a/fs/exec.c b/fs/exec.c > index 0291a68..d881479 100644 > --- a/fs/exec.c > +++ b/fs/exec.c > @@ -1347,7 +1347,7 @@ static void format_corename(char *corena > case 'h': > down_read(&uts_sem); > rc = snprintf(out_ptr, out_end - out_ptr, > - "%s", system_utsname.nodename); > + "%s", utsname()->nodename); > up_read(&uts_sem); > if (rc > out_end - out_ptr) > goto out; > diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c > index f96e381..915e596 100644 > --- a/fs/lockd/clntproc.c > +++ b/fs/lockd/clntproc.c > @@ -130,11 +130,11 @@ static void nlmclnt_setlockargs(struct n > nlmclnt_next_cookie(&argp->cookie); > argp->state = nsm_local_state; > memcpy(&lock->fh, NFS_FH(fl->fl_file->f_dentry->d_inode), sizeof(struct nfs_fh)); > - lock->caller = system_utsname.nodename; > + lock->caller = utsname()->nodename; > lock->oh.data = req->a_owner; > lock->oh.len = snprintf(req->a_owner, sizeof(req->a_owner), "%u@%s", > (unsigned int)fl->fl_u.nfs_fl.owner->pid, > - system_utsname.nodename); > + utsname()->nodename); > lock->svid = fl->fl_u.nfs_fl.owner->pid; > lock->fl.fl_start = fl->fl_start; > lock->fl.fl_end = fl->fl_end; > diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c > index 3fc683f..547aaa3 100644 > --- a/fs/lockd/mon.c > +++ b/fs/lockd/mon.c > @@ -152,7 +152,7 @@ xdr_encode_common(struct rpc_rqst *rqstp > */ > sprintf(buffer, "%u.%u.%u.%u", NIPQUAD(argp->addr)); > if (!(p = xdr_encode_string(p, buffer)) > - || !(p = xdr_encode_string(p, system_utsname.nodename))) > + || !(p = xdr_encode_string(p, utsname()->nodename))) > return ERR_PTR(-EIO); > *p++ = htonl(argp->prog); > *p++ = htonl(argp->vers); > diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c > index d2b66ba..61b4791 100644 > --- a/fs/lockd/svclock.c > +++ b/fs/lockd/svclock.c > @@ -326,7 +326,7 @@ static int nlmsvc_setgrantargs(struct nl > { > locks_copy_lock(&call->a_args.lock.fl, &lock->fl); > memcpy(&call->a_args.lock.fh, &lock->fh, sizeof(call->a_args.lock.fh)); > - call->a_args.lock.caller = system_utsname.nodename; > + call->a_args.lock.caller = utsname()->nodename; > call->a_args.lock.oh.len = lock->oh.len; > > /* set default data area */ > diff --git a/fs/lockd/xdr.c b/fs/lockd/xdr.c > index f22a376..4eec051 100644 > --- a/fs/lockd/xdr.c > +++ b/fs/lockd/xdr.c > @@ -516,7 +516,7 @@ nlmclt_decode_res(struct rpc_rqst *req, > */ > #define NLM_void_sz 0 > #define NLM_cookie_sz 1+XDR_QUADLEN(NLM_MAXCOOKIELEN) > -#define NLM_caller_sz 1+XDR_QUADLEN(sizeof(system_utsname.nodename)) > +#define NLM_caller_sz 1+XDR_QUADLEN(sizeof(utsname()->nodename)) > #define NLM_netobj_sz 1+XDR_QUADLEN(XDR_MAX_NETOBJ) > /* #define NLM_owner_sz 1+XDR_QUADLEN(NLM_MAXOWNER) */ > #define NLM_fhandle_sz 1+XDR_QUADLEN(NFS2_FHSIZE) > diff --git a/fs/nfs/nfsroot.c b/fs/nfs/nfsroot.c > index c0a754e..1d656a6 100644 > --- a/fs/nfs/nfsroot.c > +++ b/fs/nfs/nfsroot.c > @@ -312,7 +312,7 @@ static int __init root_nfs_name(char *na > /* Override them by options set on kernel command-line */ > root_nfs_parse(name, buf); > > - cp = system_utsname.nodename; > + cp = utsname()->nodename; > if (strlen(buf) + strlen(cp) > NFS_MAXPATHLEN) { > printk(KERN_ERR "Root-NFS: Pathname for remote directory too long.\n"); > return -1; > diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h > index 995f89d..ac15b87 100644 > --- a/include/linux/lockd/lockd.h > +++ b/include/linux/lockd/lockd.h > @@ -80,7 +80,7 @@ struct nlm_wait; > /* > * Memory chunk for NLM client RPC request. > */ > -#define NLMCLNT_OHSIZE (sizeof(system_utsname.nodename)+10) > +#define NLMCLNT_OHSIZE (sizeof(utsname()->nodename)+10) > struct nlm_rqst { > unsigned int a_flags; /* initial RPC task flags */ > struct nlm_host * a_host; /* host handle */ > diff --git a/kernel/sys.c b/kernel/sys.c > index 0b6ec0e..bcaa48e 100644 > --- a/kernel/sys.c > +++ b/kernel/sys.c > @@ -1671,7 +1671,7 @@ asmlinkage long sys_newuname(struct new_ > int errno = 0; > > down_read(&uts_sem); > - if (copy_to_user(name,&system_utsname,sizeof *name)) > + if (copy_to_user(name,utsname(),sizeof *name)) > errno = -EFAULT; > up_read(&uts_sem); > return errno; > @@ -1689,8 +1689,8 @@ asmlinkage long sys_sethostname(char __u > down_write(&uts_sem); > errno = -EFAULT; > if (!copy_from_user(tmp, name, len)) { > - memcpy(system_utsname.nodename, tmp, len); > - system_utsname.nodename[len] = 0; > + memcpy(utsname()->nodename, tmp, len); > + utsname()->nodename[len] = 0; > errno = 0; > } > up_write(&uts_sem); > @@ -1706,11 +1706,11 @@ asmlinkage long sys_gethostname(char __u > if (len < 0) > return -EINVAL; > down_read(&uts_sem); > - i = 1 + strlen(system_utsname.nodename); > + i = 1 + strlen(utsname()->nodename); > if (i > len) > i = len; > errno = 0; > - if (copy_to_user(name, system_utsname.nodename, i)) > + if (copy_to_user(name, utsname()->nodename, i)) > errno = -EFAULT; > up_read(&uts_sem); > return errno; > @@ -1735,8 +1735,8 @@ asmlinkage long sys_setdomainname(char _ > down_write(&uts_sem); > errno = -EFAULT; > if (!copy_from_user(tmp, name, len)) { > - memcpy(system_utsname.domainname, tmp, len); > - system_utsname.domainname[len] = 0; > + memcpy(utsname()->domainname, tmp, len); > + utsname()->domainname[len] = 0; > errno = 0; > } > up_write(&uts_sem); ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 2/5] uts namespaces: Switch to using uts namespaces 2006-04-11 12:26 ` Kirill Korotaev @ 2006-04-11 21:04 ` Sam Vilain 2006-04-12 5:01 ` Serge E. Hallyn 0 siblings, 1 reply; 50+ messages in thread From: Sam Vilain @ 2006-04-11 21:04 UTC (permalink / raw) To: Kirill Korotaev Cc: Serge E. Hallyn, linux-kernel, herbert, devel, Eric W. Biederman, xemul, James Morris Kirill Korotaev wrote: >Serge, > >BTW, have you noticed that NFS is using utsname for internal processes >and in general case this makes NFS ns to be coupled with uts ns? > > Either that, or each NFS vfsmount has a uts_ns pointer. Sam. ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 2/5] uts namespaces: Switch to using uts namespaces 2006-04-11 21:04 ` Sam Vilain @ 2006-04-12 5:01 ` Serge E. Hallyn 2006-04-12 6:00 ` Eric W. Biederman 0 siblings, 1 reply; 50+ messages in thread From: Serge E. Hallyn @ 2006-04-12 5:01 UTC (permalink / raw) To: Sam Vilain Cc: Kirill Korotaev, Serge E. Hallyn, linux-kernel, herbert, Eric W. Biederman, xemul, James Morris Quoting Sam Vilain (sam@vilain.net): > Kirill Korotaev wrote: > > >Serge, > > > >BTW, have you noticed that NFS is using utsname for internal processes > >and in general case this makes NFS ns to be coupled with uts ns? > > > > > > Either that, or each NFS vfsmount has a uts_ns pointer. Sorry, I must be being dense. I only see utsname being used in the case of nfsroot. Can you point me to where you're talking about? thanks, -serge ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 2/5] uts namespaces: Switch to using uts namespaces 2006-04-12 5:01 ` Serge E. Hallyn @ 2006-04-12 6:00 ` Eric W. Biederman 2006-04-19 15:00 ` Serge E. Hallyn 0 siblings, 1 reply; 50+ messages in thread From: Eric W. Biederman @ 2006-04-12 6:00 UTC (permalink / raw) To: Serge E. Hallyn Cc: Sam Vilain, Kirill Korotaev, linux-kernel, herbert, xemul, James Morris "Serge E. Hallyn" <serue@us.ibm.com> writes: > Quoting Sam Vilain (sam@vilain.net): >> Kirill Korotaev wrote: >> >> >Serge, >> > >> >BTW, have you noticed that NFS is using utsname for internal processes >> >and in general case this makes NFS ns to be coupled with uts ns? >> > >> > >> >> Either that, or each NFS vfsmount has a uts_ns pointer. > > Sorry, I must be being dense. I only see utsname being used in the case > of nfsroot. Can you point me to where you're talking about? We have the nfs lockd client code, and the sunrpc code. I've been fighting a few a cold and some 2.6.17-rc1 bugs so I haven't had a chance to drill down yet to see what the system_utsname.nodename is actually being used for. Until we actually understand what is happening it is too soon to judge if it is a problem or not. The nfsroot is clearly not a problem. As for the other cases I'm not certain. So skimming through the code quickly. include/linux/lockd/lockd.h > #define NLMCLNT_OHSIZE (sizeof(system_utsname.nodename)+10) fs/lockd/xdr.c > #define NLM_caller_sz 1+XDR_QUADLEN(sizeof(system_utsname.nodename)) The previous two are just sizes, so not interesting for analysis. fs/lockd/clntproc.c > static void nlmclnt_setlockargs(struct nlm_rqst *req, struct file_lock *fl) > { > struct nlm_args *argp = &req->a_args; > struct nlm_lock *lock = &argp->lock; > > nlmclnt_next_cookie(&argp->cookie); > argp->state = nsm_local_state; > memcpy(&lock->fh, NFS_FH(fl->fl_file->f_dentry->d_inode), sizeof(struct nfs_fh)); > lock->caller = system_utsname.nodename; > lock->oh.data = req->a_owner; > lock->oh.len = snprintf(req->a_owner, sizeof(req->a_owner), "%u@%s", > (unsigned int)fl->fl_u.nfs_fl.owner->pid, > system_utsname.nodename); > lock->svid = fl->fl_u.nfs_fl.owner->pid; > lock->fl.fl_start = fl->fl_start; > lock->fl.fl_end = fl->fl_end; > lock->fl.fl_type = fl->fl_type; > } I think this just creates a unique string with nodename+pid fs/lockd/mon.c > xdr_encode_common(struct rpc_rqst *rqstp, u32 *p, struct nsm_args *argp) > { > char buffer[20]; > > /* > * Use the dotted-quad IP address of the remote host as > * identifier. Linux statd always looks up the canonical > * hostname first for whatever remote hostname it receives, > * so this works alright. > */ > sprintf(buffer, "%u.%u.%u.%u", NIPQUAD(argp->addr)); > if (!(p = xdr_encode_string(p, buffer)) > || !(p = xdr_encode_string(p, system_utsname.nodename))) > return ERR_PTR(-EIO); > *p++ = htonl(argp->prog); > *p++ = htonl(argp->vers); > *p++ = htonl(argp->proc); > > return p; > } This looks like it is just general server information fs/lockd/svclock.c > /* > * Initialize arguments for GRANTED call. The nlm_rqst structure > * has been cleared already. > */ > static int nlmsvc_setgrantargs(struct nlm_rqst *call, struct nlm_lock *lock) > { > locks_copy_lock(&call->a_args.lock.fl, &lock->fl); > memcpy(&call->a_args.lock.fh, &lock->fh, sizeof(call->a_args.lock.fh)); > call->a_args.lock.caller = system_utsname.nodename; > call->a_args.lock.oh.len = lock->oh.len; > > /* set default data area */ > call->a_args.lock.oh.data = call->a_owner; > call->a_args.lock.svid = lock->fl.fl_pid; > > if (lock->oh.len > NLMCLNT_OHSIZE) { > void *data = kmalloc(lock->oh.len, GFP_KERNEL); > if (!data) > return 0; > call->a_args.lock.oh.data = (u8 *) data; > } > > memcpy(call->a_args.lock.oh.data, lock->oh.data, lock->oh.len); > return 1; > } I think this is just a uniq identifier again. net/sunrpc/clnt.c > /* > * Create an RPC client > * FIXME: This should also take a flags argument (as in task->tk_flags). > * It's called (among others) from pmap_create_client, which may in > * turn be called by an async task. In this case, rpciod should not be > * made to sleep too long. > */ > struct rpc_clnt * > rpc_new_client(struct rpc_xprt *xprt, char *servname, > struct rpc_program *program, u32 vers, > rpc_authflavor_t flavor) > { > struct rpc_version *version; > struct rpc_clnt *clnt = NULL; > struct rpc_auth *auth; > int err; > int len; > > dprintk("RPC: creating %s client for %s (xprt %p)\n", > program->name, servname, xprt); > > err = -EINVAL; > if (!xprt) > goto out_no_xprt; > if (vers >= program->nrvers || !(version = program->version[vers])) > goto out_err; > > err = -ENOMEM; > clnt = kmalloc(sizeof(*clnt), GFP_KERNEL); > if (!clnt) > goto out_err; > memset(clnt, 0, sizeof(*clnt)); > atomic_set(&clnt->cl_users, 0); > atomic_set(&clnt->cl_count, 1); > clnt->cl_parent = clnt; > > clnt->cl_server = clnt->cl_inline_name; > len = strlen(servname) + 1; > if (len > sizeof(clnt->cl_inline_name)) { > char *buf = kmalloc(len, GFP_KERNEL); > if (buf != 0) > clnt->cl_server = buf; > else > len = sizeof(clnt->cl_inline_name); > } > strlcpy(clnt->cl_server, servname, len); > > clnt->cl_xprt = xprt; > clnt->cl_procinfo = version->procs; > clnt->cl_maxproc = version->nrprocs; > clnt->cl_protname = program->name; > clnt->cl_pmap = &clnt->cl_pmap_default; > clnt->cl_port = xprt->addr.sin_port; > clnt->cl_prog = program->number; > clnt->cl_vers = version->number; > clnt->cl_prot = xprt->prot; > clnt->cl_stats = program->stats; > clnt->cl_metrics = rpc_alloc_iostats(clnt); > rpc_init_wait_queue(&clnt->cl_pmap_default.pm_bindwait, "bindwait"); > > if (!clnt->cl_port) > clnt->cl_autobind = 1; > > clnt->cl_rtt = &clnt->cl_rtt_default; > rpc_init_rtt(&clnt->cl_rtt_default, xprt->timeout.to_initval); > > err = rpc_setup_pipedir(clnt, program->pipe_dir_name); > if (err < 0) > goto out_no_path; > > auth = rpcauth_create(flavor, clnt); > if (IS_ERR(auth)) { > printk(KERN_INFO "RPC: Couldn't create auth handle (flavor %u)\n", > flavor); > err = PTR_ERR(auth); > goto out_no_auth; > } > > /* save the nodename */ > clnt->cl_nodelen = strlen(system_utsname.nodename); > if (clnt->cl_nodelen > UNX_MAXNODENAME) > clnt->cl_nodelen = UNX_MAXNODENAME; > memcpy(clnt->cl_nodename, system_utsname.nodename, clnt->cl_nodelen); > return clnt; > > out_no_auth: > if (!IS_ERR(clnt->cl_dentry)) { > rpc_rmdir(clnt->cl_pathname); > dput(clnt->cl_dentry); > rpc_put_mount(); > } > out_no_path: > if (clnt->cl_server != clnt->cl_inline_name) > kfree(clnt->cl_server); > kfree(clnt); > out_err: > xprt_destroy(xprt); > out_no_xprt: > return ERR_PTR(err); > } This appears to be restricted to cache nodename when an rpc connection is setup. So I think we are ok but we need to be certain. Eric ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 2/5] uts namespaces: Switch to using uts namespaces 2006-04-12 6:00 ` Eric W. Biederman @ 2006-04-19 15:00 ` Serge E. Hallyn 0 siblings, 0 replies; 50+ messages in thread From: Serge E. Hallyn @ 2006-04-19 15:00 UTC (permalink / raw) To: Eric W. Biederman Cc: Serge E. Hallyn, Sam Vilain, Kirill Korotaev, linux-kernel, herbert, xemul, James Morris Quoting Eric W. Biederman (ebiederm@xmission.com): > "Serge E. Hallyn" <serue@us.ibm.com> writes: > > > Quoting Sam Vilain (sam@vilain.net): > >> Kirill Korotaev wrote: > >> > >> >Serge, > >> > > >> >BTW, have you noticed that NFS is using utsname for internal processes > >> >and in general case this makes NFS ns to be coupled with uts ns? > >> > > >> > > >> > >> Either that, or each NFS vfsmount has a uts_ns pointer. > > > > Sorry, I must be being dense. I only see utsname being used in the case > > of nfsroot. Can you point me to where you're talking about? > > We have the nfs lockd client code, and the sunrpc code. > > I've been fighting a few a cold and some 2.6.17-rc1 bugs > so I haven't had a chance to drill down yet to see what > the system_utsname.nodename is actually being used for. > > Until we actually understand what is happening it is too soon to > judge if it is a problem or not. > > The nfsroot is clearly not a problem. > > As for the other cases I'm not certain. > > So skimming through the code quickly. > > include/linux/lockd/lockd.h > > #define NLMCLNT_OHSIZE (sizeof(system_utsname.nodename)+10) > > fs/lockd/xdr.c > > #define NLM_caller_sz 1+XDR_QUADLEN(sizeof(system_utsname.nodename)) > > The previous two are just sizes, so not interesting for analysis. > > > fs/lockd/clntproc.c > > static void nlmclnt_setlockargs(struct nlm_rqst *req, struct file_lock *fl) > > { > > struct nlm_args *argp = &req->a_args; > > struct nlm_lock *lock = &argp->lock; > > > > nlmclnt_next_cookie(&argp->cookie); > > argp->state = nsm_local_state; > > memcpy(&lock->fh, NFS_FH(fl->fl_file->f_dentry->d_inode), sizeof(struct nfs_fh)); > > lock->caller = system_utsname.nodename; > > lock->oh.data = req->a_owner; > > lock->oh.len = snprintf(req->a_owner, sizeof(req->a_owner), "%u@%s", > > (unsigned int)fl->fl_u.nfs_fl.owner->pid, > > system_utsname.nodename); > > lock->svid = fl->fl_u.nfs_fl.owner->pid; > > lock->fl.fl_start = fl->fl_start; > > lock->fl.fl_end = fl->fl_end; > > lock->fl.fl_type = fl->fl_type; > > } > > I think this just creates a unique string with nodename+pid In fs/lockd/svcshare.c, nlmsvc_share_file and nlmsvc_unshare_file do compare the xdr_netobj->data field, which contains the snprinted system_utsname.nodename. However, if you're going to unshare utsname() and change your nodename, the effect should be no different than if you just changed your nodename :) So I don't see this being a problem. -serge ^ permalink raw reply [flat|nested] 50+ messages in thread
* [RFC][PATCH 3/5] uts namespaces: Use init uts_namespace when appropriate 2006-04-07 18:36 [RFC][PATCH 0/5] uts namespaces: Introduction Serge E. Hallyn 2006-04-07 18:36 ` [RFC][PATCH 5/5] uts namespaces: Enable UTS namespaces debugging Serge E. Hallyn 2006-04-07 18:36 ` [RFC][PATCH 2/5] uts namespaces: Switch to using uts namespaces Serge E. Hallyn @ 2006-04-07 18:36 ` Serge E. Hallyn 2006-04-07 18:36 ` [RFC][PATCH 4/5] utsname namespaces: sysctl hack Serge E. Hallyn ` (3 subsequent siblings) 6 siblings, 0 replies; 50+ messages in thread From: Serge E. Hallyn @ 2006-04-07 18:36 UTC (permalink / raw) To: linux-kernel, Kirill Korotaev, herbert, devel, sam, Eric W. Biederman, xemul, devel, James Morris In some places, particularly drivers and __init code, the init uts namespace is the appropriate one to use. This patch replaces those with a direct reference to init_uts_ns.name. Note that we can drop this patch and simply do #define system_utsname (init_uts_ns.name) however by using this patch we make explicit, for the sake of review, those places where we do and do not use the utsname namespace. Signed-off-by: Serge E. Hallyn <serue@us.ibm.com> --- arch/arm/kernel/setup.c | 2 +- arch/arm26/kernel/setup.c | 2 +- arch/cris/kernel/setup.c | 2 +- arch/i386/kernel/process.c | 6 +++--- arch/i386/kernel/traps.c | 6 +++--- arch/powerpc/kernel/process.c | 2 +- arch/powerpc/kernel/setup_64.c | 2 +- arch/powerpc/platforms/pseries/setup.c | 2 +- arch/sh/kernel/setup.c | 2 +- arch/um/kernel/um_arch.c | 6 +++--- arch/um/sys-x86_64/sysrq.c | 2 +- arch/x86_64/kernel/process.c | 6 +++--- drivers/infiniband/hw/ipath/ipath_verbs.c | 2 +- drivers/parisc/led.c | 2 +- drivers/scsi/lpfc/lpfc_ct.c | 8 ++++---- drivers/usb/core/hcd.c | 4 ++-- drivers/usb/gadget/ether.c | 2 +- drivers/usb/gadget/file_storage.c | 2 +- drivers/usb/gadget/serial.c | 2 +- drivers/usb/gadget/zero.c | 2 +- include/asm-i386/bugs.h | 2 +- include/asm-i386/elf.h | 2 +- include/asm-sh/bugs.h | 2 +- kernel/power/snapshot.c | 10 +++++----- net/ipv4/ipconfig.c | 16 ++++++++-------- net/sunrpc/clnt.c | 4 ++-- sound/core/info_oss.c | 10 +++++----- 27 files changed, 55 insertions(+), 55 deletions(-) ef54ab30a75ae83207b385090d3f1ff6c912f0d5 diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 4375284..647c516 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -319,7 +319,7 @@ static void __init setup_processor(void) cpu_name, processor_id, (int)processor_id & 15, proc_arch[cpu_architecture()]); - sprintf(system_utsname.machine, "%s%c", list->arch_name, ENDIANNESS); + sprintf(init_uts_ns.name.machine, "%s%c", list->arch_name, ENDIANNESS); sprintf(elf_platform, "%s%c", list->elf_name, ENDIANNESS); elf_hwcap = list->elf_hwcap; diff --git a/arch/arm26/kernel/setup.c b/arch/arm26/kernel/setup.c index 4eb329e..6564e73 100644 --- a/arch/arm26/kernel/setup.c +++ b/arch/arm26/kernel/setup.c @@ -144,7 +144,7 @@ static void __init setup_processor(void) dump_cpu_info(); - sprintf(system_utsname.machine, "%s", list->arch_name); + sprintf(init_uts_ns.name.machine, "%s", list->arch_name); sprintf(elf_platform, "%s", list->elf_name); elf_hwcap = list->elf_hwcap; diff --git a/arch/cris/kernel/setup.c b/arch/cris/kernel/setup.c index 619a6ee..f9a29a4 100644 --- a/arch/cris/kernel/setup.c +++ b/arch/cris/kernel/setup.c @@ -161,7 +161,7 @@ setup_arch(char **cmdline_p) show_etrax_copyright(); /* Setup utsname */ - strcpy(system_utsname.machine, cris_machine_name); + strcpy(init_uts_ns.name.machine, cris_machine_name); } static void *c_start(struct seq_file *m, loff_t *pos) diff --git a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c index 6259afe..89fac4c 100644 --- a/arch/i386/kernel/process.c +++ b/arch/i386/kernel/process.c @@ -297,9 +297,9 @@ void show_regs(struct pt_regs * regs) if (user_mode_vm(regs)) printk(" ESP: %04x:%08lx",0xffff & regs->xss,regs->esp); printk(" EFLAGS: %08lx %s (%s %.*s)\n", - regs->eflags, print_tainted(), system_utsname.release, - (int)strcspn(system_utsname.version, " "), - system_utsname.version); + regs->eflags, print_tainted(), init_uts_ns.name.release, + (int)strcspn(init_uts_ns.name.version, " "), + init_uts_ns.name.version); printk("EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n", regs->eax,regs->ebx,regs->ecx,regs->edx); printk("ESI: %08lx EDI: %08lx EBP: %08lx", diff --git a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c index e385279..addff65 100644 --- a/arch/i386/kernel/traps.c +++ b/arch/i386/kernel/traps.c @@ -260,9 +260,9 @@ void show_registers(struct pt_regs *regs printk(KERN_EMERG "CPU: %d\nEIP: %04x:[<%08lx>] %s VLI\n" "EFLAGS: %08lx (%s %.*s) \n", smp_processor_id(), 0xffff & regs->xcs, regs->eip, - print_tainted(), regs->eflags, system_utsname.release, - (int)strcspn(system_utsname.version, " "), - system_utsname.version); + print_tainted(), regs->eflags, init_uts_ns.name.release, + (int)strcspn(init_uts_ns.name.version, " "), + init_uts_ns.name.version); print_symbol(KERN_EMERG "EIP is at %s\n", regs->eip); printk(KERN_EMERG "eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n", regs->eax, regs->ebx, regs->ecx, regs->edx); diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index 2dd47d2..7c21450 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c @@ -425,7 +425,7 @@ void show_regs(struct pt_regs * regs) printk("NIP: "REG" LR: "REG" CTR: "REG"\n", regs->nip, regs->link, regs->ctr); printk("REGS: %p TRAP: %04lx %s (%s)\n", - regs, regs->trap, print_tainted(), system_utsname.release); + regs, regs->trap, print_tainted(), init_uts_ns.name.release); printk("MSR: "REG" ", regs->msr); printbits(regs->msr, msr_bits); printk(" CR: %08lX XER: %08lX\n", regs->ccr, regs->xer); diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c index 13e91c4..26f0477 100644 --- a/arch/powerpc/kernel/setup_64.c +++ b/arch/powerpc/kernel/setup_64.c @@ -435,7 +435,7 @@ void __init setup_system(void) smp_release_cpus(); #endif - printk("Starting Linux PPC64 %s\n", system_utsname.version); + printk("Starting Linux PPC64 %s\n", init_uts_ns.name.version); printk("-----------------------------------------------------\n"); printk("ppc64_pft_size = 0x%lx\n", ppc64_pft_size); diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c index 5eb55ef..9df0d0e 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c @@ -255,7 +255,7 @@ static int __init pSeries_init_panel(voi { /* Manually leave the kernel version on the panel. */ ppc_md.progress("Linux ppc64\n", 0); - ppc_md.progress(system_utsname.version, 0); + ppc_md.progress(init_uts_ns.name.version, 0); return 0; } diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c index bb229ef..fab811b 100644 --- a/arch/sh/kernel/setup.c +++ b/arch/sh/kernel/setup.c @@ -481,7 +481,7 @@ static int show_cpuinfo(struct seq_file seq_printf(m, "machine\t\t: %s\n", get_system_type()); seq_printf(m, "processor\t: %d\n", cpu); - seq_printf(m, "cpu family\t: %s\n", system_utsname.machine); + seq_printf(m, "cpu family\t: %s\n", init_uts_ns.name.machine); seq_printf(m, "cpu type\t: %s\n", get_cpu_subtype()); show_cpuflags(m); diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c index 7d51dd7..4caad31 100644 --- a/arch/um/kernel/um_arch.c +++ b/arch/um/kernel/um_arch.c @@ -167,7 +167,7 @@ static char *usage_string = static int __init uml_version_setup(char *line, int *add) { - printf("%s\n", system_utsname.release); + printf("%s\n", init_uts_ns.name.release); exit(0); return 0; @@ -278,7 +278,7 @@ static int __init Usage(char *line, int { const char **p; - printf(usage_string, system_utsname.release); + printf(usage_string, init_uts_ns.name.release); p = &__uml_help_start; while (p < &__uml_help_end) { printf("%s", *p); @@ -400,7 +400,7 @@ int linux_main(int argc, char **argv) /* Reserve up to 4M after the current brk */ uml_reserved = ROUND_4M(brk_start) + (1 << 22); - setup_machinename(system_utsname.machine); + setup_machinename(init_uts_ns.name.machine); #ifdef CONFIG_CMDLINE_ON_HOST argv1_begin = argv[1]; diff --git a/arch/um/sys-x86_64/sysrq.c b/arch/um/sys-x86_64/sysrq.c index d0a25af..49a549a 100644 --- a/arch/um/sys-x86_64/sysrq.c +++ b/arch/um/sys-x86_64/sysrq.c @@ -16,7 +16,7 @@ void __show_regs(struct pt_regs * regs) printk("\n"); print_modules(); printk("Pid: %d, comm: %.20s %s %s\n", - current->pid, current->comm, print_tainted(), system_utsname.release); + current->pid, current->comm, print_tainted(), init_uts_ns.name.release); printk("RIP: %04lx:[<%016lx>] ", PT_REGS_CS(regs) & 0xffff, PT_REGS_RIP(regs)); printk("\nRSP: %016lx EFLAGS: %08lx\n", PT_REGS_RSP(regs), diff --git a/arch/x86_64/kernel/process.c b/arch/x86_64/kernel/process.c index 70dd8e5..f79a080 100644 --- a/arch/x86_64/kernel/process.c +++ b/arch/x86_64/kernel/process.c @@ -292,9 +292,9 @@ void __show_regs(struct pt_regs * regs) print_modules(); printk("Pid: %d, comm: %.20s %s %s %.*s\n", current->pid, current->comm, print_tainted(), - system_utsname.release, - (int)strcspn(system_utsname.version, " "), - system_utsname.version); + init_uts_ns.name.release, + (int)strcspn(init_uts_ns.name.version, " "), + init_uts_ns.name.version); printk("RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->rip); printk_address(regs->rip); printk("\nRSP: %04lx:%016lx EFLAGS: %08lx\n", regs->ss, regs->rsp, diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.c b/drivers/infiniband/hw/ipath/ipath_verbs.c index 9f27fd3..d5479a8 100644 --- a/drivers/infiniband/hw/ipath/ipath_verbs.c +++ b/drivers/infiniband/hw/ipath/ipath_verbs.c @@ -1048,7 +1048,7 @@ static void *ipath_register_ib_device(in dev->process_mad = ipath_process_mad; snprintf(dev->node_desc, sizeof(dev->node_desc), - IPATH_IDSTR " %s kernel_SMA", system_utsname.nodename); + IPATH_IDSTR " %s kernel_SMA", init_uts_ns.name.nodename); ret = ib_register_device(dev); if (ret) diff --git a/drivers/parisc/led.c b/drivers/parisc/led.c index 298f2dd..c05e169 100644 --- a/drivers/parisc/led.c +++ b/drivers/parisc/led.c @@ -684,7 +684,7 @@ int __init led_init(void) int ret; snprintf(lcd_text_default, sizeof(lcd_text_default), - "Linux %s", system_utsname.release); + "Linux %s", init_uts_ns.name.release); /* Work around the buggy PDC of KittyHawk-machines */ switch (CPU_HVERSION) { diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c index b65ee57..ef05e16 100644 --- a/drivers/scsi/lpfc/lpfc_ct.c +++ b/drivers/scsi/lpfc/lpfc_ct.c @@ -961,8 +961,8 @@ lpfc_fdmi_cmd(struct lpfc_hba * phba, st ae = (ATTRIBUTE_ENTRY *) ((uint8_t *) rh + size); ae->ad.bits.AttrType = be16_to_cpu(OS_NAME_VERSION); sprintf(ae->un.OsNameVersion, "%s %s %s", - system_utsname.sysname, system_utsname.release, - system_utsname.version); + init_uts_ns.name.sysname, init_uts_ns.name.release, + init_uts_ns.name.version); len = strlen(ae->un.OsNameVersion); len += (len & 3) ? (4 - (len & 3)) : 4; ae->ad.bits.AttrLen = be16_to_cpu(FOURBYTES + len); @@ -1080,7 +1080,7 @@ lpfc_fdmi_cmd(struct lpfc_hba * phba, st size); ae->ad.bits.AttrType = be16_to_cpu(HOST_NAME); sprintf(ae->un.HostName, "%s", - system_utsname.nodename); + init_uts_ns.name.nodename); len = strlen(ae->un.HostName); len += (len & 3) ? (4 - (len & 3)) : 4; ae->ad.bits.AttrLen = @@ -1168,7 +1168,7 @@ lpfc_fdmi_tmo_handler(struct lpfc_hba *p ndlp = lpfc_findnode_did(phba, NLP_SEARCH_ALL, FDMI_DID); if (ndlp) { - if (system_utsname.nodename[0] != '\0') { + if (init_uts_ns.name.nodename[0] != '\0') { lpfc_fdmi_cmd(phba, ndlp, SLI_MGMT_DHBA); } else { mod_timer(&phba->fc_fdmitmo, jiffies + HZ * 60); diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index fbd938d..b979b16 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -318,8 +318,8 @@ static int rh_string ( // id 3 == vendor description } else if (id == 3) { - snprintf (buf, sizeof buf, "%s %s %s", system_utsname.sysname, - system_utsname.release, hcd->driver->description); + snprintf (buf, sizeof buf, "%s %s %s", init_uts_ns.name.sysname, + init_uts_ns.name.release, hcd->driver->description); // unsupported IDs --> "protocol stall" } else diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index c3d8e5c..e49359d 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c @@ -2242,7 +2242,7 @@ eth_bind (struct usb_gadget *gadget) return -ENODEV; } snprintf (manufacturer, sizeof manufacturer, "%s %s/%s", - system_utsname.sysname, system_utsname.release, + init_uts_ns.name.sysname, init_uts_ns.name.release, gadget->name); /* If there's an RNDIS configuration, that's what Windows wants to diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c index cf3be29..81ffe03 100644 --- a/drivers/usb/gadget/file_storage.c +++ b/drivers/usb/gadget/file_storage.c @@ -3965,7 +3965,7 @@ static int __init fsg_bind(struct usb_ga usb_gadget_set_selfpowered(gadget); snprintf(manufacturer, sizeof manufacturer, "%s %s with %s", - system_utsname.sysname, system_utsname.release, + init_uts_ns.name.sysname, init_uts_ns.name.release, gadget->name); /* On a real device, serial[] would be loaded from permanent diff --git a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c index b992546..1063159 100644 --- a/drivers/usb/gadget/serial.c +++ b/drivers/usb/gadget/serial.c @@ -1496,7 +1496,7 @@ static int __init gs_bind(struct usb_gad return -ENOMEM; snprintf(manufacturer, sizeof(manufacturer), "%s %s with %s", - system_utsname.sysname, system_utsname.release, + init_uts_ns.name.sysname, init_uts_ns.name.release, gadget->name); memset(dev, 0, sizeof(struct gs_dev)); diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c index 51424f6..5aa1bd4 100644 --- a/drivers/usb/gadget/zero.c +++ b/drivers/usb/gadget/zero.c @@ -1240,7 +1240,7 @@ autoconf_fail: EP_OUT_NAME, EP_IN_NAME); snprintf (manufacturer, sizeof manufacturer, "%s %s with %s", - system_utsname.sysname, system_utsname.release, + init_uts_ns.name.sysname, init_uts_ns.name.release, gadget->name); return 0; diff --git a/include/asm-i386/bugs.h b/include/asm-i386/bugs.h index 50233e0..ce0386e 100644 --- a/include/asm-i386/bugs.h +++ b/include/asm-i386/bugs.h @@ -190,6 +190,6 @@ static void __init check_bugs(void) check_fpu(); check_hlt(); check_popad(); - system_utsname.machine[1] = '0' + (boot_cpu_data.x86 > 6 ? 6 : boot_cpu_data.x86); + init_uts_ns.name.machine[1] = '0' + (boot_cpu_data.x86 > 6 ? 6 : boot_cpu_data.x86); alternative_instructions(); } diff --git a/include/asm-i386/elf.h b/include/asm-i386/elf.h index 4153d80..53c2829 100644 --- a/include/asm-i386/elf.h +++ b/include/asm-i386/elf.h @@ -108,7 +108,7 @@ typedef struct user_fxsr_struct elf_fpxr For the moment, we have only optimizations for the Intel generations, but that could change... */ -#define ELF_PLATFORM (system_utsname.machine) +#define ELF_PLATFORM (init_uts_ns.name.machine) #ifdef __KERNEL__ #define SET_PERSONALITY(ex, ibcs2) do { } while (0) diff --git a/include/asm-sh/bugs.h b/include/asm-sh/bugs.h index a6de3d0..0a1648d 100644 --- a/include/asm-sh/bugs.h +++ b/include/asm-sh/bugs.h @@ -18,7 +18,7 @@ static void __init check_bugs(void) { extern char *get_cpu_subtype(void); extern unsigned long loops_per_jiffy; - char *p= &system_utsname.machine[2]; /* "sh" */ + char *p= &init_uts_ns.name.machine[2]; /* "sh" */ cpu_data->loops_per_jiffy = loops_per_jiffy; diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index c5863d0..14b3f24 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c @@ -523,7 +523,7 @@ static void init_header(struct swsusp_in memset(info, 0, sizeof(struct swsusp_info)); info->version_code = LINUX_VERSION_CODE; info->num_physpages = num_physpages; - memcpy(&info->uts, &system_utsname, sizeof(system_utsname)); + memcpy(&info->uts, &init_uts_ns.name, sizeof(init_uts_ns.name)); info->cpus = num_online_cpus(); info->image_pages = nr_copy_pages; info->pages = nr_copy_pages + nr_meta_pages + 1; @@ -662,13 +662,13 @@ static int check_header(struct swsusp_in reason = "kernel version"; if (info->num_physpages != num_physpages) reason = "memory size"; - if (strcmp(info->uts.sysname,system_utsname.sysname)) + if (strcmp(info->uts.sysname,init_uts_ns.name.sysname)) reason = "system type"; - if (strcmp(info->uts.release,system_utsname.release)) + if (strcmp(info->uts.release,init_uts_ns.name.release)) reason = "kernel release"; - if (strcmp(info->uts.version,system_utsname.version)) + if (strcmp(info->uts.version,init_uts_ns.name.version)) reason = "version"; - if (strcmp(info->uts.machine,system_utsname.machine)) + if (strcmp(info->uts.machine,init_uts_ns.name.machine)) reason = "machine"; if (reason) { printk(KERN_ERR "swsusp: Resume mismatch: %s\n", reason); diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c index cb8a92f..b00635f 100644 --- a/net/ipv4/ipconfig.c +++ b/net/ipv4/ipconfig.c @@ -367,7 +367,7 @@ static int __init ic_defaults(void) */ if (!ic_host_name_set) - sprintf(system_utsname.nodename, "%u.%u.%u.%u", NIPQUAD(ic_myaddr)); + sprintf(init_uts_ns.name.nodename, "%u.%u.%u.%u", NIPQUAD(ic_myaddr)); if (root_server_addr == INADDR_NONE) root_server_addr = ic_servaddr; @@ -806,7 +806,7 @@ static void __init ic_do_bootp_ext(u8 *e } break; case 12: /* Host name */ - ic_bootp_string(system_utsname.nodename, ext+1, *ext, __NEW_UTS_LEN); + ic_bootp_string(init_uts_ns.name.nodename, ext+1, *ext, __NEW_UTS_LEN); ic_host_name_set = 1; break; case 15: /* Domain name (DNS) */ @@ -817,7 +817,7 @@ static void __init ic_do_bootp_ext(u8 *e ic_bootp_string(root_server_path, ext+1, *ext, sizeof(root_server_path)); break; case 40: /* NIS Domain name (_not_ DNS) */ - ic_bootp_string(system_utsname.domainname, ext+1, *ext, __NEW_UTS_LEN); + ic_bootp_string(init_uts_ns.name.domainname, ext+1, *ext, __NEW_UTS_LEN); break; } } @@ -1369,7 +1369,7 @@ static int __init ip_auto_config(void) printk(", mask=%u.%u.%u.%u", NIPQUAD(ic_netmask)); printk(", gw=%u.%u.%u.%u", NIPQUAD(ic_gateway)); printk(",\n host=%s, domain=%s, nis-domain=%s", - system_utsname.nodename, ic_domain, system_utsname.domainname); + init_uts_ns.name.nodename, ic_domain, init_uts_ns.name.domainname); printk(",\n bootserver=%u.%u.%u.%u", NIPQUAD(ic_servaddr)); printk(", rootserver=%u.%u.%u.%u", NIPQUAD(root_server_addr)); printk(", rootpath=%s", root_server_path); @@ -1479,11 +1479,11 @@ static int __init ip_auto_config_setup(c case 4: if ((dp = strchr(ip, '.'))) { *dp++ = '\0'; - strlcpy(system_utsname.domainname, dp, - sizeof(system_utsname.domainname)); + strlcpy(init_uts_ns.name.domainname, dp, + sizeof(init_uts_ns.name.domainname)); } - strlcpy(system_utsname.nodename, ip, - sizeof(system_utsname.nodename)); + strlcpy(init_uts_ns.name.nodename, ip, + sizeof(init_uts_ns.name.nodename)); ic_host_name_set = 1; break; case 5: diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index aa8965e..c21f28b 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -176,10 +176,10 @@ rpc_new_client(struct rpc_xprt *xprt, ch } /* save the nodename */ - clnt->cl_nodelen = strlen(system_utsname.nodename); + clnt->cl_nodelen = strlen(init_uts_ns.name.nodename); if (clnt->cl_nodelen > UNX_MAXNODENAME) clnt->cl_nodelen = UNX_MAXNODENAME; - memcpy(clnt->cl_nodename, system_utsname.nodename, clnt->cl_nodelen); + memcpy(clnt->cl_nodename, init_uts_ns.name.nodename, clnt->cl_nodelen); return clnt; out_no_auth: diff --git a/sound/core/info_oss.c b/sound/core/info_oss.c index f9ce854..dcb665a 100644 --- a/sound/core/info_oss.c +++ b/sound/core/info_oss.c @@ -94,11 +94,11 @@ static void snd_sndstat_proc_read(struct { snd_iprintf(buffer, "Sound Driver:3.8.1a-980706 (ALSA v" CONFIG_SND_VERSION " emulation code)\n"); snd_iprintf(buffer, "Kernel: %s %s %s %s %s\n", - system_utsname.sysname, - system_utsname.nodename, - system_utsname.release, - system_utsname.version, - system_utsname.machine); + init_uts_ns.name.sysname, + init_uts_ns.name.nodename, + init_uts_ns.name.release, + init_uts_ns.name.version, + init_uts_ns.name.machine); snd_iprintf(buffer, "Config options: 0\n"); snd_iprintf(buffer, "\nInstalled drivers: \n"); snd_iprintf(buffer, "Type 10: ALSA emulation\n"); -- 1.2.4 ^ permalink raw reply related [flat|nested] 50+ messages in thread
* [RFC][PATCH 4/5] utsname namespaces: sysctl hack 2006-04-07 18:36 [RFC][PATCH 0/5] uts namespaces: Introduction Serge E. Hallyn ` (2 preceding siblings ...) 2006-04-07 18:36 ` [RFC][PATCH 3/5] uts namespaces: Use init uts_namespace when appropriate Serge E. Hallyn @ 2006-04-07 18:36 ` Serge E. Hallyn 2006-04-19 15:17 ` Kirill Korotaev 2006-04-07 18:36 ` [RFC][PATCH 1/5] uts namespaces: Implement utsname namespaces Serge E. Hallyn ` (2 subsequent siblings) 6 siblings, 1 reply; 50+ messages in thread From: Serge E. Hallyn @ 2006-04-07 18:36 UTC (permalink / raw) To: linux-kernel, Kirill Korotaev, herbert, devel, sam, Eric W. Biederman, xemul, devel, James Morris Sysctl uts patch. This clearly will need to be done another way, but since sysctl itself needs to be container aware, 'the right thing' is a separate patchset. Signed-off-by: Serge E. Hallyn <serue@us.ibm.com> --- kernel/sysctl.c | 38 ++++++++++++++++++++++++++++---------- 1 files changed, 28 insertions(+), 10 deletions(-) 40f7e1320c82efb6e875fc3bf44408cdfd093f21 diff --git a/kernel/sysctl.c b/kernel/sysctl.c index e82726f..c2b18ef 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -233,8 +233,8 @@ static ctl_table kern_table[] = { { .ctl_name = KERN_OSTYPE, .procname = "ostype", - .data = system_utsname.sysname, - .maxlen = sizeof(system_utsname.sysname), + .data = init_uts_ns.name.sysname, + .maxlen = sizeof(init_uts_ns.name.sysname), .mode = 0444, .proc_handler = &proc_doutsstring, .strategy = &sysctl_string, @@ -242,8 +242,8 @@ static ctl_table kern_table[] = { { .ctl_name = KERN_OSRELEASE, .procname = "osrelease", - .data = system_utsname.release, - .maxlen = sizeof(system_utsname.release), + .data = init_uts_ns.name.release, + .maxlen = sizeof(init_uts_ns.name.release), .mode = 0444, .proc_handler = &proc_doutsstring, .strategy = &sysctl_string, @@ -251,8 +251,8 @@ static ctl_table kern_table[] = { { .ctl_name = KERN_VERSION, .procname = "version", - .data = system_utsname.version, - .maxlen = sizeof(system_utsname.version), + .data = init_uts_ns.name.version, + .maxlen = sizeof(init_uts_ns.name.version), .mode = 0444, .proc_handler = &proc_doutsstring, .strategy = &sysctl_string, @@ -260,8 +260,8 @@ static ctl_table kern_table[] = { { .ctl_name = KERN_NODENAME, .procname = "hostname", - .data = system_utsname.nodename, - .maxlen = sizeof(system_utsname.nodename), + .data = init_uts_ns.name.nodename, + .maxlen = sizeof(init_uts_ns.name.nodename), .mode = 0644, .proc_handler = &proc_doutsstring, .strategy = &sysctl_string, @@ -269,8 +269,8 @@ static ctl_table kern_table[] = { { .ctl_name = KERN_DOMAINNAME, .procname = "domainname", - .data = system_utsname.domainname, - .maxlen = sizeof(system_utsname.domainname), + .data = init_uts_ns.name.domainname, + .maxlen = sizeof(init_uts_ns.name.domainname), .mode = 0644, .proc_handler = &proc_doutsstring, .strategy = &sysctl_string, @@ -1619,6 +1619,24 @@ static int proc_doutsstring(ctl_table *t { int r; + switch (table->ctl_name) { + case KERN_OSTYPE: + table->data = utsname()->sysname; + break; + case KERN_OSRELEASE: + table->data = utsname()->release; + break; + case KERN_VERSION: + table->data = utsname()->version; + break; + case KERN_NODENAME: + table->data = utsname()->nodename; + break; + case KERN_DOMAINNAME: + table->data = utsname()->domainname; + break; + } + if (!write) { down_read(&uts_sem); r=proc_dostring(table,0,filp,buffer,lenp, ppos); -- 1.2.4 ^ permalink raw reply related [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 4/5] utsname namespaces: sysctl hack 2006-04-07 18:36 ` [RFC][PATCH 4/5] utsname namespaces: sysctl hack Serge E. Hallyn @ 2006-04-19 15:17 ` Kirill Korotaev 2006-04-19 15:21 ` Serge E. Hallyn 2006-04-19 15:29 ` Eric W. Biederman 0 siblings, 2 replies; 50+ messages in thread From: Kirill Korotaev @ 2006-04-19 15:17 UTC (permalink / raw) To: Serge E. Hallyn Cc: linux-kernel, herbert, devel, sam, Eric W. Biederman, xemul, James Morris Serge, can we do nothing with sysctls at this moment, instead of commiting hacks? Thanks, Kirill > Sysctl uts patch. This clearly will need to be done another way, but > since sysctl itself needs to be container aware, 'the right thing' is > a separate patchset. > > Signed-off-by: Serge E. Hallyn <serue@us.ibm.com> > --- > kernel/sysctl.c | 38 ++++++++++++++++++++++++++++---------- > 1 files changed, 28 insertions(+), 10 deletions(-) > > 40f7e1320c82efb6e875fc3bf44408cdfd093f21 > diff --git a/kernel/sysctl.c b/kernel/sysctl.c > index e82726f..c2b18ef 100644 > --- a/kernel/sysctl.c > +++ b/kernel/sysctl.c > @@ -233,8 +233,8 @@ static ctl_table kern_table[] = { > { > .ctl_name = KERN_OSTYPE, > .procname = "ostype", > - .data = system_utsname.sysname, > - .maxlen = sizeof(system_utsname.sysname), > + .data = init_uts_ns.name.sysname, > + .maxlen = sizeof(init_uts_ns.name.sysname), > .mode = 0444, > .proc_handler = &proc_doutsstring, > .strategy = &sysctl_string, > @@ -242,8 +242,8 @@ static ctl_table kern_table[] = { > { > .ctl_name = KERN_OSRELEASE, > .procname = "osrelease", > - .data = system_utsname.release, > - .maxlen = sizeof(system_utsname.release), > + .data = init_uts_ns.name.release, > + .maxlen = sizeof(init_uts_ns.name.release), > .mode = 0444, > .proc_handler = &proc_doutsstring, > .strategy = &sysctl_string, > @@ -251,8 +251,8 @@ static ctl_table kern_table[] = { > { > .ctl_name = KERN_VERSION, > .procname = "version", > - .data = system_utsname.version, > - .maxlen = sizeof(system_utsname.version), > + .data = init_uts_ns.name.version, > + .maxlen = sizeof(init_uts_ns.name.version), > .mode = 0444, > .proc_handler = &proc_doutsstring, > .strategy = &sysctl_string, > @@ -260,8 +260,8 @@ static ctl_table kern_table[] = { > { > .ctl_name = KERN_NODENAME, > .procname = "hostname", > - .data = system_utsname.nodename, > - .maxlen = sizeof(system_utsname.nodename), > + .data = init_uts_ns.name.nodename, > + .maxlen = sizeof(init_uts_ns.name.nodename), > .mode = 0644, > .proc_handler = &proc_doutsstring, > .strategy = &sysctl_string, > @@ -269,8 +269,8 @@ static ctl_table kern_table[] = { > { > .ctl_name = KERN_DOMAINNAME, > .procname = "domainname", > - .data = system_utsname.domainname, > - .maxlen = sizeof(system_utsname.domainname), > + .data = init_uts_ns.name.domainname, > + .maxlen = sizeof(init_uts_ns.name.domainname), > .mode = 0644, > .proc_handler = &proc_doutsstring, > .strategy = &sysctl_string, > @@ -1619,6 +1619,24 @@ static int proc_doutsstring(ctl_table *t > { > int r; > > + switch (table->ctl_name) { > + case KERN_OSTYPE: > + table->data = utsname()->sysname; > + break; > + case KERN_OSRELEASE: > + table->data = utsname()->release; > + break; > + case KERN_VERSION: > + table->data = utsname()->version; > + break; > + case KERN_NODENAME: > + table->data = utsname()->nodename; > + break; > + case KERN_DOMAINNAME: > + table->data = utsname()->domainname; > + break; > + } > + > if (!write) { > down_read(&uts_sem); > r=proc_dostring(table,0,filp,buffer,lenp, ppos); ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 4/5] utsname namespaces: sysctl hack 2006-04-19 15:17 ` Kirill Korotaev @ 2006-04-19 15:21 ` Serge E. Hallyn 2006-04-19 15:50 ` Kirill Korotaev 2006-04-19 15:52 ` Eric W. Biederman 2006-04-19 15:29 ` Eric W. Biederman 1 sibling, 2 replies; 50+ messages in thread From: Serge E. Hallyn @ 2006-04-19 15:21 UTC (permalink / raw) To: Kirill Korotaev Cc: Serge E. Hallyn, linux-kernel, herbert, devel, sam, Eric W. Biederman, xemul, James Morris Quoting Kirill Korotaev (dev@sw.ru): > Serge, > > can we do nothing with sysctls at this moment, instead of commiting hacks? Please look closer at the patch. I *am* doing nothing with sysctls. system_utsname no longer exists, and the way to get to that is by using init_uts_ns.name. That's all this does. -serge > > Thanks, > Kirill > > >Sysctl uts patch. This clearly will need to be done another way, but > >since sysctl itself needs to be container aware, 'the right thing' is > >a separate patchset. > > > >Signed-off-by: Serge E. Hallyn <serue@us.ibm.com> > >--- > > kernel/sysctl.c | 38 ++++++++++++++++++++++++++++---------- > > 1 files changed, 28 insertions(+), 10 deletions(-) > > > >40f7e1320c82efb6e875fc3bf44408cdfd093f21 > >diff --git a/kernel/sysctl.c b/kernel/sysctl.c > >index e82726f..c2b18ef 100644 > >--- a/kernel/sysctl.c > >+++ b/kernel/sysctl.c > >@@ -233,8 +233,8 @@ static ctl_table kern_table[] = { > > { > > .ctl_name = KERN_OSTYPE, > > .procname = "ostype", > >- .data = system_utsname.sysname, > >- .maxlen = sizeof(system_utsname.sysname), > >+ .data = init_uts_ns.name.sysname, > >+ .maxlen = sizeof(init_uts_ns.name.sysname), > > .mode = 0444, > > .proc_handler = &proc_doutsstring, > > .strategy = &sysctl_string, > >@@ -242,8 +242,8 @@ static ctl_table kern_table[] = { > > { > > .ctl_name = KERN_OSRELEASE, > > .procname = "osrelease", > >- .data = system_utsname.release, > >- .maxlen = sizeof(system_utsname.release), > >+ .data = init_uts_ns.name.release, > >+ .maxlen = sizeof(init_uts_ns.name.release), > > .mode = 0444, > > .proc_handler = &proc_doutsstring, > > .strategy = &sysctl_string, > >@@ -251,8 +251,8 @@ static ctl_table kern_table[] = { > > { > > .ctl_name = KERN_VERSION, > > .procname = "version", > >- .data = system_utsname.version, > >- .maxlen = sizeof(system_utsname.version), > >+ .data = init_uts_ns.name.version, > >+ .maxlen = sizeof(init_uts_ns.name.version), > > .mode = 0444, > > .proc_handler = &proc_doutsstring, > > .strategy = &sysctl_string, > >@@ -260,8 +260,8 @@ static ctl_table kern_table[] = { > > { > > .ctl_name = KERN_NODENAME, > > .procname = "hostname", > >- .data = system_utsname.nodename, > >- .maxlen = sizeof(system_utsname.nodename), > >+ .data = init_uts_ns.name.nodename, > >+ .maxlen = sizeof(init_uts_ns.name.nodename), > > .mode = 0644, > > .proc_handler = &proc_doutsstring, > > .strategy = &sysctl_string, > >@@ -269,8 +269,8 @@ static ctl_table kern_table[] = { > > { > > .ctl_name = KERN_DOMAINNAME, > > .procname = "domainname", > >- .data = system_utsname.domainname, > >- .maxlen = sizeof(system_utsname.domainname), > >+ .data = init_uts_ns.name.domainname, > >+ .maxlen = sizeof(init_uts_ns.name.domainname), > > .mode = 0644, > > .proc_handler = &proc_doutsstring, > > .strategy = &sysctl_string, > >@@ -1619,6 +1619,24 @@ static int proc_doutsstring(ctl_table *t > > { > > int r; > > > >+ switch (table->ctl_name) { > >+ case KERN_OSTYPE: > >+ table->data = utsname()->sysname; > >+ break; > >+ case KERN_OSRELEASE: > >+ table->data = utsname()->release; > >+ break; > >+ case KERN_VERSION: > >+ table->data = utsname()->version; > >+ break; > >+ case KERN_NODENAME: > >+ table->data = utsname()->nodename; > >+ break; > >+ case KERN_DOMAINNAME: > >+ table->data = utsname()->domainname; > >+ break; > >+ } > >+ > > if (!write) { > > down_read(&uts_sem); > > r=proc_dostring(table,0,filp,buffer,lenp, ppos); > ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 4/5] utsname namespaces: sysctl hack 2006-04-19 15:21 ` Serge E. Hallyn @ 2006-04-19 15:50 ` Kirill Korotaev 2006-04-19 16:54 ` Cedric Le Goater 2006-04-19 17:10 ` Serge E. Hallyn 2006-04-19 15:52 ` Eric W. Biederman 1 sibling, 2 replies; 50+ messages in thread From: Kirill Korotaev @ 2006-04-19 15:50 UTC (permalink / raw) To: Serge E. Hallyn Cc: linux-kernel, herbert, devel, sam, Eric W. Biederman, xemul, James Morris Serge, > Please look closer at the patch. > I *am* doing nothing with sysctls. > > system_utsname no longer exists, and the way to get to that is by using > init_uts_ns.name. That's all this does. Sorry for being not concrete enough. I mean switch () in the code. Until we decided how to virtualize sysctls/proc, I believe no dead code/hacks should be commited. IMHO. FYI, I strongly object against virtualizing sysctls this way as it is not flexible and is a real hack from my POV. Sure, change of system_utsname.sysname -> init_uts_ns.name.sysname is Ok. Thanks, Kirill >>>Sysctl uts patch. This clearly will need to be done another way, but >>>since sysctl itself needs to be container aware, 'the right thing' is >>>a separate patchset. >>> >>>Signed-off-by: Serge E. Hallyn <serue@us.ibm.com> >>>--- >>>kernel/sysctl.c | 38 ++++++++++++++++++++++++++++---------- >>>1 files changed, 28 insertions(+), 10 deletions(-) >>> >>>40f7e1320c82efb6e875fc3bf44408cdfd093f21 >>>diff --git a/kernel/sysctl.c b/kernel/sysctl.c >>>index e82726f..c2b18ef 100644 >>>--- a/kernel/sysctl.c >>>+++ b/kernel/sysctl.c >>>@@ -233,8 +233,8 @@ static ctl_table kern_table[] = { >>> { >>> .ctl_name = KERN_OSTYPE, >>> .procname = "ostype", >>>- .data = system_utsname.sysname, >>>- .maxlen = sizeof(system_utsname.sysname), >>>+ .data = init_uts_ns.name.sysname, >>>+ .maxlen = sizeof(init_uts_ns.name.sysname), >>> .mode = 0444, >>> .proc_handler = &proc_doutsstring, >>> .strategy = &sysctl_string, >>>@@ -242,8 +242,8 @@ static ctl_table kern_table[] = { >>> { >>> .ctl_name = KERN_OSRELEASE, >>> .procname = "osrelease", >>>- .data = system_utsname.release, >>>- .maxlen = sizeof(system_utsname.release), >>>+ .data = init_uts_ns.name.release, >>>+ .maxlen = sizeof(init_uts_ns.name.release), >>> .mode = 0444, >>> .proc_handler = &proc_doutsstring, >>> .strategy = &sysctl_string, >>>@@ -251,8 +251,8 @@ static ctl_table kern_table[] = { >>> { >>> .ctl_name = KERN_VERSION, >>> .procname = "version", >>>- .data = system_utsname.version, >>>- .maxlen = sizeof(system_utsname.version), >>>+ .data = init_uts_ns.name.version, >>>+ .maxlen = sizeof(init_uts_ns.name.version), >>> .mode = 0444, >>> .proc_handler = &proc_doutsstring, >>> .strategy = &sysctl_string, >>>@@ -260,8 +260,8 @@ static ctl_table kern_table[] = { >>> { >>> .ctl_name = KERN_NODENAME, >>> .procname = "hostname", >>>- .data = system_utsname.nodename, >>>- .maxlen = sizeof(system_utsname.nodename), >>>+ .data = init_uts_ns.name.nodename, >>>+ .maxlen = sizeof(init_uts_ns.name.nodename), >>> .mode = 0644, >>> .proc_handler = &proc_doutsstring, >>> .strategy = &sysctl_string, >>>@@ -269,8 +269,8 @@ static ctl_table kern_table[] = { >>> { >>> .ctl_name = KERN_DOMAINNAME, >>> .procname = "domainname", >>>- .data = system_utsname.domainname, >>>- .maxlen = sizeof(system_utsname.domainname), >>>+ .data = init_uts_ns.name.domainname, >>>+ .maxlen = sizeof(init_uts_ns.name.domainname), >>> .mode = 0644, >>> .proc_handler = &proc_doutsstring, >>> .strategy = &sysctl_string, >>>@@ -1619,6 +1619,24 @@ static int proc_doutsstring(ctl_table *t >>>{ >>> int r; >>> >>>+ switch (table->ctl_name) { >>>+ case KERN_OSTYPE: >>>+ table->data = utsname()->sysname; >>>+ break; >>>+ case KERN_OSRELEASE: >>>+ table->data = utsname()->release; >>>+ break; >>>+ case KERN_VERSION: >>>+ table->data = utsname()->version; >>>+ break; >>>+ case KERN_NODENAME: >>>+ table->data = utsname()->nodename; >>>+ break; >>>+ case KERN_DOMAINNAME: >>>+ table->data = utsname()->domainname; >>>+ break; >>>+ } >>>+ >>> if (!write) { >>> down_read(&uts_sem); >>> r=proc_dostring(table,0,filp,buffer,lenp, ppos); >> > ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 4/5] utsname namespaces: sysctl hack 2006-04-19 15:50 ` Kirill Korotaev @ 2006-04-19 16:54 ` Cedric Le Goater 2006-04-19 17:10 ` Eric W. Biederman 2006-04-19 17:10 ` Serge E. Hallyn 1 sibling, 1 reply; 50+ messages in thread From: Cedric Le Goater @ 2006-04-19 16:54 UTC (permalink / raw) To: Kirill Korotaev Cc: Serge E. Hallyn, linux-kernel, herbert, devel, sam, Eric W. Biederman, xemul, James Morris Hello ! Kirill Korotaev wrote: > Serge, > >> Please look closer at the patch. >> I *am* doing nothing with sysctls. >> >> system_utsname no longer exists, and the way to get to that is by using >> init_uts_ns.name. That's all this does. > Sorry for being not concrete enough. > I mean switch () in the code. Until we decided how to virtualize > sysctls/proc, I believe no dead code/hacks should be commited. IMHO. How could we improve that hack ? Removing the modification of the static table can easily be worked around but getting rid of the switch() statement is more difficult. Any idea ? > FYI, I strongly object against virtualizing sysctls this way as it is > not flexible and is a real hack from my POV. what is the issue with flexibility ? thanks, C. ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 4/5] utsname namespaces: sysctl hack 2006-04-19 16:54 ` Cedric Le Goater @ 2006-04-19 17:10 ` Eric W. Biederman 0 siblings, 0 replies; 50+ messages in thread From: Eric W. Biederman @ 2006-04-19 17:10 UTC (permalink / raw) To: Cedric Le Goater Cc: Kirill Korotaev, Serge E. Hallyn, linux-kernel, herbert, devel, sam, xemul, James Morris Cedric Le Goater <clg@fr.ibm.com> writes: > Hello ! > > Kirill Korotaev wrote: >> Serge, >> >>> Please look closer at the patch. >>> I *am* doing nothing with sysctls. >>> >>> system_utsname no longer exists, and the way to get to that is by using >>> init_uts_ns.name. That's all this does. >> Sorry for being not concrete enough. >> I mean switch () in the code. Until we decided how to virtualize >> sysctls/proc, I believe no dead code/hacks should be commited. IMHO. > > How could we improve that hack ? Removing the modification of the static > table can easily be worked around but getting rid of the switch() statement > is more difficult. Any idea ? Store offsetof in data. Not that for such a small case it really matters, but it probably improves maintenance by a little bit. >> FYI, I strongly object against virtualizing sysctls this way as it is >> not flexible and is a real hack from my POV. > > what is the issue with flexibility ? The only other thing I would like to see is the process argument passed in. Eric ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 4/5] utsname namespaces: sysctl hack 2006-04-19 15:50 ` Kirill Korotaev 2006-04-19 16:54 ` Cedric Le Goater @ 2006-04-19 17:10 ` Serge E. Hallyn 1 sibling, 0 replies; 50+ messages in thread From: Serge E. Hallyn @ 2006-04-19 17:10 UTC (permalink / raw) To: Kirill Korotaev Cc: Serge E. Hallyn, linux-kernel, herbert, devel, sam, Eric W. Biederman, xemul, James Morris, Dave Hansen Quoting Kirill Korotaev (dev@sw.ru): > Serge, > > >Please look closer at the patch. > >I *am* doing nothing with sysctls. > > > >system_utsname no longer exists, and the way to get to that is by using > >init_uts_ns.name. That's all this does. > Sorry for being not concrete enough. > I mean switch () in the code. Until we decided how to virtualize > sysctls/proc, I believe no dead code/hacks should be commited. IMHO. > > FYI, I strongly object against virtualizing sysctls this way as it is > not flexible and is a real hack from my POV. Oops, I forgot that was there! Sorry. Yup, I'm fine with leaving that out. After all, nothing in the non-debugging patchset allows userspace to clone the utsnamespace yet, so it's tough to argue that leaving out that switch impacts functionality :) I believe Dave is working on a more acceptable sysctl adaptation, though I'm not sure when he'll have a patch to submit. In any case, one clear concise piece at a time. thanks, -serge ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 4/5] utsname namespaces: sysctl hack 2006-04-19 15:21 ` Serge E. Hallyn 2006-04-19 15:50 ` Kirill Korotaev @ 2006-04-19 15:52 ` Eric W. Biederman 2006-04-19 16:23 ` Dave Hansen 1 sibling, 1 reply; 50+ messages in thread From: Eric W. Biederman @ 2006-04-19 15:52 UTC (permalink / raw) To: Serge E. Hallyn Cc: Kirill Korotaev, linux-kernel, herbert, devel, sam, xemul, James Morris "Serge E. Hallyn" <serue@us.ibm.com> writes: > Quoting Kirill Korotaev (dev@sw.ru): >> Serge, >> >> can we do nothing with sysctls at this moment, instead of commiting hacks? > > Please look closer at the patch. > > I *am* doing nothing with sysctls. > > system_utsname no longer exists, and the way to get to that is by using > init_uts_ns.name. That's all this does. Ack. I probably read that question backwards. Yes you must at least touch kernel/sysctl.c when you kill system_utsname. I read it as: Can we do nothing better with sysctls that commiting hacks? Eric ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 4/5] utsname namespaces: sysctl hack 2006-04-19 15:52 ` Eric W. Biederman @ 2006-04-19 16:23 ` Dave Hansen 2006-04-19 16:52 ` Eric W. Biederman 0 siblings, 1 reply; 50+ messages in thread From: Dave Hansen @ 2006-04-19 16:23 UTC (permalink / raw) To: Eric W. Biederman Cc: Serge E. Hallyn, Kirill Korotaev, linux-kernel, herbert, devel, sam, xemul, James Morris [-- Attachment #1: Type: text/plain, Size: 662 bytes --] Besides ipc and utsnames, can anybody think of some other things in sysctl that we really need to virtualize? It seems to me that most of the other stuff is kernel-global and we simply won't allow anything in a container to touch it. That said, there may be things in the future that need to get added as we separate out different subsystems. Things like min_free_kbytes could have a container-centric meaning (although I think that is probably a really bad one to mess with). I have a slightly revamped way of doing the sysv namespace sysctl code. I've attached a couple of (still pretty raw) patches. Do these still fall in the "hacks" category? -- Dave [-- Attachment #2: sysv-do-sysctl-strategies2.patch --] [-- Type: text/x-patch, Size: 2473 bytes --] --- work-dave/ipc/sysctl.c | 2 -- work-dave/kernel/sysctl.c | 7 ------- 2 files changed, 9 deletions(-) diff -puN kernel/sysctl.c~sysv-do-sysctl-strategies2 kernel/sysctl.c --- work/kernel/sysctl.c~sysv-do-sysctl-strategies2 2006-04-19 09:13:52.000000000 -0700 +++ work-dave/kernel/sysctl.c 2006-04-19 09:13:52.000000000 -0700 @@ -439,7 +439,6 @@ static ctl_table kern_table[] = { { .ctl_name = KERN_SHMMAX, .procname = "shmmax", - .data = &shm_ctlmax, .maxlen = sizeof (size_t), .mode = 0644, .proc_handler = &proc_doulongvec_minmax, @@ -448,7 +447,6 @@ static ctl_table kern_table[] = { { .ctl_name = KERN_SHMALL, .procname = "shmall", - .data = &shm_ctlall, .maxlen = sizeof (size_t), .mode = 0644, .proc_handler = &proc_doulongvec_minmax, @@ -457,7 +455,6 @@ static ctl_table kern_table[] = { { .ctl_name = KERN_SHMMNI, .procname = "shmmni", - .data = &shm_ctlmni, .maxlen = sizeof (int), .mode = 0644, .proc_handler = &proc_dointvec, @@ -466,7 +463,6 @@ static ctl_table kern_table[] = { { .ctl_name = KERN_MSGMAX, .procname = "msgmax", - .data = &msg_ctlmax, .maxlen = sizeof (int), .mode = 0644, .proc_handler = &proc_dointvec, @@ -475,7 +471,6 @@ static ctl_table kern_table[] = { { .ctl_name = KERN_MSGMNI, .procname = "msgmni", - .data = &msg_ctlmni, .maxlen = sizeof (int), .mode = 0644, .proc_handler = &proc_dointvec, @@ -484,7 +479,6 @@ static ctl_table kern_table[] = { { .ctl_name = KERN_MSGMNB, .procname = "msgmnb", - .data = &msg_ctlmnb, .maxlen = sizeof (int), .mode = 0644, .proc_handler = &proc_dointvec, @@ -493,7 +487,6 @@ static ctl_table kern_table[] = { { .ctl_name = KERN_SEM, .procname = "sem", - .data = &sem_ctls, .maxlen = 4*sizeof (int), .mode = 0644, .proc_handler = &proc_dointvec, diff -L pushpa -puN /dev/null /dev/null diff -L strategies-fix0 -puN /dev/null /dev/null diff -puN ipc/sysctl.c~sysv-do-sysctl-strategies2 ipc/sysctl.c --- work/ipc/sysctl.c~sysv-do-sysctl-strategies2 2006-04-19 09:14:03.000000000 -0700 +++ work-dave/ipc/sysctl.c 2006-04-19 09:14:13.000000000 -0700 @@ -39,8 +39,6 @@ int sysctl_ipc_strategy (ctl_table *tabl default: WARN_ON(1); } - /* an excellent check to make sure everything is going as expected */ - WARN_ON(data != table->data); return default_sysctl_strategy(table, data, oldval, oldlenp, newval, newlen); } _ [-- Attachment #3: sysv-do-sysctl-strategies1.patch --] [-- Type: text/x-patch, Size: 5145 bytes --] DESC strategies-fix0 EDESC --- work-dave/include/linux/ipc.h | 5 ++++ work-dave/ipc/Makefile | 2 - work-dave/ipc/sysctl.c | 48 ++++++++++++++++++++++++++++++++++++++++++ work-dave/ipc/util.c | 1 work-dave/kernel/sysctl.c | 8 +++++++ 5 files changed, 63 insertions(+), 1 deletion(-) diff -puN kernel/sysctl.c~sysv-do-sysctl-strategies1 kernel/sysctl.c --- work/kernel/sysctl.c~sysv-do-sysctl-strategies1 2006-04-18 17:16:10.000000000 -0700 +++ work-dave/kernel/sysctl.c 2006-04-18 17:16:10.000000000 -0700 @@ -47,6 +47,7 @@ #include <linux/syscalls.h> #include <linux/nfs_fs.h> #include <linux/acpi.h> +#include <linux/ipc.h> #include <asm/uaccess.h> #include <asm/processor.h> @@ -442,6 +443,7 @@ static ctl_table kern_table[] = { .maxlen = sizeof (size_t), .mode = 0644, .proc_handler = &proc_doulongvec_minmax, + .strategy = &sysctl_ipc_strategy, }, { .ctl_name = KERN_SHMALL, @@ -450,6 +452,7 @@ static ctl_table kern_table[] = { .maxlen = sizeof (size_t), .mode = 0644, .proc_handler = &proc_doulongvec_minmax, + .strategy = &sysctl_ipc_strategy, }, { .ctl_name = KERN_SHMMNI, @@ -458,6 +461,7 @@ static ctl_table kern_table[] = { .maxlen = sizeof (int), .mode = 0644, .proc_handler = &proc_dointvec, + .strategy = &sysctl_ipc_strategy, }, { .ctl_name = KERN_MSGMAX, @@ -466,6 +470,7 @@ static ctl_table kern_table[] = { .maxlen = sizeof (int), .mode = 0644, .proc_handler = &proc_dointvec, + .strategy = &sysctl_ipc_strategy, }, { .ctl_name = KERN_MSGMNI, @@ -474,6 +479,7 @@ static ctl_table kern_table[] = { .maxlen = sizeof (int), .mode = 0644, .proc_handler = &proc_dointvec, + .strategy = &sysctl_ipc_strategy, }, { .ctl_name = KERN_MSGMNB, @@ -482,6 +488,7 @@ static ctl_table kern_table[] = { .maxlen = sizeof (int), .mode = 0644, .proc_handler = &proc_dointvec, + .strategy = &sysctl_ipc_strategy, }, { .ctl_name = KERN_SEM, @@ -490,6 +497,7 @@ static ctl_table kern_table[] = { .maxlen = 4*sizeof (int), .mode = 0644, .proc_handler = &proc_dointvec, + .strategy = &sysctl_ipc_strategy, }, #endif #ifdef CONFIG_MAGIC_SYSRQ diff -puN include/linux/ipc.h~sysv-do-sysctl-strategies1 include/linux/ipc.h --- work/include/linux/ipc.h~sysv-do-sysctl-strategies1 2006-04-18 17:16:10.000000000 -0700 +++ work-dave/include/linux/ipc.h 2006-04-18 17:18:03.000000000 -0700 @@ -2,6 +2,7 @@ #define _LINUX_IPC_H #include <linux/types.h> +#include <linux/sysctl.h> #define IPC_PRIVATE ((__kernel_key_t) 0) @@ -53,6 +54,10 @@ struct ipc_perm #define IPCMNI 32768 /* <= MAX_INT limit for ipc arrays (including sysctl changes) */ +int sysctl_ipc_strategy (/*ctl_table *table,*/ int __user *name, int nlen, + void __user *oldval, size_t __user *oldlenp, + void __user *newval, size_t newlen, void **context); + /* used by in-kernel data structures */ struct kern_ipc_perm { diff -puN ipc/util.c~sysv-do-sysctl-strategies1 ipc/util.c --- work/ipc/util.c~sysv-do-sysctl-strategies1 2006-04-18 17:16:10.000000000 -0700 +++ work-dave/ipc/util.c 2006-04-19 09:01:53.000000000 -0700 @@ -27,6 +27,7 @@ #include <linux/workqueue.h> #include <linux/seq_file.h> #include <linux/proc_fs.h> +#include <linux/sysctl.h> #include <asm/unistd.h> diff -puN /dev/null ipc/sysctl.c --- /dev/null 2005-03-30 22:36:15.000000000 -0800 +++ work-dave/ipc/sysctl.c 2006-04-19 09:04:23.000000000 -0700 @@ -0,0 +1,48 @@ +#include <linux/sysctl.h> +#include <asm/bug.h> + +extern size_t shm_ctlmax; +extern size_t shm_ctlall; +extern int shm_ctlmni; +extern int msg_ctlmax; +extern int msg_ctlmnb; +extern int msg_ctlmni; +extern int sem_ctls[]; + +int sysctl_ipc_strategy (ctl_table *table, int __user *name, int nlen, + void __user *oldval, size_t __user *oldlenp, + void __user *newval, size_t newlen, void **context) +{ + void *data = NULL; + switch (table->ctl_name) { + case KERN_SHMMAX: + data = &shm_ctlmax; + break; + case KERN_SHMALL: + data = &shm_ctlall; + break; + case KERN_SHMMNI: + data = &shm_ctlmni; + break; + case KERN_MSGMAX: + data = &msg_ctlmax; + break; + case KERN_MSGMNI: + data = &msg_ctlmni; + break; + case KERN_MSGMNB: + data = &msg_ctlmnb; + break; + case KERN_SEM: + data = &sem_ctls; + break; + default: + WARN_ON(1); + } + /* an excellent check to make sure everything is going as expected */ + WARN_ON(data != table->data); + return default_sysctl_strategy(table, data, oldval, oldlenp, + newval, newlen); +} + + diff -puN ipc/Makefile~sysv-do-sysctl-strategies1 ipc/Makefile --- work/ipc/Makefile~sysv-do-sysctl-strategies1 2006-04-19 09:02:50.000000000 -0700 +++ work-dave/ipc/Makefile 2006-04-19 09:02:58.000000000 -0700 @@ -3,7 +3,7 @@ # obj-$(CONFIG_SYSVIPC_COMPAT) += compat.o -obj-$(CONFIG_SYSVIPC) += util.o msgutil.o msg.o sem.o shm.o +obj-$(CONFIG_SYSVIPC) += util.o msgutil.o msg.o sem.o shm.o sysctl.c obj_mq-$(CONFIG_COMPAT) += compat_mq.o obj-$(CONFIG_POSIX_MQUEUE) += mqueue.o msgutil.o $(obj_mq-y) _ [-- Attachment #4: sysv-do-sysctl-strategies0.patch --] [-- Type: text/x-patch, Size: 3577 bytes --] --- work-dave/include/linux/sysctl.h | 4 ++ work-dave/kernel/sysctl.c | 55 +++++++++++++++++++++------------------ 2 files changed, 35 insertions(+), 24 deletions(-) diff -puN ipc/compat.c~sysv-do-sysctl-strategies0 ipc/compat.c diff -puN ipc/compat_mq.c~sysv-do-sysctl-strategies0 ipc/compat_mq.c diff -puN ipc/mqueue.c~sysv-do-sysctl-strategies0 ipc/mqueue.c diff -puN ipc/msg.c~sysv-do-sysctl-strategies0 ipc/msg.c diff -puN ipc/msgutil.c~sysv-do-sysctl-strategies0 ipc/msgutil.c diff -puN ipc/sem.c~sysv-do-sysctl-strategies0 ipc/sem.c diff -puN ipc/shm.c~sysv-do-sysctl-strategies0 ipc/shm.c diff -puN ipc/util.c~sysv-do-sysctl-strategies0 ipc/util.c diff -puN kernel/sysctl.c~sysv-do-sysctl-strategies0 kernel/sysctl.c --- work/kernel/sysctl.c~sysv-do-sysctl-strategies0 2006-04-18 17:06:49.000000000 -0700 +++ work-dave/kernel/sysctl.c 2006-04-18 17:13:06.000000000 -0700 @@ -1251,6 +1251,35 @@ repeat: return -ENOTDIR; } +int default_sysctl_strategy(ctl_table *table, void *data, + void __user *oldval, size_t __user *oldlenp, + void __user *newval, size_t newlen) +{ + size_t len; + if (data && table->maxlen) { + if (oldval && oldlenp) { + if (get_user(len, oldlenp)) + return -EFAULT; + if (len) { + if (len > table->maxlen) + len = table->maxlen; + if(copy_to_user(oldval, data, len)) + return -EFAULT; + if(put_user(len, oldlenp)) + return -EFAULT; + } + } + if (newval && newlen) { + len = newlen; + if (len > table->maxlen) + len = table->maxlen; + if(copy_from_user(data, newval, len)) + return -EFAULT; + } + } + return 0; +} + /* Perform the actual read/write of a sysctl table entry. */ int do_sysctl_strategy (ctl_table *table, int __user *name, int nlen, @@ -1258,7 +1287,6 @@ int do_sysctl_strategy (ctl_table *table void __user *newval, size_t newlen, void **context) { int op = 0, rc; - size_t len; if (oldval) op |= 004; @@ -1275,31 +1303,10 @@ int do_sysctl_strategy (ctl_table *table if (rc > 0) return 0; } - /* If there is no strategy routine, or if the strategy returns * zero, proceed with automatic r/w */ - if (table->data && table->maxlen) { - if (oldval && oldlenp) { - if (get_user(len, oldlenp)) - return -EFAULT; - if (len) { - if (len > table->maxlen) - len = table->maxlen; - if(copy_to_user(oldval, table->data, len)) - return -EFAULT; - if(put_user(len, oldlenp)) - return -EFAULT; - } - } - if (newval && newlen) { - len = newlen; - if (len > table->maxlen) - len = table->maxlen; - if(copy_from_user(table->data, newval, len)) - return -EFAULT; - } - } - return 0; + return default_sysctl_strategy(table, table->data, oldval,oldlenp, + newval, newlen); } /** diff -puN drivers/char/random.c~sysv-do-sysctl-strategies0 drivers/char/random.c diff -puN include/linux/sysctl.h~sysv-do-sysctl-strategies0 include/linux/sysctl.h --- work/include/linux/sysctl.h~sysv-do-sysctl-strategies0 2006-04-18 17:13:37.000000000 -0700 +++ work-dave/include/linux/sysctl.h 2006-04-18 17:14:40.000000000 -0700 @@ -945,6 +945,10 @@ extern int do_sysctl_strategy (ctl_table void __user *oldval, size_t __user *oldlenp, void __user *newval, size_t newlen, void ** context); +extern int default_sysctl_strategy(ctl_table *table, void *data, + void __user *oldval, size_t __user *oldlenp, + void __user *newval, size_t newlen); + extern ctl_handler sysctl_string; extern ctl_handler sysctl_intvec; extern ctl_handler sysctl_jiffies; _ ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 4/5] utsname namespaces: sysctl hack 2006-04-19 16:23 ` Dave Hansen @ 2006-04-19 16:52 ` Eric W. Biederman 2006-04-19 17:19 ` Dave Hansen 0 siblings, 1 reply; 50+ messages in thread From: Eric W. Biederman @ 2006-04-19 16:52 UTC (permalink / raw) To: Dave Hansen Cc: Serge E. Hallyn, Kirill Korotaev, linux-kernel, herbert, devel, sam, xemul, James Morris Dave Hansen <haveblue@us.ibm.com> writes: > Besides ipc and utsnames, can anybody think of some other things in > sysctl that we really need to virtualize? All of the networking entries. > It seems to me that most of the other stuff is kernel-global and we > simply won't allow anything in a container to touch it. > > That said, there may be things in the future that need to get added as > we separate out different subsystems. Things like min_free_kbytes could > have a container-centric meaning (although I think that is probably a > really bad one to mess with). > > I have a slightly revamped way of doing the sysv namespace sysctl code. > I've attached a couple of (still pretty raw) patches. Do these still > fall in the "hacks" category? Only in that you attacked the wrong piece of the puzzle. The strategy table entries simply need to die, or be rewritten to use the appropriate proc entries. The proc entries are the real interface, and the two pieces don't share an implementation unfortunately. Eric ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 4/5] utsname namespaces: sysctl hack 2006-04-19 16:52 ` Eric W. Biederman @ 2006-04-19 17:19 ` Dave Hansen 2006-04-19 17:37 ` Eric W. Biederman 2006-04-19 17:48 ` Eric W. Biederman 0 siblings, 2 replies; 50+ messages in thread From: Dave Hansen @ 2006-04-19 17:19 UTC (permalink / raw) To: Eric W. Biederman Cc: Serge E. Hallyn, Kirill Korotaev, linux-kernel, herbert, devel, sam, xemul, James Morris On Wed, 2006-04-19 at 10:52 -0600, Eric W. Biederman wrote: > Dave Hansen <haveblue@us.ibm.com> writes: > > > Besides ipc and utsnames, can anybody think of some other things in > > sysctl that we really need to virtualize? > > All of the networking entries. ... > Only in that you attacked the wrong piece of the puzzle. > The strategy table entries simply need to die, or be rewritten > to use the appropriate proc entries. If we are limited to ipc, utsname, and network, I'd be worried trying to justify _too_ much infrastructure. The network namespaces are not going to be solved any time soon. Why not have something like this which is a quite simple, understandable, minor hack? > The proc entries are the real interface, and the two pieces > don't share an implementation unfortunately. You're saying that the proc interface doesn't use the ->strategy entry? That isn't what I remember, but I could be completely wrong. -- Dave ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 4/5] utsname namespaces: sysctl hack 2006-04-19 17:19 ` Dave Hansen @ 2006-04-19 17:37 ` Eric W. Biederman 2006-04-19 17:48 ` Eric W. Biederman 1 sibling, 0 replies; 50+ messages in thread From: Eric W. Biederman @ 2006-04-19 17:37 UTC (permalink / raw) To: Dave Hansen Cc: Serge E. Hallyn, Kirill Korotaev, linux-kernel, herbert, devel, sam, xemul, James Morris Dave Hansen <haveblue@us.ibm.com> writes: > On Wed, 2006-04-19 at 10:52 -0600, Eric W. Biederman wrote: >> Dave Hansen <haveblue@us.ibm.com> writes: >> >> > Besides ipc and utsnames, can anybody think of some other things in >> > sysctl that we really need to virtualize? >> >> All of the networking entries. > ... >> Only in that you attacked the wrong piece of the puzzle. >> The strategy table entries simply need to die, or be rewritten >> to use the appropriate proc entries. > > If we are limited to ipc, utsname, and network, I'd be worried trying to > justify _too_ much infrastructure. The network namespaces are not going > to be solved any time soon. Why not have something like this which is a > quite simple, understandable, minor hack? Because it doesn't affect what happens in /proc/sys ! Strategy routines only affect sys_sysctl. As strategy routines I have no real problems with them. I haven't looked terribly closely yet. >> The proc entries are the real interface, and the two pieces >> don't share an implementation unfortunately. > > You're saying that the proc interface doesn't use the ->strategy entry? > That isn't what I remember, but I could be completely wrong. Exactly. I have a patch I will be sending out shortly that make sys_sysctl a compile time option (so we can seriously start killing it) and it compiles out the strategy routines and /proc/sys still works :) Eric ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 4/5] utsname namespaces: sysctl hack 2006-04-19 17:19 ` Dave Hansen 2006-04-19 17:37 ` Eric W. Biederman @ 2006-04-19 17:48 ` Eric W. Biederman 1 sibling, 0 replies; 50+ messages in thread From: Eric W. Biederman @ 2006-04-19 17:48 UTC (permalink / raw) To: Dave Hansen Cc: Serge E. Hallyn, Kirill Korotaev, linux-kernel, herbert, devel, sam, xemul, James Morris Dave Hansen <haveblue@us.ibm.com> writes: > On Wed, 2006-04-19 at 10:52 -0600, Eric W. Biederman wrote: >> Dave Hansen <haveblue@us.ibm.com> writes: >> >> > Besides ipc and utsnames, can anybody think of some other things in >> > sysctl that we really need to virtualize? >> >> All of the networking entries. > ... >> Only in that you attacked the wrong piece of the puzzle. >> The strategy table entries simply need to die, or be rewritten >> to use the appropriate proc entries. > > If we are limited to ipc, utsname, and network, I'd be worried trying to > justify _too_ much infrastructure. The network namespaces are not going > to be solved any time soon. Why not have something like this which is a > quite simple, understandable, minor hack? As for the network namespaces. It actually isn't that hard, but it is tedious and big. Once we get ipc and uts it will probably be the namespace to merge. I have the basic code sitting out on a branch. Getting the little things like sysctl, sorted out are the primary problems. At the same time we don't have to solve the problems for the network namespace now. Just don't expect it way of in the indefinite future, either. Eric ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 4/5] utsname namespaces: sysctl hack 2006-04-19 15:17 ` Kirill Korotaev 2006-04-19 15:21 ` Serge E. Hallyn @ 2006-04-19 15:29 ` Eric W. Biederman 2006-04-19 17:51 ` Serge E. Hallyn 1 sibling, 1 reply; 50+ messages in thread From: Eric W. Biederman @ 2006-04-19 15:29 UTC (permalink / raw) To: Kirill Korotaev Cc: Serge E. Hallyn, linux-kernel, herbert, devel, sam, xemul, James Morris Kirill Korotaev <dev@sw.ru> writes: > Serge, > > can we do nothing with sysctls at this moment, instead of commiting hacks? Except that we modify a static table changing the uts behaviour in proc_doutsstring isn't all that bad. I'm just about to start on something more comprehensive, in the sysctl case. Eric ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 4/5] utsname namespaces: sysctl hack 2006-04-19 15:29 ` Eric W. Biederman @ 2006-04-19 17:51 ` Serge E. Hallyn 2006-04-19 18:27 ` Eric W. Biederman 0 siblings, 1 reply; 50+ messages in thread From: Serge E. Hallyn @ 2006-04-19 17:51 UTC (permalink / raw) To: Eric W. Biederman Cc: Kirill Korotaev, Serge E. Hallyn, linux-kernel, herbert, devel, sam, xemul, James Morris Quoting Eric W. Biederman (ebiederm@xmission.com): > Kirill Korotaev <dev@sw.ru> writes: > > > Serge, > > > > can we do nothing with sysctls at this moment, instead of commiting hacks? > > Except that we modify a static table changing the uts behaviour in > proc_doutsstring isn't all that bad. > > I'm just about to start on something more comprehensive, in > the sysctl case. So assuming that I take out the switch(), leaving that for a better solution by Eric (or Dave, or whoever), Is it time to ask for the utsname namespace patch to be tried out in -mm? thanks, -serge ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 4/5] utsname namespaces: sysctl hack 2006-04-19 17:51 ` Serge E. Hallyn @ 2006-04-19 18:27 ` Eric W. Biederman 2006-04-19 20:24 ` Serge E. Hallyn 2006-04-19 21:44 ` Sam Vilain 0 siblings, 2 replies; 50+ messages in thread From: Eric W. Biederman @ 2006-04-19 18:27 UTC (permalink / raw) To: Serge E. Hallyn Cc: Kirill Korotaev, linux-kernel, herbert, devel, sam, xemul, James Morris "Serge E. Hallyn" <serue@us.ibm.com> writes: > Quoting Eric W. Biederman (ebiederm@xmission.com): >> Kirill Korotaev <dev@sw.ru> writes: >> >> > Serge, >> > >> > can we do nothing with sysctls at this moment, instead of commiting hacks? >> >> Except that we modify a static table changing the uts behaviour in >> proc_doutsstring isn't all that bad. >> >> I'm just about to start on something more comprehensive, in >> the sysctl case. > > So assuming that I take out the switch(), leaving that for a better > solution by Eric (or Dave, or whoever), > > Is it time to ask for the utsname namespace patch to be tried out > in -mm? Can we please suggest a syscall interface? Eric ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 4/5] utsname namespaces: sysctl hack 2006-04-19 18:27 ` Eric W. Biederman @ 2006-04-19 20:24 ` Serge E. Hallyn 2006-04-19 21:44 ` Sam Vilain 1 sibling, 0 replies; 50+ messages in thread From: Serge E. Hallyn @ 2006-04-19 20:24 UTC (permalink / raw) To: Eric W. Biederman Cc: Serge E. Hallyn, Kirill Korotaev, linux-kernel, herbert, devel, sam, xemul, James Morris Quoting Eric W. Biederman (ebiederm@xmission.com): > "Serge E. Hallyn" <serue@us.ibm.com> writes: > > > Quoting Eric W. Biederman (ebiederm@xmission.com): > >> Kirill Korotaev <dev@sw.ru> writes: > >> > >> > Serge, > >> > > >> > can we do nothing with sysctls at this moment, instead of commiting hacks? > >> > >> Except that we modify a static table changing the uts behaviour in > >> proc_doutsstring isn't all that bad. > >> > >> I'm just about to start on something more comprehensive, in > >> the sysctl case. > > > > So assuming that I take out the switch(), leaving that for a better > > solution by Eric (or Dave, or whoever), > > > > Is it time to ask for the utsname namespace patch to be tried out > > in -mm? > > Can we please suggest a syscall interface? We can, but I was hoping that would be a separate patch, separate discussion. Are you asking for a new syscall, specifically to unshare utsname()? Or for discussion over whether we want to do one syscall per namespace extend CLONE_NEWns flags use unshare use namespacefs -serge ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 4/5] utsname namespaces: sysctl hack 2006-04-19 18:27 ` Eric W. Biederman 2006-04-19 20:24 ` Serge E. Hallyn @ 2006-04-19 21:44 ` Sam Vilain 2006-04-20 17:05 ` Serge E. Hallyn 2006-04-25 22:00 ` Serge E. Hallyn 1 sibling, 2 replies; 50+ messages in thread From: Sam Vilain @ 2006-04-19 21:44 UTC (permalink / raw) To: Eric W. Biederman Cc: Serge E. Hallyn, Kirill Korotaev, linux-kernel, herbert, devel, xemul, James Morris Eric W. Biederman wrote: >>Is it time to ask for the utsname namespace patch to be tried out >>in -mm? >> >> > >Can we please suggest a syscall interface? > > What was wrong with the method of the one I posted / extracted from the Linux-VServer project? I mean, apart from the baggage which I intend to remove for the next posting. The concept was - have a single syscall with versioned subcommands. We can throw all of the namespace syscalls in there. Sam. ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 4/5] utsname namespaces: sysctl hack 2006-04-19 21:44 ` Sam Vilain @ 2006-04-20 17:05 ` Serge E. Hallyn 2006-04-25 22:00 ` Serge E. Hallyn 1 sibling, 0 replies; 50+ messages in thread From: Serge E. Hallyn @ 2006-04-20 17:05 UTC (permalink / raw) To: Sam Vilain Cc: Eric W. Biederman, Serge E. Hallyn, Kirill Korotaev, linux-kernel, herbert, devel, xemul, James Morris Quoting Sam Vilain (sam@vilain.net): > Eric W. Biederman wrote: > > >>Is it time to ask for the utsname namespace patch to be tried out > >>in -mm? > >> > >> > > > >Can we please suggest a syscall interface? > > > > > > What was wrong with the method of the one I posted / extracted from the > Linux-VServer project? I mean, apart from the baggage which I intend to > remove for the next posting. > > The concept was - have a single syscall with versioned subcommands. We > can throw all of the namespace syscalls in there. > > Sam. Well IIUC on the whole having one syscall multiplexing onto various commands is frowned upon. But please resubmit when you're ready, and we'll see what ppl think of it. Can you have a version on top of my utsname patches, hooking into the utsname unsharing fn? thanks, -serge ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 4/5] utsname namespaces: sysctl hack 2006-04-19 21:44 ` Sam Vilain 2006-04-20 17:05 ` Serge E. Hallyn @ 2006-04-25 22:00 ` Serge E. Hallyn 2006-04-26 4:09 ` Sam Vilain 1 sibling, 1 reply; 50+ messages in thread From: Serge E. Hallyn @ 2006-04-25 22:00 UTC (permalink / raw) To: Sam Vilain Cc: Eric W. Biederman, Serge E. Hallyn, Kirill Korotaev, linux-kernel, herbert, devel, xemul, James Morris Quoting Sam Vilain (sam@vilain.net): > Eric W. Biederman wrote: > > >>Is it time to ask for the utsname namespace patch to be tried out > >>in -mm? > >> > >> > > > >Can we please suggest a syscall interface? Eric, Did you have any ideas for how you'd want to interface to look? Are you fine with the vserver approach? > What was wrong with the method of the one I posted / extracted from the > Linux-VServer project? I mean, apart from the baggage which I intend to > remove for the next posting. Sam, Are you working on a next posting? -serge ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 4/5] utsname namespaces: sysctl hack 2006-04-25 22:00 ` Serge E. Hallyn @ 2006-04-26 4:09 ` Sam Vilain 2006-04-26 10:28 ` Christoph Hellwig 2006-04-27 12:32 ` Eric W. Biederman 0 siblings, 2 replies; 50+ messages in thread From: Sam Vilain @ 2006-04-26 4:09 UTC (permalink / raw) To: Serge E. Hallyn; +Cc: linux-kernel, ebiederm Serge E. Hallyn wrote: >>>Can we please suggest a syscall interface? >>> >>> > >Eric, > >Did you have any ideas for how you'd want to interface to look? Are >you fine with the vserver approach? > > Eric has said that his understanding was that syscall switches (ie, syscalls with subcommands) were bad form. I understand the concern, but I think while it's still in prototype stages, that it's a sensible and pragmatic approach. Once individual subcommands are "finalised" then they can be split out into a seperate syscall, and any level of backwards compatibility can be maintained by whoever needs it. >>What was wrong with the method of the one I posted / extracted from the >>Linux-VServer project? I mean, apart from the baggage which I intend to >>remove for the next posting. >> >> > >Are you working on a next posting? > > I've been a bit backlogged of late. I'll put some time towards it this week, of course patches are always welcome and will find a home on utsl :). Sam. ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 4/5] utsname namespaces: sysctl hack 2006-04-26 4:09 ` Sam Vilain @ 2006-04-26 10:28 ` Christoph Hellwig 2006-04-27 12:32 ` Eric W. Biederman 1 sibling, 0 replies; 50+ messages in thread From: Christoph Hellwig @ 2006-04-26 10:28 UTC (permalink / raw) To: Sam Vilain; +Cc: Serge E. Hallyn, linux-kernel, ebiederm On Wed, Apr 26, 2006 at 04:09:01PM +1200, Sam Vilain wrote: > Eric has said that his understanding was that syscall switches (ie, > syscalls with subcommands) were bad form. It's not just Eric, it's common sense and pretty broad consensus. ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 4/5] utsname namespaces: sysctl hack 2006-04-26 4:09 ` Sam Vilain 2006-04-26 10:28 ` Christoph Hellwig @ 2006-04-27 12:32 ` Eric W. Biederman 1 sibling, 0 replies; 50+ messages in thread From: Eric W. Biederman @ 2006-04-27 12:32 UTC (permalink / raw) To: Sam Vilain; +Cc: Serge E. Hallyn, linux-kernel Sam Vilain <sam@vilain.net> writes: > Serge E. Hallyn wrote: > >>>>Can we please suggest a syscall interface? >>>> >>>> >> >>Eric, >> >>Did you have any ideas for how you'd want to interface to look? Are >>you fine with the vserver approach? My preference is for a clone/unshare flag. My second preference would be a new syscall that simply creates the interface. The important point is that we have something that works and solves the subset of the problem we are working on. > Eric has said that his understanding was that syscall switches (ie, > syscalls with subcommands) were bad form. > > I understand the concern, but I think while it's still in prototype > stages, that it's a sensible and pragmatic approach. Once individual > subcommands are "finalised" then they can be split out into a seperate > syscall, and any level of backwards compatibility can be maintained by > whoever needs it. This is a key point. We are not in prototype stage. Linux-Vserver, OpenVZ and other less polished implementations work have already provided that. Where we are now is implementing well understood subsets of the problem in a way that everyone can use. So all that really matters is an interface that is good enough for the current subset. Since each subset of the problem can stand on it's own we can give it a very thorough technical review. Eric ^ permalink raw reply [flat|nested] 50+ messages in thread
* [RFC][PATCH 1/5] uts namespaces: Implement utsname namespaces 2006-04-07 18:36 [RFC][PATCH 0/5] uts namespaces: Introduction Serge E. Hallyn ` (3 preceding siblings ...) 2006-04-07 18:36 ` [RFC][PATCH 4/5] utsname namespaces: sysctl hack Serge E. Hallyn @ 2006-04-07 18:36 ` Serge E. Hallyn 2006-04-07 19:13 ` Sam Ravnborg ` (3 more replies) 2006-04-07 19:06 ` [RFC][PATCH 0/5] uts namespaces: Introduction Eric W. Biederman 2006-04-11 12:32 ` Kirill Korotaev 6 siblings, 4 replies; 50+ messages in thread From: Serge E. Hallyn @ 2006-04-07 18:36 UTC (permalink / raw) To: linux-kernel, Kirill Korotaev, herbert, devel, sam, Eric W. Biederman, xemul, devel, James Morris This patch defines the uts namespace and some manipulators. Adds the uts namespace to task_struct, and initializes a system-wide init namespace which will continue to be used when it makes sense. Signed-off-by: Serge E. Hallyn <serue@us.ibm.com> --- include/linux/init_task.h | 2 + include/linux/sched.h | 2 + include/linux/utsname.h | 40 +++++++++++++++++++++++++- init/Kconfig | 8 +++++ init/version.c | 70 ++++++++++++++++++++++++++++++++++++++++----- kernel/exit.c | 2 + kernel/fork.c | 9 +++++- 7 files changed, 122 insertions(+), 11 deletions(-) 14c326d603d88d9ed40a1ddafbf23fc3da68a645 diff --git a/include/linux/init_task.h b/include/linux/init_task.h index 41ecbb8..21b1751 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h @@ -3,6 +3,7 @@ #include <linux/file.h> #include <linux/rcupdate.h> +#include <linux/utsname.h> #define INIT_FDTABLE \ { \ @@ -123,6 +124,7 @@ extern struct group_info init_groups; .journal_info = NULL, \ .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \ .fs_excl = ATOMIC_INIT(0), \ + .uts_ns = &init_uts_ns, \ } diff --git a/include/linux/sched.h b/include/linux/sched.h index 541f482..97c7990 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -684,6 +684,7 @@ static inline void prefetch_stack(struct struct audit_context; /* See audit.c */ struct mempolicy; +struct uts_namespace; enum sleep_type { SLEEP_NORMAL, @@ -807,6 +808,7 @@ struct task_struct { struct files_struct *files; /* namespace */ struct namespace *namespace; + struct uts_namespace *uts_ns; /* signal handlers */ struct signal_struct *signal; struct sighand_struct *sighand; diff --git a/include/linux/utsname.h b/include/linux/utsname.h index 13e1da0..cc28ac5 100644 --- a/include/linux/utsname.h +++ b/include/linux/utsname.h @@ -1,5 +1,8 @@ #ifndef _LINUX_UTSNAME_H #define _LINUX_UTSNAME_H +#include <linux/sched.h> +#include <linux/kref.h> +#include <asm/atomic.h> #define __OLD_UTS_LEN 8 @@ -30,7 +33,42 @@ struct new_utsname { char domainname[65]; }; -extern struct new_utsname system_utsname; +struct uts_namespace { + struct kref kref; + struct new_utsname name; +}; +extern struct uts_namespace init_uts_ns; + +#ifdef CONFIG_UTS_NS + +extern struct uts_namespace *clone_uts_ns(struct uts_namespace *old_ns); +extern struct uts_namespace *unshare_uts_ns(void); +extern void free_uts_ns(struct kref *kref); + +static inline void get_uts_ns(struct uts_namespace *ns) +{ + kref_get(&ns->kref); +} + +static inline void put_uts_ns(struct uts_namespace *ns) +{ + kref_put(&ns->kref, free_uts_ns); +} + +#else +static inline void get_uts_ns(struct uts_namespace *ns) +{ +} +static inline void put_uts_ns(struct uts_namespace *ns) +{ +} +#endif + +static inline struct new_utsname *utsname(void) +{ + return ¤t->uts_ns->name; +} + extern struct rw_semaphore uts_sem; #endif diff --git a/init/Kconfig b/init/Kconfig index 3b36a1d..8460e5a 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -166,6 +166,14 @@ config SYSCTL building a kernel for install/rescue disks or your system is very limited in memory. +config UTS_NS + bool "UTS Namespaces" + default n + help + Support uts namespaces. This allows containers, i.e. + vservers, to use uts namespaces to provide different + uts info for different servers. If unsure, say N. + config AUDIT bool "Auditing support" depends on NET diff --git a/init/version.c b/init/version.c index 3ddc3ce..e128d72 100644 --- a/init/version.c +++ b/init/version.c @@ -11,22 +11,76 @@ #include <linux/uts.h> #include <linux/utsname.h> #include <linux/version.h> +#include <linux/sched.h> #define version(a) Version_ ## a #define version_string(a) version(a) int version_string(LINUX_VERSION_CODE); -struct new_utsname system_utsname = { - .sysname = UTS_SYSNAME, - .nodename = UTS_NODENAME, - .release = UTS_RELEASE, - .version = UTS_VERSION, - .machine = UTS_MACHINE, - .domainname = UTS_DOMAINNAME, +struct uts_namespace init_uts_ns = { + .kref = { + .refcount = ATOMIC_INIT(2), + }, + .name = { + .sysname = UTS_SYSNAME, + .nodename = UTS_NODENAME, + .release = UTS_RELEASE, + .version = UTS_VERSION, + .machine = UTS_MACHINE, + .domainname = UTS_DOMAINNAME, + }, }; -EXPORT_SYMBOL(system_utsname); +#ifdef CONFIG_UTS_NS +/* + * Clone a new ns copying an original utsname, setting refcount to 1 + * @old_ns: namespace to clone + * Return NULL on error (failure to kmalloc), new ns otherwise + */ +struct uts_namespace *clone_uts_ns(struct uts_namespace *old_ns) +{ + struct uts_namespace *ns; + + ns = kmalloc(sizeof(struct uts_namespace), GFP_KERNEL); + if (ns) { + memcpy(&ns->name, &old_ns->name, sizeof(ns->name)); + kref_init(&ns->kref); + } + return ns; +} + +/* + * unshare the current process' utsname namespace. Changes + * to the utsname of this process won't be seen by parent, and + * vice versa + * + * Return NULL on error (failure to kmalloc), new ns otherwise + * + * TODO: decide where this should be locked (depends on how/where + * we decide to use this) + */ +struct uts_namespace *unshare_uts_ns(void) +{ + struct uts_namespace *old_ns = current->uts_ns; + struct uts_namespace *new_ns = clone_uts_ns(old_ns); + if (new_ns) { + current->uts_ns = new_ns; + put_uts_ns(old_ns); + } + return new_ns; +} +EXPORT_SYMBOL(unshare_uts_ns); + +void free_uts_ns(struct kref *kref) +{ + struct uts_namespace *ns; + + ns = container_of(kref, struct uts_namespace, kref); + kfree(ns); +} +EXPORT_SYMBOL(free_uts_ns); +#endif const char linux_banner[] = "Linux version " UTS_RELEASE " (" LINUX_COMPILE_BY "@" diff --git a/kernel/exit.c b/kernel/exit.c index 6c2eeb8..97c5405 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -34,6 +34,7 @@ #include <linux/mutex.h> #include <linux/futex.h> #include <linux/compat.h> +#include <linux/utsname.h> #include <asm/uaccess.h> #include <asm/unistd.h> @@ -173,6 +174,7 @@ repeat: spin_unlock(&p->proc_lock); proc_pid_flush(proc_dentry); release_thread(p); + put_uts_ns(p->uts_ns); call_rcu(&p->rcu, delayed_put_task_struct); p = leader; diff --git a/kernel/fork.c b/kernel/fork.c index 3384eb8..62e4479 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -44,6 +44,7 @@ #include <linux/rmap.h> #include <linux/acct.h> #include <linux/cn_proc.h> +#include <linux/utsname.h> #include <asm/pgtable.h> #include <asm/pgalloc.h> @@ -1119,6 +1120,8 @@ static task_t *copy_process(unsigned lon /* Perform scheduler related setup. Assign this task to a CPU. */ sched_fork(p, clone_flags); + get_uts_ns(p->uts_ns); + /* Need tasklist lock for parent etc handling! */ write_lock_irq(&tasklist_lock); @@ -1158,7 +1161,7 @@ static task_t *copy_process(unsigned lon spin_unlock(¤t->sighand->siglock); write_unlock_irq(&tasklist_lock); retval = -ERESTARTNOINTR; - goto bad_fork_cleanup_namespace; + goto bad_fork_cleanup_utsns; } if (clone_flags & CLONE_THREAD) { @@ -1171,7 +1174,7 @@ static task_t *copy_process(unsigned lon spin_unlock(¤t->sighand->siglock); write_unlock_irq(&tasklist_lock); retval = -EAGAIN; - goto bad_fork_cleanup_namespace; + goto bad_fork_cleanup_utsns; } p->group_leader = current->group_leader; @@ -1223,6 +1226,8 @@ static task_t *copy_process(unsigned lon proc_fork_connector(p); return p; +bad_fork_cleanup_utsns: + put_uts_ns(p->uts_ns); bad_fork_cleanup_namespace: exit_namespace(p); bad_fork_cleanup_keys: -- 1.2.4 ^ permalink raw reply related [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 1/5] uts namespaces: Implement utsname namespaces 2006-04-07 18:36 ` [RFC][PATCH 1/5] uts namespaces: Implement utsname namespaces Serge E. Hallyn @ 2006-04-07 19:13 ` Sam Ravnborg 2006-04-07 19:20 ` Serge E. Hallyn 2006-04-07 19:39 ` Serge E. Hallyn 2006-04-07 20:47 ` James Morris ` (2 subsequent siblings) 3 siblings, 2 replies; 50+ messages in thread From: Sam Ravnborg @ 2006-04-07 19:13 UTC (permalink / raw) To: Serge E. Hallyn Cc: linux-kernel, Kirill Korotaev, herbert, devel, sam, Eric W. Biederman, xemul, James Morris On Fri, Apr 07, 2006 at 01:36:00PM -0500, Serge E. Hallyn wrote: > This patch defines the uts namespace and some manipulators. > Adds the uts namespace to task_struct, and initializes a > system-wide init namespace which will continue to be used when > it makes sense. It also kills system_utsname so you left the kernel uncompileable. Can you kill it later? > diff --git a/include/linux/utsname.h b/include/linux/utsname.h > index 13e1da0..cc28ac5 100644 > --- a/include/linux/utsname.h > +++ b/include/linux/utsname.h > @@ -1,5 +1,8 @@ > #ifndef _LINUX_UTSNAME_H > #define _LINUX_UTSNAME_H You can kill this include > +#include <linux/sched.h> if you move this static inline to sched.h + > +static inline struct new_utsname *utsname(void) > +{ > + return ¤t->uts_ns->name; > +} And since it operates on ¤t that may make sense. Sam ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 1/5] uts namespaces: Implement utsname namespaces 2006-04-07 19:13 ` Sam Ravnborg @ 2006-04-07 19:20 ` Serge E. Hallyn 2006-04-07 19:39 ` Serge E. Hallyn 1 sibling, 0 replies; 50+ messages in thread From: Serge E. Hallyn @ 2006-04-07 19:20 UTC (permalink / raw) To: Sam Ravnborg Cc: Serge E. Hallyn, linux-kernel, Kirill Korotaev, herbert, devel, sam, Eric W. Biederman, xemul, James Morris, serge Quoting Sam Ravnborg (sam@ravnborg.org): > On Fri, Apr 07, 2006 at 01:36:00PM -0500, Serge E. Hallyn wrote: > > This patch defines the uts namespace and some manipulators. > > Adds the uts namespace to task_struct, and initializes a > > system-wide init namespace which will continue to be used when > > it makes sense. > It also kills system_utsname so you left the kernel uncompileable. > Can you kill it later? I can insert a #define system_utsname (init_uts_ns.name) in patch 1 and nuke it at patch 3. -serge ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 1/5] uts namespaces: Implement utsname namespaces 2006-04-07 19:13 ` Sam Ravnborg 2006-04-07 19:20 ` Serge E. Hallyn @ 2006-04-07 19:39 ` Serge E. Hallyn 1 sibling, 0 replies; 50+ messages in thread From: Serge E. Hallyn @ 2006-04-07 19:39 UTC (permalink / raw) To: Sam Ravnborg Cc: Serge E. Hallyn, linux-kernel, Kirill Korotaev, herbert, devel, sam, Eric W. Biederman, xemul, James Morris Quoting Sam Ravnborg (sam@ravnborg.org): > > diff --git a/include/linux/utsname.h b/include/linux/utsname.h > > index 13e1da0..cc28ac5 100644 > > --- a/include/linux/utsname.h > > +++ b/include/linux/utsname.h > > @@ -1,5 +1,8 @@ > > #ifndef _LINUX_UTSNAME_H > > #define _LINUX_UTSNAME_H > You can kill this include > > +#include <linux/sched.h> > > if you move this static inline to sched.h > + > > +static inline struct new_utsname *utsname(void) > > +{ > > + return ¤t->uts_ns->name; > > +} > And since it operates on ¤t that may make sense. I had it there originally. Don't mind moving it back if that seems more appropriate, but of course then we'll need to #include <linux/utsname.h> in sched.h, since we need to know struct uts_ns to get uts_ns->name. So is moving it to sched.h the way to go? thanks, -serge ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 1/5] uts namespaces: Implement utsname namespaces 2006-04-07 18:36 ` [RFC][PATCH 1/5] uts namespaces: Implement utsname namespaces Serge E. Hallyn 2006-04-07 19:13 ` Sam Ravnborg @ 2006-04-07 20:47 ` James Morris 2006-04-07 22:13 ` Serge E. Hallyn 2006-04-08 13:44 ` Andi Kleen 2006-04-08 13:45 ` Andi Kleen 3 siblings, 1 reply; 50+ messages in thread From: James Morris @ 2006-04-07 20:47 UTC (permalink / raw) To: Serge E. Hallyn Cc: linux-kernel, Kirill Korotaev, herbert, devel, sam, Eric W. Biederman, xemul, devel On Fri, 7 Apr 2006, Serge E. Hallyn wrote: > +EXPORT_SYMBOL(unshare_uts_ns); > +EXPORT_SYMBOL(free_uts_ns); Why not EXPORT_SYMBOL_GPL? What do you expect the user api to look like, a syscall? Probably need to think about LSM hooks for creating and updating the namespaces. - James -- James Morris <jmorris@namei.org> ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 1/5] uts namespaces: Implement utsname namespaces 2006-04-07 20:47 ` James Morris @ 2006-04-07 22:13 ` Serge E. Hallyn 0 siblings, 0 replies; 50+ messages in thread From: Serge E. Hallyn @ 2006-04-07 22:13 UTC (permalink / raw) To: James Morris Cc: Serge E. Hallyn, linux-kernel, Kirill Korotaev, herbert, devel, sam, Eric W. Biederman, xemul Quoting James Morris (jmorris@namei.org): > On Fri, 7 Apr 2006, Serge E. Hallyn wrote: > > > > +EXPORT_SYMBOL(unshare_uts_ns); > > +EXPORT_SYMBOL(free_uts_ns); > > Why not EXPORT_SYMBOL_GPL? Actually come to think of it they don't need to be exported. I will move the exports to the last, debugging, patch. > What do you expect the user api to look like, a syscall? This remains to be determined, and this patchset purposely doesn't address it. AFAIU, the two most likely options are extending clone and unshare, and using new syscalls. Whatever is decided for the other namespaces, this should use. With this patchset (minus the last patch for debugging) uts namespaces are supported, but processes can't clone their uts namespace yet. > Probably need to think about LSM hooks for creating and updating the > namespaces. True, that is something that needs to be discussed when the topic of how to implement unsharing comes up again. thanks, -serge ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 1/5] uts namespaces: Implement utsname namespaces 2006-04-07 18:36 ` [RFC][PATCH 1/5] uts namespaces: Implement utsname namespaces Serge E. Hallyn 2006-04-07 19:13 ` Sam Ravnborg 2006-04-07 20:47 ` James Morris @ 2006-04-08 13:44 ` Andi Kleen 2006-04-08 13:45 ` Andi Kleen 3 siblings, 0 replies; 50+ messages in thread From: Andi Kleen @ 2006-04-08 13:44 UTC (permalink / raw) Cc: linux-kernel "Serge E. Hallyn" <serue@us.ibm.com> writes: > This patch defines the uts namespace and some manipulators. > Adds the uts namespace to task_struct, and initializes a > system-wide init namespace which will continue to be used when > it makes sense. So to get this straight - you want to add a new pointer to task_struct for each possible virtualized entity? After you're doing by how many bytes will task_struct be bloated? I don't think that's a very good approach because you'll crank up the per thread memory overhead which is already far too big in Linux. Also it adds cache foot print and generally makes things slower. If anything I would request using a proxy data structure that contains all the virtualized namespaces for a set of processes. And give each task only has a single pointer to one of these. -Andi ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 1/5] uts namespaces: Implement utsname namespaces 2006-04-07 18:36 ` [RFC][PATCH 1/5] uts namespaces: Implement utsname namespaces Serge E. Hallyn ` (2 preceding siblings ...) 2006-04-08 13:44 ` Andi Kleen @ 2006-04-08 13:45 ` Andi Kleen 2006-04-08 20:28 ` Serge E. Hallyn 3 siblings, 1 reply; 50+ messages in thread From: Andi Kleen @ 2006-04-08 13:45 UTC (permalink / raw) To: Serge E. Hallyn; +Cc: linux-kernel "Serge E. Hallyn" <serue@us.ibm.com> writes: > This patch defines the uts namespace and some manipulators. > Adds the uts namespace to task_struct, and initializes a > system-wide init namespace which will continue to be used when > it makes sense. So to get this straight - you want to add a new pointer to task_struct for each possible virtualized entity? After you're doing by how many bytes will task_struct be bloated? I don't think that's a very good approach because you'll crank up the per thread memory overhead which is already far too big in Linux. Also it adds cache foot print and generally makes things slower. If anything I would request using a proxy data structure that contains all the virtualized namespaces for a set of processes. And give each task only has a single pointer to one of these. -Andi ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 1/5] uts namespaces: Implement utsname namespaces 2006-04-08 13:45 ` Andi Kleen @ 2006-04-08 20:28 ` Serge E. Hallyn 2006-04-09 6:00 ` Andi Kleen 0 siblings, 1 reply; 50+ messages in thread From: Serge E. Hallyn @ 2006-04-08 20:28 UTC (permalink / raw) To: Andi Kleen; +Cc: Serge E. Hallyn, linux-kernel Quoting Andi Kleen (ak@suse.de): > "Serge E. Hallyn" <serue@us.ibm.com> writes: > > > This patch defines the uts namespace and some manipulators. > > Adds the uts namespace to task_struct, and initializes a > > system-wide init namespace which will continue to be used when > > it makes sense. > > So to get this straight - you want to add a new pointer to > task_struct for each possible virtualized entity? > > After you're doing by how many bytes will task_struct be bloated? > I don't think that's a very good approach because you'll crank > up the per thread memory overhead which is already far too big > in Linux. Also it adds cache foot print and generally makes > things slower. > > If anything I would request using a proxy data structure > that contains all the virtualized namespaces for a set > of processes. And give each task only has a single pointer > to one of these. This is something we've been discussing - whether to use a single "container" structure pointing to all the namespaces, or put everything into the task_struct. Using container structs means more cache misses and refcounting issues, but keeps task_struct smaller as you point out. The consensus so far has been to start putting things into task_struct and move if needed. At least the performance numbers show that so far there is no impact. iirc container patches have been sent before. Should those be resent, then, and perhaps this patchset rebased on those? thanks, -serge ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 1/5] uts namespaces: Implement utsname namespaces 2006-04-08 20:28 ` Serge E. Hallyn @ 2006-04-09 6:00 ` Andi Kleen 2006-04-09 19:08 ` Eric W. Biederman 0 siblings, 1 reply; 50+ messages in thread From: Andi Kleen @ 2006-04-09 6:00 UTC (permalink / raw) To: Serge E. Hallyn; +Cc: linux-kernel On Saturday 08 April 2006 22:28, Serge E. Hallyn wrote: > This is something we've been discussing - whether to use a single > "container" structure pointing to all the namespaces, or put everything > into the task_struct. Using container structs means more cache misses > and refcounting issues, but keeps task_struct smaller as you point out. The more cache misses argument seems bogus to me. If you consider the case of a lot of processes with lots of shared name spaces the overall foot print should be in fact considerable less. > The consensus so far has been to start putting things into task_struct > and move if needed. At least the performance numbers show that so far > there is no impact. Performance is not the only consider consideration here. Overall memory consumption is important too. Sure for a single namespace like utsname it won't make much difference, but it likely will if you have 10-20 of these things. > > iirc container patches have been sent before. Should those be resent, > then, and perhaps this patchset rebased on those? I think so. -Andi ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 1/5] uts namespaces: Implement utsname namespaces 2006-04-09 6:00 ` Andi Kleen @ 2006-04-09 19:08 ` Eric W. Biederman 0 siblings, 0 replies; 50+ messages in thread From: Eric W. Biederman @ 2006-04-09 19:08 UTC (permalink / raw) To: Andi Kleen; +Cc: Serge E. Hallyn, linux-kernel Andi Kleen <ak@suse.de> writes: > On Saturday 08 April 2006 22:28, Serge E. Hallyn wrote: > >> The consensus so far has been to start putting things into task_struct >> and move if needed. At least the performance numbers show that so far >> there is no impact. > > Performance is not the only consider consideration here. Overall > memory consumption is important too. > > Sure for a single namespace like utsname it won't make much difference, > but it likely will if you have 10-20 of these things. The highest estimate I have seen is 10, including the current mount namespace. Basically it looks like: mounts, uts, sysvipc, net, pid, uid. Not very many. Even in your worst cast estimate of 20. That puts us at. 8*20 = 160. 160 vs 10K. or about a 1% size increase. Not terribly noticeable. And I think 20 - 40 bytes of increase not 160 is a lot closer to where we will be in the short term. >> iirc container patches have been sent before. Should those be resent, >> then, and perhaps this patchset rebased on those? > > I think so. That is premature optimization, and it ties the implementations together. Which makes implementing this that much harder, and we do want separate sharing of these things. Once we have something working I don't have a problem going back and revisiting what it takes to optimize the size of the implementation. But while we still have correctness issues to worry about such a small optimization before we can even measure the benefit or have a good feel of the users does not make sense. If you really think this is a beneficial approach to reducing size you can already apply it to all of the thread pointers. Where the gain is immediately noticeable, and the count is similar. We will be happy to follow the best current practices. Eric ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 0/5] uts namespaces: Introduction 2006-04-07 18:36 [RFC][PATCH 0/5] uts namespaces: Introduction Serge E. Hallyn ` (4 preceding siblings ...) 2006-04-07 18:36 ` [RFC][PATCH 1/5] uts namespaces: Implement utsname namespaces Serge E. Hallyn @ 2006-04-07 19:06 ` Eric W. Biederman 2006-04-07 19:28 ` Serge E. Hallyn 2006-04-11 12:32 ` Kirill Korotaev 6 siblings, 1 reply; 50+ messages in thread From: Eric W. Biederman @ 2006-04-07 19:06 UTC (permalink / raw) To: Serge E. Hallyn Cc: linux-kernel, Kirill Korotaev, herbert, devel, sam, xemul, James Morris "Serge E. Hallyn" <serue@us.ibm.com> writes: > Introduce utsname namespaces. Instead of a single system_utsname > containing hostname domainname etc, a process can request it's > copy of the uts info to be cloned. The data will be copied from > it's original, but any further changes will not be seen by processes > which are not it's children, and vice versa. > > This is useful, for instance, for vserver/openvz, which can now clone > a new uts namespace for each new virtual server. > > This patchset is based on Kirill Korotaev's Mar 24 submission, taking > comments (in particular from James Morris and Eric Biederman) into > account. > > Some performance results are attached. I was mainly curious whether > it would be worth putting the task_struct->uts_ns pointer inside > a #ifdef CONFIG_UTS_NS. The result show that leaving it in when > CONFIG_UTS_NS=n has negligable performance impact, so that is the > approach this patch takes. Ok. This looks like the best version so far. I like the utsname() function thing to shorten the idiom of current->uts_ns->name. We probably want to introduce utsname() and an init_utsname() before any of the other changes, and then perform the substitutions, before we actually change the code so the patchset can make it through a git-bisect. This will also allows for something that can be put in compat-mac.h for backports of anything that cares. Eric ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 0/5] uts namespaces: Introduction 2006-04-07 19:06 ` [RFC][PATCH 0/5] uts namespaces: Introduction Eric W. Biederman @ 2006-04-07 19:28 ` Serge E. Hallyn 2006-04-07 19:39 ` Eric W. Biederman 0 siblings, 1 reply; 50+ messages in thread From: Serge E. Hallyn @ 2006-04-07 19:28 UTC (permalink / raw) To: Eric W. Biederman Cc: Serge E. Hallyn, linux-kernel, Kirill Korotaev, herbert, devel, sam, xemul, James Morris Quoting Eric W. Biederman (ebiederm@xmission.com): > "Serge E. Hallyn" <serue@us.ibm.com> writes: > > > Introduce utsname namespaces. Instead of a single system_utsname > > containing hostname domainname etc, a process can request it's > > copy of the uts info to be cloned. The data will be copied from > > it's original, but any further changes will not be seen by processes > > which are not it's children, and vice versa. > > > > This is useful, for instance, for vserver/openvz, which can now clone > > a new uts namespace for each new virtual server. > > > > This patchset is based on Kirill Korotaev's Mar 24 submission, taking > > comments (in particular from James Morris and Eric Biederman) into > > account. > > > > Some performance results are attached. I was mainly curious whether > > it would be worth putting the task_struct->uts_ns pointer inside > > a #ifdef CONFIG_UTS_NS. The result show that leaving it in when > > CONFIG_UTS_NS=n has negligable performance impact, so that is the > > approach this patch takes. > > Ok. This looks like the best version so far. > > I like the utsname() function thing to shorten the > idiom of current->uts_ns->name. > > We probably want to introduce utsname() and an init_utsname() > before any of the other changes, and then perform the substitutions, This is the same as what Sam is saying, right? Just making sure I understand. > before we actually change the code so the patchset can make it > through a git-bisect. This will also allows for something Ok, I've finally got the rest of git doing my bidding, I'll go read up on git-bisect. thanks for the comments, -serge ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 0/5] uts namespaces: Introduction 2006-04-07 19:28 ` Serge E. Hallyn @ 2006-04-07 19:39 ` Eric W. Biederman 0 siblings, 0 replies; 50+ messages in thread From: Eric W. Biederman @ 2006-04-07 19:39 UTC (permalink / raw) To: Serge E. Hallyn Cc: linux-kernel, Kirill Korotaev, herbert, devel, sam, xemul, James Morris "Serge E. Hallyn" <serue@us.ibm.com> writes: > Quoting Eric W. Biederman (ebiederm@xmission.com): >> "Serge E. Hallyn" <serue@us.ibm.com> writes: >> >> > Introduce utsname namespaces. Instead of a single system_utsname >> > containing hostname domainname etc, a process can request it's >> > copy of the uts info to be cloned. The data will be copied from >> > it's original, but any further changes will not be seen by processes >> > which are not it's children, and vice versa. >> > >> > This is useful, for instance, for vserver/openvz, which can now clone >> > a new uts namespace for each new virtual server. >> > >> > This patchset is based on Kirill Korotaev's Mar 24 submission, taking >> > comments (in particular from James Morris and Eric Biederman) into >> > account. >> > >> > Some performance results are attached. I was mainly curious whether >> > it would be worth putting the task_struct->uts_ns pointer inside >> > a #ifdef CONFIG_UTS_NS. The result show that leaving it in when >> > CONFIG_UTS_NS=n has negligable performance impact, so that is the >> > approach this patch takes. >> >> Ok. This looks like the best version so far. >> >> I like the utsname() function thing to shorten the >> idiom of current->uts_ns->name. >> >> We probably want to introduce utsname() and an init_utsname() >> before any of the other changes, and then perform the substitutions, > > This is the same as what Sam is saying, right? Just making sure I > understand. Yes. >> before we actually change the code so the patchset can make it >> through a git-bisect. This will also allows for something > > Ok, I've finally got the rest of git doing my bidding, I'll go read > up on git-bisect. Basically git-bisect is an automated binary search through patches to help find bugs. If you ever can't compile at an intermediate patch git-bisect and other people walking through the patches looking for bugs won't like it. It's not mandatory that you never break anything in a patchset, but it is much friendlier when you can avoid breakage. Eric ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 0/5] uts namespaces: Introduction 2006-04-07 18:36 [RFC][PATCH 0/5] uts namespaces: Introduction Serge E. Hallyn ` (5 preceding siblings ...) 2006-04-07 19:06 ` [RFC][PATCH 0/5] uts namespaces: Introduction Eric W. Biederman @ 2006-04-11 12:32 ` Kirill Korotaev 2006-04-11 14:01 ` Serge E. Hallyn 6 siblings, 1 reply; 50+ messages in thread From: Kirill Korotaev @ 2006-04-11 12:32 UTC (permalink / raw) To: Serge E. Hallyn Cc: linux-kernel, herbert, devel, sam, Eric W. Biederman, xemul, James Morris Serge, > This patchset is based on Kirill Korotaev's Mar 24 submission, taking > comments (in particular from James Morris and Eric Biederman) into > account. thanks a lot for doing this! > Some performance results are attached. I was mainly curious whether > it would be worth putting the task_struct->uts_ns pointer inside > a #ifdef CONFIG_UTS_NS. The result show that leaving it in when > CONFIG_UTS_NS=n has negligable performance impact, so that is the > approach this patch takes. Serge, your testing approach looks really strange for me. First of all, you selected the worst namespace to check performance overhead on. 1) uts_ns is rarely used and never used on hot paths, 2) also all these test suites below doesn't test the code paths you modified. So I wonder what was the goal of these tests, especially dbench?! Thanks, Kirill > > -serge > > Performance testing was done on a 2-cpu hyperthreaded > x86 box with 16G ram. The following tests were run: > dbench (20 times, four clients, on reiser fs non-isolated partition) > tbench (20 times, 5 connections) > kernbench (20 times) > reaim (20 times ranging from 1 to 15 users) > > They were run on 2.6.17-rc1: > pristine > patched, but with !CONFIG_UTS_NS ("disabled") > patched with CONFIG_UTS_NS=y ("enabled") > > All results are presented as means +/- 95% confidence interval. > > Dbench results: > pristine: 387.080727 +/- 9.344585 > patched disabled: 389.524364 +/- 9.574921 > patched enabled: 370.155600 +/- 30.127808 > > Tbench results: > pristine: 388.940100 +/- 18.095104 > patched disabled: 389.173700 +/- 23.658035 > patched enabled: 394.333200 +/- 25.813393 > > Kernbench results: > pristine: 70.317500 +/- 0.210833 > patched, disabled: 70.860000 +/- 0.179292 > patched, enabled: 70.346500 +/- 0.184784 > > Reaim results: > pristine: > Nclients Mean 95% CI > 1 106080.000000 11327.896029 > 3 236057.142000 18205.544810 > 5 247867.136000 23536.800062 > 7 265370.000000 21284.335743 > 9 262969.936000 18225.497529 > 11 278256.000000 6230.342816 > 13 284288.016000 8924.589388 > 15 286987.170000 7881.034658 > > patched, disabled: > Nclients Mean 95% CI > 1 105400.000000 8739.978241 > 3 229500.000000 0.000000 > 5 252325.176667 16685.663423 > 7 265125.000000 6747.777319 > 9 271258.645000 11715.635212 > 11 280662.608333 7775.229351 > 13 277719.706667 8173.390359 > 15 278515.421667 10963.211450 > > patched, enabled: > Nclients Mean 95% CI > 1 102000.000000 0.000000 > 3 224400.000000 14159.870036 > 5 242963.288000 40529.490781 > 7 255150.000000 8745.802081 > 9 270154.284000 8918.863136 > 11 283134.260000 12239.361252 > 13 288497.540000 11336.550964 > 15 280022.728000 8804.882369 > > ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [RFC][PATCH 0/5] uts namespaces: Introduction 2006-04-11 12:32 ` Kirill Korotaev @ 2006-04-11 14:01 ` Serge E. Hallyn 0 siblings, 0 replies; 50+ messages in thread From: Serge E. Hallyn @ 2006-04-11 14:01 UTC (permalink / raw) To: Kirill Korotaev Cc: Serge E. Hallyn, linux-kernel, herbert, sam, Eric W. Biederman, xemul, James Morris Quoting Kirill Korotaev (dev@sw.ru): > Serge, > > >This patchset is based on Kirill Korotaev's Mar 24 submission, taking > >comments (in particular from James Morris and Eric Biederman) into > >account. > thanks a lot for doing this! NP, thanks for doing the first round. > >Some performance results are attached. I was mainly curious whether > >it would be worth putting the task_struct->uts_ns pointer inside > >a #ifdef CONFIG_UTS_NS. The result show that leaving it in when > >CONFIG_UTS_NS=n has negligable performance impact, so that is the > >approach this patch takes. > Serge, your testing approach looks really strange for me. > First of all, you selected the worst namespace to check performance > overhead on. > 1) uts_ns is rarely used and never used on hot paths, > 2) also all these test suites below doesn't test the code paths you > modified. > > So I wonder what was the goal of these tests, especially dbench?! Right, I wasn't actually aiming to test the performance of the uts namespaces themselves (despite including those numbers), since they're not on hot paths. I was mostly curious whether putting the utsns pointer into the task_struct would affect performance at all, to know whether to put that inside an #ifdef. Based on the results, I kept it non-#ifdefed even if !CONFIG_UTS_NS, and that's what I was justifying with those numbers. These tests should be done again when we get 3 or 5 namespace pointers, and perhaps there should still be some other tests included, ie mainly a forkbomb perhaps. I just did my default set of tests that I usually use. thanks, -serge ^ permalink raw reply [flat|nested] 50+ messages in thread
end of thread, other threads:[~2006-04-27 12:34 UTC | newest] Thread overview: 50+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2006-04-07 18:36 [RFC][PATCH 0/5] uts namespaces: Introduction Serge E. Hallyn 2006-04-07 18:36 ` [RFC][PATCH 5/5] uts namespaces: Enable UTS namespaces debugging Serge E. Hallyn 2006-04-07 18:36 ` [RFC][PATCH 2/5] uts namespaces: Switch to using uts namespaces Serge E. Hallyn 2006-04-07 19:17 ` Sam Ravnborg 2006-04-07 19:25 ` Serge E. Hallyn 2006-04-11 12:26 ` Kirill Korotaev 2006-04-11 21:04 ` Sam Vilain 2006-04-12 5:01 ` Serge E. Hallyn 2006-04-12 6:00 ` Eric W. Biederman 2006-04-19 15:00 ` Serge E. Hallyn 2006-04-07 18:36 ` [RFC][PATCH 3/5] uts namespaces: Use init uts_namespace when appropriate Serge E. Hallyn 2006-04-07 18:36 ` [RFC][PATCH 4/5] utsname namespaces: sysctl hack Serge E. Hallyn 2006-04-19 15:17 ` Kirill Korotaev 2006-04-19 15:21 ` Serge E. Hallyn 2006-04-19 15:50 ` Kirill Korotaev 2006-04-19 16:54 ` Cedric Le Goater 2006-04-19 17:10 ` Eric W. Biederman 2006-04-19 17:10 ` Serge E. Hallyn 2006-04-19 15:52 ` Eric W. Biederman 2006-04-19 16:23 ` Dave Hansen 2006-04-19 16:52 ` Eric W. Biederman 2006-04-19 17:19 ` Dave Hansen 2006-04-19 17:37 ` Eric W. Biederman 2006-04-19 17:48 ` Eric W. Biederman 2006-04-19 15:29 ` Eric W. Biederman 2006-04-19 17:51 ` Serge E. Hallyn 2006-04-19 18:27 ` Eric W. Biederman 2006-04-19 20:24 ` Serge E. Hallyn 2006-04-19 21:44 ` Sam Vilain 2006-04-20 17:05 ` Serge E. Hallyn 2006-04-25 22:00 ` Serge E. Hallyn 2006-04-26 4:09 ` Sam Vilain 2006-04-26 10:28 ` Christoph Hellwig 2006-04-27 12:32 ` Eric W. Biederman 2006-04-07 18:36 ` [RFC][PATCH 1/5] uts namespaces: Implement utsname namespaces Serge E. Hallyn 2006-04-07 19:13 ` Sam Ravnborg 2006-04-07 19:20 ` Serge E. Hallyn 2006-04-07 19:39 ` Serge E. Hallyn 2006-04-07 20:47 ` James Morris 2006-04-07 22:13 ` Serge E. Hallyn 2006-04-08 13:44 ` Andi Kleen 2006-04-08 13:45 ` Andi Kleen 2006-04-08 20:28 ` Serge E. Hallyn 2006-04-09 6:00 ` Andi Kleen 2006-04-09 19:08 ` Eric W. Biederman 2006-04-07 19:06 ` [RFC][PATCH 0/5] uts namespaces: Introduction Eric W. Biederman 2006-04-07 19:28 ` Serge E. Hallyn 2006-04-07 19:39 ` Eric W. Biederman 2006-04-11 12:32 ` Kirill Korotaev 2006-04-11 14:01 ` Serge E. Hallyn
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).