diff options
author | Serge E. Hallyn <serue@us.ibm.com> | 2006-10-02 05:18:11 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-02 10:57:21 -0400 |
commit | e9ff3990f08e9a0c2839cc22808b01732ea5b3e4 (patch) | |
tree | c638a7b89f0c5e8adc410316d06ca1de8b8dabee /arch/mips | |
parent | 0bdd7aab7f0ecd5d337910816aa058c18398628e (diff) |
[PATCH] namespaces: utsname: switch to using uts namespaces
Replace references to system_utsname to the per-process uts namespace
where appropriate. This includes things like uname.
Changes: Per Eric Biederman's comments, use the per-process uts namespace
for ELF_PLATFORM, sunrpc, and parts of net/ipv4/ipconfig.c
[jdike@addtoit.com: UML fix]
[clg@fr.ibm.com: cleanup]
[akpm@osdl.org: build fix]
Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
Cc: Kirill Korotaev <dev@openvz.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Herbert Poetzl <herbert@13thfloor.at>
Cc: Andrey Savochkin <saw@sw.ru>
Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/mips')
-rw-r--r-- | arch/mips/kernel/linux32.c | 2 | ||||
-rw-r--r-- | arch/mips/kernel/syscall.c | 27 | ||||
-rw-r--r-- | arch/mips/kernel/sysirix.c | 12 |
3 files changed, 23 insertions, 18 deletions
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c index 43b1162d714f..52cada45b353 100644 --- a/arch/mips/kernel/linux32.c +++ b/arch/mips/kernel/linux32.c | |||
@@ -1039,7 +1039,7 @@ asmlinkage long sys32_newuname(struct new_utsname __user * name) | |||
1039 | int ret = 0; | 1039 | int ret = 0; |
1040 | 1040 | ||
1041 | down_read(&uts_sem); | 1041 | down_read(&uts_sem); |
1042 | if (copy_to_user(name,&system_utsname,sizeof *name)) | 1042 | if (copy_to_user(name, utsname(), sizeof *name)) |
1043 | ret = -EFAULT; | 1043 | ret = -EFAULT; |
1044 | up_read(&uts_sem); | 1044 | up_read(&uts_sem); |
1045 | 1045 | ||
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c index 9951240cc3fd..970e3e96b1d0 100644 --- a/arch/mips/kernel/syscall.c +++ b/arch/mips/kernel/syscall.c | |||
@@ -231,7 +231,7 @@ out: | |||
231 | */ | 231 | */ |
232 | asmlinkage int sys_uname(struct old_utsname __user * name) | 232 | asmlinkage int sys_uname(struct old_utsname __user * name) |
233 | { | 233 | { |
234 | if (name && !copy_to_user(name, &system_utsname, sizeof (*name))) | 234 | if (name && !copy_to_user(name, utsname(), sizeof (*name))) |
235 | return 0; | 235 | return 0; |
236 | return -EFAULT; | 236 | return -EFAULT; |
237 | } | 237 | } |
@@ -248,16 +248,21 @@ asmlinkage int sys_olduname(struct oldold_utsname __user * name) | |||
248 | if (!access_ok(VERIFY_WRITE,name,sizeof(struct oldold_utsname))) | 248 | if (!access_ok(VERIFY_WRITE,name,sizeof(struct oldold_utsname))) |
249 | return -EFAULT; | 249 | return -EFAULT; |
250 | 250 | ||
251 | error = __copy_to_user(&name->sysname,&system_utsname.sysname,__OLD_UTS_LEN); | 251 | error = __copy_to_user(&name->sysname, &utsname()->sysname, |
252 | error -= __put_user(0,name->sysname+__OLD_UTS_LEN); | 252 | __OLD_UTS_LEN); |
253 | error -= __copy_to_user(&name->nodename,&system_utsname.nodename,__OLD_UTS_LEN); | 253 | error -= __put_user(0, name->sysname + __OLD_UTS_LEN); |
254 | error -= __put_user(0,name->nodename+__OLD_UTS_LEN); | 254 | error -= __copy_to_user(&name->nodename, &utsname()->nodename, |
255 | error -= __copy_to_user(&name->release,&system_utsname.release,__OLD_UTS_LEN); | 255 | __OLD_UTS_LEN); |
256 | error -= __put_user(0,name->release+__OLD_UTS_LEN); | 256 | error -= __put_user(0, name->nodename + __OLD_UTS_LEN); |
257 | error -= __copy_to_user(&name->version,&system_utsname.version,__OLD_UTS_LEN); | 257 | error -= __copy_to_user(&name->release, &utsname()->release, |
258 | error -= __put_user(0,name->version+__OLD_UTS_LEN); | 258 | __OLD_UTS_LEN); |
259 | error -= __copy_to_user(&name->machine,&system_utsname.machine,__OLD_UTS_LEN); | 259 | error -= __put_user(0, name->release + __OLD_UTS_LEN); |
260 | error = __put_user(0,name->machine+__OLD_UTS_LEN); | 260 | error -= __copy_to_user(&name->version, &utsname()->version, |
261 | __OLD_UTS_LEN); | ||
262 | error -= __put_user(0, name->version + __OLD_UTS_LEN); | ||
263 | error -= __copy_to_user(&name->machine, &utsname()->machine, | ||
264 | __OLD_UTS_LEN); | ||
265 | error = __put_user(0, name->machine + __OLD_UTS_LEN); | ||
261 | error = error ? -EFAULT : 0; | 266 | error = error ? -EFAULT : 0; |
262 | 267 | ||
263 | return error; | 268 | return error; |
diff --git a/arch/mips/kernel/sysirix.c b/arch/mips/kernel/sysirix.c index 1137dd6ea7aa..11bb97174972 100644 --- a/arch/mips/kernel/sysirix.c +++ b/arch/mips/kernel/sysirix.c | |||
@@ -884,7 +884,7 @@ asmlinkage int irix_getdomainname(char __user *name, int len) | |||
884 | down_read(&uts_sem); | 884 | down_read(&uts_sem); |
885 | if (len > __NEW_UTS_LEN) | 885 | if (len > __NEW_UTS_LEN) |
886 | len = __NEW_UTS_LEN; | 886 | len = __NEW_UTS_LEN; |
887 | err = copy_to_user(name, system_utsname.domainname, len) ? -EFAULT : 0; | 887 | err = copy_to_user(name, utsname()->domainname, len) ? -EFAULT : 0; |
888 | up_read(&uts_sem); | 888 | up_read(&uts_sem); |
889 | 889 | ||
890 | return err; | 890 | return err; |
@@ -1127,11 +1127,11 @@ struct iuname { | |||
1127 | asmlinkage int irix_uname(struct iuname __user *buf) | 1127 | asmlinkage int irix_uname(struct iuname __user *buf) |
1128 | { | 1128 | { |
1129 | down_read(&uts_sem); | 1129 | down_read(&uts_sem); |
1130 | if (copy_from_user(system_utsname.sysname, buf->sysname, 65) | 1130 | if (copy_from_user(utsname()->sysname, buf->sysname, 65) |
1131 | || copy_from_user(system_utsname.nodename, buf->nodename, 65) | 1131 | || copy_from_user(utsname()->nodename, buf->nodename, 65) |
1132 | || copy_from_user(system_utsname.release, buf->release, 65) | 1132 | || copy_from_user(utsname()->release, buf->release, 65) |
1133 | || copy_from_user(system_utsname.version, buf->version, 65) | 1133 | || copy_from_user(utsname()->version, buf->version, 65) |
1134 | || copy_from_user(system_utsname.machine, buf->machine, 65)) { | 1134 | || copy_from_user(utsname()->machine, buf->machine, 65)) { |
1135 | return -EFAULT; | 1135 | return -EFAULT; |
1136 | } | 1136 | } |
1137 | up_read(&uts_sem); | 1137 | up_read(&uts_sem); |