aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorSerge E. Hallyn <serue@us.ibm.com>2006-10-02 05:18:11 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-02 10:57:21 -0400
commite9ff3990f08e9a0c2839cc22808b01732ea5b3e4 (patch)
treec638a7b89f0c5e8adc410316d06ca1de8b8dabee /arch
parent0bdd7aab7f0ecd5d337910816aa058c18398628e (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')
-rw-r--r--arch/alpha/kernel/osf_sys.c26
-rw-r--r--arch/i386/kernel/sys_i386.c27
-rw-r--r--arch/ia64/sn/kernel/sn2/sn_hwperf.c2
-rw-r--r--arch/m32r/kernel/sys_m32r.c2
-rw-r--r--arch/mips/kernel/linux32.c2
-rw-r--r--arch/mips/kernel/syscall.c27
-rw-r--r--arch/mips/kernel/sysirix.c12
-rw-r--r--arch/parisc/hpux/sys_hpux.c37
-rw-r--r--arch/powerpc/kernel/syscalls.c14
-rw-r--r--arch/sh/kernel/sys_sh.c2
-rw-r--r--arch/sh64/kernel/sys_sh64.c2
-rw-r--r--arch/sparc/kernel/sys_sparc.c4
-rw-r--r--arch/sparc/kernel/sys_sunos.c15
-rw-r--r--arch/sparc64/kernel/sys_sparc.c4
-rw-r--r--arch/sparc64/kernel/sys_sunos32.c10
-rw-r--r--arch/sparc64/solaris/misc.c6
-rw-r--r--arch/um/drivers/mconsole_kern.c6
-rw-r--r--arch/um/kernel/syscall.c22
-rw-r--r--arch/um/sys-x86_64/syscalls.c2
-rw-r--r--arch/x86_64/ia32/sys_ia32.c38
-rw-r--r--arch/x86_64/kernel/sys_x86_64.c2
-rw-r--r--arch/xtensa/kernel/syscalls.c2
22 files changed, 142 insertions, 122 deletions
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index 73c7622b5297..8a31fc1bfb15 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -402,15 +402,15 @@ osf_utsname(char __user *name)
402 402
403 down_read(&uts_sem); 403 down_read(&uts_sem);
404 error = -EFAULT; 404 error = -EFAULT;
405 if (copy_to_user(name + 0, system_utsname.sysname, 32)) 405 if (copy_to_user(name + 0, utsname()->sysname, 32))
406 goto out; 406 goto out;
407 if (copy_to_user(name + 32, system_utsname.nodename, 32)) 407 if (copy_to_user(name + 32, utsname()->nodename, 32))
408 goto out; 408 goto out;
409 if (copy_to_user(name + 64, system_utsname.release, 32)) 409 if (copy_to_user(name + 64, utsname()->release, 32))
410 goto out; 410 goto out;
411 if (copy_to_user(name + 96, system_utsname.version, 32)) 411 if (copy_to_user(name + 96, utsname()->version, 32))
412 goto out; 412 goto out;
413 if (copy_to_user(name + 128, system_utsname.machine, 32)) 413 if (copy_to_user(name + 128, utsname()->machine, 32))
414 goto out; 414 goto out;
415 415
416 error = 0; 416 error = 0;
@@ -449,8 +449,8 @@ osf_getdomainname(char __user *name, int namelen)
449 449
450 down_read(&uts_sem); 450 down_read(&uts_sem);
451 for (i = 0; i < len; ++i) { 451 for (i = 0; i < len; ++i) {
452 __put_user(system_utsname.domainname[i], name + i); 452 __put_user(utsname()->domainname[i], name + i);
453 if (system_utsname.domainname[i] == '\0') 453 if (utsname()->domainname[i] == '\0')
454 break; 454 break;
455 } 455 }
456 up_read(&uts_sem); 456 up_read(&uts_sem);
@@ -607,12 +607,12 @@ osf_sigstack(struct sigstack __user *uss, struct sigstack __user *uoss)
607asmlinkage long 607asmlinkage long
608osf_sysinfo(int command, char __user *buf, long count) 608osf_sysinfo(int command, char __user *buf, long count)
609{ 609{
610 static char * sysinfo_table[] = { 610 char *sysinfo_table[] = {
611 system_utsname.sysname, 611 utsname()->sysname,
612 system_utsname.nodename, 612 utsname()->nodename,
613 system_utsname.release, 613 utsname()->release,
614 system_utsname.version, 614 utsname()->version,
615 system_utsname.machine, 615 utsname()->machine,
616 "alpha", /* instruction set architecture */ 616 "alpha", /* instruction set architecture */
617 "dummy", /* hardware serial number */ 617 "dummy", /* hardware serial number */
618 "dummy", /* hardware manufacturer */ 618 "dummy", /* hardware manufacturer */
diff --git a/arch/i386/kernel/sys_i386.c b/arch/i386/kernel/sys_i386.c
index 8fdb1fb17a5f..dc6e3bbeba31 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_utsname __user * name)
210 if (!name) 210 if (!name)
211 return -EFAULT; 211 return -EFAULT;
212 down_read(&uts_sem); 212 down_read(&uts_sem);
213 err=copy_to_user(name, &system_utsname, sizeof (*name)); 213 err = copy_to_user(name, utsname(), sizeof (*name));
214 up_read(&uts_sem); 214 up_read(&uts_sem);
215 return err?-EFAULT:0; 215 return err?-EFAULT:0;
216} 216}
@@ -226,16 +226,21 @@ asmlinkage int sys_olduname(struct oldold_utsname __user * name)
226 226
227 down_read(&uts_sem); 227 down_read(&uts_sem);
228 228
229 error = __copy_to_user(&name->sysname,&system_utsname.sysname,__OLD_UTS_LEN); 229 error = __copy_to_user(&name->sysname, &utsname()->sysname,
230 error |= __put_user(0,name->sysname+__OLD_UTS_LEN); 230 __OLD_UTS_LEN);
231 error |= __copy_to_user(&name->nodename,&system_utsname.nodename,__OLD_UTS_LEN); 231 error |= __put_user(0, name->sysname + __OLD_UTS_LEN);
232 error |= __put_user(0,name->nodename+__OLD_UTS_LEN); 232 error |= __copy_to_user(&name->nodename, &utsname()->nodename,
233 error |= __copy_to_user(&name->release,&system_utsname.release,__OLD_UTS_LEN); 233 __OLD_UTS_LEN);
234 error |= __put_user(0,name->release+__OLD_UTS_LEN); 234 error |= __put_user(0, name->nodename + __OLD_UTS_LEN);
235 error |= __copy_to_user(&name->version,&system_utsname.version,__OLD_UTS_LEN); 235 error |= __copy_to_user(&name->release, &utsname()->release,
236 error |= __put_user(0,name->version+__OLD_UTS_LEN); 236 __OLD_UTS_LEN);
237 error |= __copy_to_user(&name->machine,&system_utsname.machine,__OLD_UTS_LEN); 237 error |= __put_user(0, name->release + __OLD_UTS_LEN);
238 error |= __put_user(0,name->machine+__OLD_UTS_LEN); 238 error |= __copy_to_user(&name->version, &utsname()->version,
239 __OLD_UTS_LEN);
240 error |= __put_user(0, name->version + __OLD_UTS_LEN);
241 error |= __copy_to_user(&name->machine, &utsname()->machine,
242 __OLD_UTS_LEN);
243 error |= __put_user(0, name->machine + __OLD_UTS_LEN);
239 244
240 up_read(&uts_sem); 245 up_read(&uts_sem);
241 246
diff --git a/arch/ia64/sn/kernel/sn2/sn_hwperf.c b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
index b632b9c1e3b3..462ea178f49a 100644
--- a/arch/ia64/sn/kernel/sn2/sn_hwperf.c
+++ b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
@@ -423,7 +423,7 @@ static int sn_topology_show(struct seq_file *s, void *d)
423 "coherency_domain %d, " 423 "coherency_domain %d, "
424 "region_size %d\n", 424 "region_size %d\n",
425 425
426 partid, system_utsname.nodename, 426 partid, utsname()->nodename,
427 shubtype ? "shub2" : "shub1", 427 shubtype ? "shub2" : "shub1",
428 (u64)nasid_mask << nasid_shift, nasid_msb, nasid_shift, 428 (u64)nasid_mask << nasid_shift, nasid_msb, nasid_shift,
429 system_size, sharing_size, coher, region_size); 429 system_size, sharing_size, coher, region_size);
diff --git a/arch/m32r/kernel/sys_m32r.c b/arch/m32r/kernel/sys_m32r.c
index a9cea32eb824..7c29396cc670 100644
--- a/arch/m32r/kernel/sys_m32r.c
+++ b/arch/m32r/kernel/sys_m32r.c
@@ -205,7 +205,7 @@ asmlinkage int sys_uname(struct old_utsname * name)
205 if (!name) 205 if (!name)
206 return -EFAULT; 206 return -EFAULT;
207 down_read(&uts_sem); 207 down_read(&uts_sem);
208 err=copy_to_user(name, &system_utsname, sizeof (*name)); 208 err = copy_to_user(name, utsname(), sizeof (*name));
209 up_read(&uts_sem); 209 up_read(&uts_sem);
210 return err?-EFAULT:0; 210 return err?-EFAULT:0;
211} 211}
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 */
232asmlinkage int sys_uname(struct old_utsname __user * name) 232asmlinkage 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 {
1127asmlinkage int irix_uname(struct iuname __user *buf) 1127asmlinkage 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);
diff --git a/arch/parisc/hpux/sys_hpux.c b/arch/parisc/hpux/sys_hpux.c
index cb69727027ae..2e2dc4f2c853 100644
--- a/arch/parisc/hpux/sys_hpux.c
+++ b/arch/parisc/hpux/sys_hpux.c
@@ -266,16 +266,21 @@ static int hpux_uname(struct hpux_utsname *name)
266 266
267 down_read(&uts_sem); 267 down_read(&uts_sem);
268 268
269 error = __copy_to_user(&name->sysname,&system_utsname.sysname,HPUX_UTSLEN-1); 269 error = __copy_to_user(&name->sysname, &utsname()->sysname,
270 error |= __put_user(0,name->sysname+HPUX_UTSLEN-1); 270 HPUX_UTSLEN - 1);
271 error |= __copy_to_user(&name->nodename,&system_utsname.nodename,HPUX_UTSLEN-1); 271 error |= __put_user(0, name->sysname + HPUX_UTSLEN - 1);
272 error |= __put_user(0,name->nodename+HPUX_UTSLEN-1); 272 error |= __copy_to_user(&name->nodename, &utsname()->nodename,
273 error |= __copy_to_user(&name->release,&system_utsname.release,HPUX_UTSLEN-1); 273 HPUX_UTSLEN - 1);
274 error |= __put_user(0,name->release+HPUX_UTSLEN-1); 274 error |= __put_user(0, name->nodename + HPUX_UTSLEN - 1);
275 error |= __copy_to_user(&name->version,&system_utsname.version,HPUX_UTSLEN-1); 275 error |= __copy_to_user(&name->release, &utsname()->release,
276 error |= __put_user(0,name->version+HPUX_UTSLEN-1); 276 HPUX_UTSLEN - 1);
277 error |= __copy_to_user(&name->machine,&system_utsname.machine,HPUX_UTSLEN-1); 277 error |= __put_user(0, name->release + HPUX_UTSLEN - 1);
278 error |= __put_user(0,name->machine+HPUX_UTSLEN-1); 278 error |= __copy_to_user(&name->version, &utsname()->version,
279 HPUX_UTSLEN - 1);
280 error |= __put_user(0, name->version + HPUX_UTSLEN - 1);
281 error |= __copy_to_user(&name->machine, &utsname()->machine,
282 HPUX_UTSLEN - 1);
283 error |= __put_user(0, name->machine + HPUX_UTSLEN - 1);
279 284
280 up_read(&uts_sem); 285 up_read(&uts_sem);
281 286
@@ -373,8 +378,8 @@ int hpux_utssys(char *ubuf, int n, int type)
373 /* TODO: print a warning about using this? */ 378 /* TODO: print a warning about using this? */
374 down_write(&uts_sem); 379 down_write(&uts_sem);
375 error = -EFAULT; 380 error = -EFAULT;
376 if (!copy_from_user(system_utsname.sysname, ubuf, len)) { 381 if (!copy_from_user(utsname()->sysname, ubuf, len)) {
377 system_utsname.sysname[len] = 0; 382 utsname()->sysname[len] = 0;
378 error = 0; 383 error = 0;
379 } 384 }
380 up_write(&uts_sem); 385 up_write(&uts_sem);
@@ -400,8 +405,8 @@ int hpux_utssys(char *ubuf, int n, int type)
400 /* TODO: print a warning about this? */ 405 /* TODO: print a warning about this? */
401 down_write(&uts_sem); 406 down_write(&uts_sem);
402 error = -EFAULT; 407 error = -EFAULT;
403 if (!copy_from_user(system_utsname.release, ubuf, len)) { 408 if (!copy_from_user(utsname()->release, ubuf, len)) {
404 system_utsname.release[len] = 0; 409 utsname()->release[len] = 0;
405 error = 0; 410 error = 0;
406 } 411 }
407 up_write(&uts_sem); 412 up_write(&uts_sem);
@@ -422,13 +427,13 @@ int hpux_getdomainname(char *name, int len)
422 427
423 down_read(&uts_sem); 428 down_read(&uts_sem);
424 429
425 nlen = strlen(system_utsname.domainname) + 1; 430 nlen = strlen(utsname()->domainname) + 1;
426 431
427 if (nlen < len) 432 if (nlen < len)
428 len = nlen; 433 len = nlen;
429 if(len > __NEW_UTS_LEN) 434 if(len > __NEW_UTS_LEN)
430 goto done; 435 goto done;
431 if(copy_to_user(name, system_utsname.domainname, len)) 436 if(copy_to_user(name, utsname()->domainname, len))
432 goto done; 437 goto done;
433 err = 0; 438 err = 0;
434done: 439done:
diff --git a/arch/powerpc/kernel/syscalls.c b/arch/powerpc/kernel/syscalls.c
index 9b69d99a9103..d358866b880f 100644
--- a/arch/powerpc/kernel/syscalls.c
+++ b/arch/powerpc/kernel/syscalls.c
@@ -260,7 +260,7 @@ long ppc_newuname(struct new_utsname __user * name)
260 int err = 0; 260 int err = 0;
261 261
262 down_read(&uts_sem); 262 down_read(&uts_sem);
263 if (copy_to_user(name, &system_utsname, sizeof(*name))) 263 if (copy_to_user(name, utsname(), sizeof(*name)))
264 err = -EFAULT; 264 err = -EFAULT;
265 up_read(&uts_sem); 265 up_read(&uts_sem);
266 if (!err) 266 if (!err)
@@ -273,7 +273,7 @@ int sys_uname(struct old_utsname __user *name)
273 int err = 0; 273 int err = 0;
274 274
275 down_read(&uts_sem); 275 down_read(&uts_sem);
276 if (copy_to_user(name, &system_utsname, sizeof(*name))) 276 if (copy_to_user(name, utsname(), sizeof(*name)))
277 err = -EFAULT; 277 err = -EFAULT;
278 up_read(&uts_sem); 278 up_read(&uts_sem);
279 if (!err) 279 if (!err)
@@ -289,19 +289,19 @@ int sys_olduname(struct oldold_utsname __user *name)
289 return -EFAULT; 289 return -EFAULT;
290 290
291 down_read(&uts_sem); 291 down_read(&uts_sem);
292 error = __copy_to_user(&name->sysname, &system_utsname.sysname, 292 error = __copy_to_user(&name->sysname, &utsname()->sysname,
293 __OLD_UTS_LEN); 293 __OLD_UTS_LEN);
294 error |= __put_user(0, name->sysname + __OLD_UTS_LEN); 294 error |= __put_user(0, name->sysname + __OLD_UTS_LEN);
295 error |= __copy_to_user(&name->nodename, &system_utsname.nodename, 295 error |= __copy_to_user(&name->nodename, &utsname()->nodename,
296 __OLD_UTS_LEN); 296 __OLD_UTS_LEN);
297 error |= __put_user(0, name->nodename + __OLD_UTS_LEN); 297 error |= __put_user(0, name->nodename + __OLD_UTS_LEN);
298 error |= __copy_to_user(&name->release, &system_utsname.release, 298 error |= __copy_to_user(&name->release, &utsname()->release,
299 __OLD_UTS_LEN); 299 __OLD_UTS_LEN);
300 error |= __put_user(0, name->release + __OLD_UTS_LEN); 300 error |= __put_user(0, name->release + __OLD_UTS_LEN);
301 error |= __copy_to_user(&name->version, &system_utsname.version, 301 error |= __copy_to_user(&name->version, &utsname()->version,
302 __OLD_UTS_LEN); 302 __OLD_UTS_LEN);
303 error |= __put_user(0, name->version + __OLD_UTS_LEN); 303 error |= __put_user(0, name->version + __OLD_UTS_LEN);
304 error |= __copy_to_user(&name->machine, &system_utsname.machine, 304 error |= __copy_to_user(&name->machine, &utsname()->machine,
305 __OLD_UTS_LEN); 305 __OLD_UTS_LEN);
306 error |= override_machine(name->machine); 306 error |= override_machine(name->machine);
307 up_read(&uts_sem); 307 up_read(&uts_sem);
diff --git a/arch/sh/kernel/sys_sh.c b/arch/sh/kernel/sys_sh.c
index b68ff705f067..11c2acde6eaa 100644
--- a/arch/sh/kernel/sys_sh.c
+++ b/arch/sh/kernel/sys_sh.c
@@ -281,7 +281,7 @@ asmlinkage int sys_uname(struct old_utsname * name)
281 if (!name) 281 if (!name)
282 return -EFAULT; 282 return -EFAULT;
283 down_read(&uts_sem); 283 down_read(&uts_sem);
284 err=copy_to_user(name, &system_utsname, sizeof (*name)); 284 err = copy_to_user(name, utsname(), sizeof (*name));
285 up_read(&uts_sem); 285 up_read(&uts_sem);
286 return err?-EFAULT:0; 286 return err?-EFAULT:0;
287} 287}
diff --git a/arch/sh64/kernel/sys_sh64.c b/arch/sh64/kernel/sys_sh64.c
index 58ff7d522d81..c6de1a95af44 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_utsname * name)
279 if (!name) 279 if (!name)
280 return -EFAULT; 280 return -EFAULT;
281 down_read(&uts_sem); 281 down_read(&uts_sem);
282 err=copy_to_user(name, &system_utsname, sizeof (*name)); 282 err = copy_to_user(name, utsname(), sizeof (*name));
283 up_read(&uts_sem); 283 up_read(&uts_sem);
284 return err?-EFAULT:0; 284 return err?-EFAULT:0;
285} 285}
diff --git a/arch/sparc/kernel/sys_sparc.c b/arch/sparc/kernel/sys_sparc.c
index 896863fb208a..002ab4dbe5cb 100644
--- a/arch/sparc/kernel/sys_sparc.c
+++ b/arch/sparc/kernel/sys_sparc.c
@@ -475,13 +475,13 @@ asmlinkage int sys_getdomainname(char __user *name, int len)
475 475
476 down_read(&uts_sem); 476 down_read(&uts_sem);
477 477
478 nlen = strlen(system_utsname.domainname) + 1; 478 nlen = strlen(utsname()->domainname) + 1;
479 err = -EINVAL; 479 err = -EINVAL;
480 if (nlen > len) 480 if (nlen > len)
481 goto out; 481 goto out;
482 482
483 err = -EFAULT; 483 err = -EFAULT;
484 if (!copy_to_user(name, system_utsname.domainname, nlen)) 484 if (!copy_to_user(name, utsname()->domainname, nlen))
485 err = 0; 485 err = 0;
486 486
487out: 487out:
diff --git a/arch/sparc/kernel/sys_sunos.c b/arch/sparc/kernel/sys_sunos.c
index aa0fb2efb615..9d2cd97d1c3a 100644
--- a/arch/sparc/kernel/sys_sunos.c
+++ b/arch/sparc/kernel/sys_sunos.c
@@ -483,13 +483,18 @@ asmlinkage int sunos_uname(struct sunos_utsname __user *name)
483{ 483{
484 int ret; 484 int ret;
485 down_read(&uts_sem); 485 down_read(&uts_sem);
486 ret = copy_to_user(&name->sname[0], &system_utsname.sysname[0], sizeof(name->sname) - 1); 486 ret = copy_to_user(&name->sname[0], &utsname()->sysname[0],
487 sizeof(name->sname) - 1);
487 if (!ret) { 488 if (!ret) {
488 ret |= __copy_to_user(&name->nname[0], &system_utsname.nodename[0], sizeof(name->nname) - 1); 489 ret |= __copy_to_user(&name->nname[0], &utsname()->nodename[0],
490 sizeof(name->nname) - 1);
489 ret |= __put_user('\0', &name->nname[8]); 491 ret |= __put_user('\0', &name->nname[8]);
490 ret |= __copy_to_user(&name->rel[0], &system_utsname.release[0], sizeof(name->rel) - 1); 492 ret |= __copy_to_user(&name->rel[0], &utsname()->release[0],
491 ret |= __copy_to_user(&name->ver[0], &system_utsname.version[0], sizeof(name->ver) - 1); 493 sizeof(name->rel) - 1);
492 ret |= __copy_to_user(&name->mach[0], &system_utsname.machine[0], sizeof(name->mach) - 1); 494 ret |= __copy_to_user(&name->ver[0], &utsname()->version[0],
495 sizeof(name->ver) - 1);
496 ret |= __copy_to_user(&name->mach[0], &utsname()->machine[0],
497 sizeof(name->mach) - 1);
493 } 498 }
494 up_read(&uts_sem); 499 up_read(&uts_sem);
495 return ret ? -EFAULT : 0; 500 return ret ? -EFAULT : 0;
diff --git a/arch/sparc64/kernel/sys_sparc.c b/arch/sparc64/kernel/sys_sparc.c
index c608c947e6c3..89ac435aacc0 100644
--- a/arch/sparc64/kernel/sys_sparc.c
+++ b/arch/sparc64/kernel/sys_sparc.c
@@ -712,13 +712,13 @@ asmlinkage long sys_getdomainname(char __user *name, int len)
712 712
713 down_read(&uts_sem); 713 down_read(&uts_sem);
714 714
715 nlen = strlen(system_utsname.domainname) + 1; 715 nlen = strlen(utsname()->domainname) + 1;
716 err = -EINVAL; 716 err = -EINVAL;
717 if (nlen > len) 717 if (nlen > len)
718 goto out; 718 goto out;
719 719
720 err = -EFAULT; 720 err = -EFAULT;
721 if (!copy_to_user(name, system_utsname.domainname, nlen)) 721 if (!copy_to_user(name, utsname()->domainname, nlen))
722 err = 0; 722 err = 0;
723 723
724out: 724out:
diff --git a/arch/sparc64/kernel/sys_sunos32.c b/arch/sparc64/kernel/sys_sunos32.c
index 87ebdf858a3a..953296b73f3f 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_utsname __user *name)
439 int ret; 439 int ret;
440 440
441 down_read(&uts_sem); 441 down_read(&uts_sem);
442 ret = copy_to_user(&name->sname[0], &system_utsname.sysname[0], 442 ret = copy_to_user(&name->sname[0], &utsname()->sysname[0],
443 sizeof(name->sname) - 1); 443 sizeof(name->sname) - 1);
444 ret |= copy_to_user(&name->nname[0], &system_utsname.nodename[0], 444 ret |= copy_to_user(&name->nname[0], &utsname()->nodename[0],
445 sizeof(name->nname) - 1); 445 sizeof(name->nname) - 1);
446 ret |= put_user('\0', &name->nname[8]); 446 ret |= put_user('\0', &name->nname[8]);
447 ret |= copy_to_user(&name->rel[0], &system_utsname.release[0], 447 ret |= copy_to_user(&name->rel[0], &utsname()->release[0],
448 sizeof(name->rel) - 1); 448 sizeof(name->rel) - 1);
449 ret |= copy_to_user(&name->ver[0], &system_utsname.version[0], 449 ret |= copy_to_user(&name->ver[0], &utsname()->version[0],
450 sizeof(name->ver) - 1); 450 sizeof(name->ver) - 1);
451 ret |= copy_to_user(&name->mach[0], &system_utsname.machine[0], 451 ret |= copy_to_user(&name->mach[0], &utsname()->machine[0],
452 sizeof(name->mach) - 1); 452 sizeof(name->mach) - 1);
453 up_read(&uts_sem); 453 up_read(&uts_sem);
454 return (ret ? -EFAULT : 0); 454 return (ret ? -EFAULT : 0);
diff --git a/arch/sparc64/solaris/misc.c b/arch/sparc64/solaris/misc.c
index 9c581328e76a..9ed997982f8d 100644
--- a/arch/sparc64/solaris/misc.c
+++ b/arch/sparc64/solaris/misc.c
@@ -249,7 +249,7 @@ asmlinkage int solaris_utssys(u32 buf, u32 flags, int which, u32 buf2)
249 /* Let's cheat */ 249 /* Let's cheat */
250 err = set_utsfield(v->sysname, "SunOS", 1, 0); 250 err = set_utsfield(v->sysname, "SunOS", 1, 0);
251 down_read(&uts_sem); 251 down_read(&uts_sem);
252 err |= set_utsfield(v->nodename, system_utsname.nodename, 252 err |= set_utsfield(v->nodename, utsname()->nodename,
253 1, 1); 253 1, 1);
254 up_read(&uts_sem); 254 up_read(&uts_sem);
255 err |= set_utsfield(v->release, "2.6", 0, 0); 255 err |= set_utsfield(v->release, "2.6", 0, 0);
@@ -273,7 +273,7 @@ asmlinkage int solaris_utsname(u32 buf)
273 /* Why should we not lie a bit? */ 273 /* Why should we not lie a bit? */
274 down_read(&uts_sem); 274 down_read(&uts_sem);
275 err = set_utsfield(v->sysname, "SunOS", 0, 0); 275 err = set_utsfield(v->sysname, "SunOS", 0, 0);
276 err |= set_utsfield(v->nodename, system_utsname.nodename, 1, 1); 276 err |= set_utsfield(v->nodename, utsname()->nodename, 1, 1);
277 err |= set_utsfield(v->release, "5.6", 0, 0); 277 err |= set_utsfield(v->release, "5.6", 0, 0);
278 err |= set_utsfield(v->version, "Generic", 0, 0); 278 err |= set_utsfield(v->version, "Generic", 0, 0);
279 err |= set_utsfield(v->machine, machine(), 0, 0); 279 err |= set_utsfield(v->machine, machine(), 0, 0);
@@ -305,7 +305,7 @@ asmlinkage int solaris_sysinfo(int cmd, u32 buf, s32 count)
305 case SI_HOSTNAME: 305 case SI_HOSTNAME:
306 r = buffer + 256; 306 r = buffer + 256;
307 down_read(&uts_sem); 307 down_read(&uts_sem);
308 for (p = system_utsname.nodename, q = buffer; 308 for (p = utsname()->nodename, q = buffer;
309 q < r && *p && *p != '.'; *q++ = *p++); 309 q < r && *p && *p != '.'; *q++ = *p++);
310 up_read(&uts_sem); 310 up_read(&uts_sem);
311 *q = 0; 311 *q = 0;
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c
index 773a134e7fdb..a67dcbd78de4 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 *req)
106{ 106{
107 char version[256]; 107 char version[256];
108 108
109 sprintf(version, "%s %s %s %s %s", system_utsname.sysname, 109 sprintf(version, "%s %s %s %s %s", utsname()->sysname,
110 system_utsname.nodename, system_utsname.release, 110 utsname()->nodename, utsname()->release,
111 system_utsname.version, system_utsname.machine); 111 utsname()->version, utsname()->machine);
112 mconsole_reply(req, version, 0, 0); 112 mconsole_reply(req, version, 0, 0);
113} 113}
114 114
diff --git a/arch/um/kernel/syscall.c b/arch/um/kernel/syscall.c
index 48cf88dd02d4..abf14aaf905f 100644
--- a/arch/um/kernel/syscall.c
+++ b/arch/um/kernel/syscall.c
@@ -110,7 +110,7 @@ long sys_uname(struct old_utsname __user * name)
110 if (!name) 110 if (!name)
111 return -EFAULT; 111 return -EFAULT;
112 down_read(&uts_sem); 112 down_read(&uts_sem);
113 err = copy_to_user(name, &system_utsname, sizeof (*name)); 113 err = copy_to_user(name, utsname(), sizeof (*name));
114 up_read(&uts_sem); 114 up_read(&uts_sem);
115 return err?-EFAULT:0; 115 return err?-EFAULT:0;
116} 116}
@@ -126,21 +126,21 @@ long sys_olduname(struct oldold_utsname __user * name)
126 126
127 down_read(&uts_sem); 127 down_read(&uts_sem);
128 128
129 error = __copy_to_user(&name->sysname,&system_utsname.sysname, 129 error = __copy_to_user(&name->sysname, &utsname()->sysname,
130 __OLD_UTS_LEN); 130 __OLD_UTS_LEN);
131 error |= __put_user(0,name->sysname+__OLD_UTS_LEN); 131 error |= __put_user(0, name->sysname + __OLD_UTS_LEN);
132 error |= __copy_to_user(&name->nodename,&system_utsname.nodename, 132 error |= __copy_to_user(&name->nodename, &utsname()->nodename,
133 __OLD_UTS_LEN); 133 __OLD_UTS_LEN);
134 error |= __put_user(0,name->nodename+__OLD_UTS_LEN); 134 error |= __put_user(0, name->nodename + __OLD_UTS_LEN);
135 error |= __copy_to_user(&name->release,&system_utsname.release, 135 error |= __copy_to_user(&name->release, &utsname()->release,
136 __OLD_UTS_LEN); 136 __OLD_UTS_LEN);
137 error |= __put_user(0,name->release+__OLD_UTS_LEN); 137 error |= __put_user(0, name->release + __OLD_UTS_LEN);
138 error |= __copy_to_user(&name->version,&system_utsname.version, 138 error |= __copy_to_user(&name->version, &utsname()->version,
139 __OLD_UTS_LEN); 139 __OLD_UTS_LEN);
140 error |= __put_user(0,name->version+__OLD_UTS_LEN); 140 error |= __put_user(0, name->version + __OLD_UTS_LEN);
141 error |= __copy_to_user(&name->machine,&system_utsname.machine, 141 error |= __copy_to_user(&name->machine, &utsname()->machine,
142 __OLD_UTS_LEN); 142 __OLD_UTS_LEN);
143 error |= __put_user(0,name->machine+__OLD_UTS_LEN); 143 error |= __put_user(0, name->machine + __OLD_UTS_LEN);
144 144
145 up_read(&uts_sem); 145 up_read(&uts_sem);
146 146
diff --git a/arch/um/sys-x86_64/syscalls.c b/arch/um/sys-x86_64/syscalls.c
index 6fce9f45dfdc..73ce4463f70c 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_utsname __user * name)
21{ 21{
22 int err; 22 int err;
23 down_read(&uts_sem); 23 down_read(&uts_sem);
24 err = copy_to_user(name, &system_utsname, sizeof (*name)); 24 err = copy_to_user(name, utsname(), sizeof (*name));
25 up_read(&uts_sem); 25 up_read(&uts_sem);
26 if (personality(current->personality) == PER_LINUX32) 26 if (personality(current->personality) == PER_LINUX32)
27 err |= copy_to_user(&name->machine, "i686", 5); 27 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 f280d3665f4b..26a01717cc1a 100644
--- a/arch/x86_64/ia32/sys_ia32.c
+++ b/arch/x86_64/ia32/sys_ia32.c
@@ -784,36 +784,36 @@ asmlinkage long sys32_olduname(struct oldold_utsname __user * name)
784 784
785 if (!name) 785 if (!name)
786 return -EFAULT; 786 return -EFAULT;
787 if (!access_ok(VERIFY_WRITE,name,sizeof(struct oldold_utsname))) 787 if (!access_ok(VERIFY_WRITE, name, sizeof(struct oldold_utsname)))
788 return -EFAULT; 788 return -EFAULT;
789 789
790 down_read(&uts_sem); 790 down_read(&uts_sem);
791 791
792 err = __copy_to_user(&name->sysname,&system_utsname.sysname, 792 err = __copy_to_user(&name->sysname,&utsname()->sysname,
793 __OLD_UTS_LEN); 793 __OLD_UTS_LEN);
794 err |= __put_user(0,name->sysname+__OLD_UTS_LEN); 794 err |= __put_user(0,name->sysname+__OLD_UTS_LEN);
795 err |= __copy_to_user(&name->nodename,&system_utsname.nodename, 795 err |= __copy_to_user(&name->nodename,&utsname()->nodename,
796 __OLD_UTS_LEN); 796 __OLD_UTS_LEN);
797 err |= __put_user(0,name->nodename+__OLD_UTS_LEN); 797 err |= __put_user(0,name->nodename+__OLD_UTS_LEN);
798 err |= __copy_to_user(&name->release,&system_utsname.release, 798 err |= __copy_to_user(&name->release,&utsname()->release,
799 __OLD_UTS_LEN); 799 __OLD_UTS_LEN);
800 err |= __put_user(0,name->release+__OLD_UTS_LEN); 800 err |= __put_user(0,name->release+__OLD_UTS_LEN);
801 err |= __copy_to_user(&name->version,&system_utsname.version, 801 err |= __copy_to_user(&name->version,&utsname()->version,
802 __OLD_UTS_LEN); 802 __OLD_UTS_LEN);
803 err |= __put_user(0,name->version+__OLD_UTS_LEN); 803 err |= __put_user(0,name->version+__OLD_UTS_LEN);
804 { 804 {
805 char *arch = "x86_64"; 805 char *arch = "x86_64";
806 if (personality(current->personality) == PER_LINUX32) 806 if (personality(current->personality) == PER_LINUX32)
807 arch = "i686"; 807 arch = "i686";
808 808
809 err |= __copy_to_user(&name->machine,arch,strlen(arch)+1); 809 err |= __copy_to_user(&name->machine, arch, strlen(arch)+1);
810 } 810 }
811 811
812 up_read(&uts_sem); 812 up_read(&uts_sem);
813 813
814 err = err ? -EFAULT : 0; 814 err = err ? -EFAULT : 0;
815 815
816 return err; 816 return err;
817} 817}
818 818
819long sys32_uname(struct old_utsname __user * name) 819long sys32_uname(struct old_utsname __user * name)
@@ -822,7 +822,7 @@ long sys32_uname(struct old_utsname __user * name)
822 if (!name) 822 if (!name)
823 return -EFAULT; 823 return -EFAULT;
824 down_read(&uts_sem); 824 down_read(&uts_sem);
825 err=copy_to_user(name, &system_utsname, sizeof (*name)); 825 err = copy_to_user(name, utsname(), sizeof (*name));
826 up_read(&uts_sem); 826 up_read(&uts_sem);
827 if (personality(current->personality) == PER_LINUX32) 827 if (personality(current->personality) == PER_LINUX32)
828 err |= copy_to_user(&name->machine, "i686", 5); 828 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 6449ea8fe756..76bf7c241fe4 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_utsname __user * name)
148{ 148{
149 int err; 149 int err;
150 down_read(&uts_sem); 150 down_read(&uts_sem);
151 err = copy_to_user(name, &system_utsname, sizeof (*name)); 151 err = copy_to_user(name, utsname(), sizeof (*name));
152 up_read(&uts_sem); 152 up_read(&uts_sem);
153 if (personality(current->personality) == PER_LINUX32) 153 if (personality(current->personality) == PER_LINUX32)
154 err |= copy_to_user(&name->machine, "i686", 5); 154 err |= copy_to_user(&name->machine, "i686", 5);
diff --git a/arch/xtensa/kernel/syscalls.c b/arch/xtensa/kernel/syscalls.c
index 4688ba2db84d..37c90ca5b98d 100644
--- a/arch/xtensa/kernel/syscalls.c
+++ b/arch/xtensa/kernel/syscalls.c
@@ -128,7 +128,7 @@ out:
128 128
129int sys_uname(struct old_utsname * name) 129int sys_uname(struct old_utsname * name)
130{ 130{
131 if (name && !copy_to_user(name, &system_utsname, sizeof (*name))) 131 if (name && !copy_to_user(name, utsname(), sizeof (*name)))
132 return 0; 132 return 0;
133 return -EFAULT; 133 return -EFAULT;
134} 134}