uts namespaces: use init_utsname when appropriate
Subsystems (25)
A message that is not in the archive (sent off-list or not yet received): 20060407234815.849357768@sergelap
A message that is not in the archive (sent off-list or not yet received): [email protected]
include/asm-i386/elf.h typedef struct user_fxsr_struct elf_fpxr · line 114
Quoted 13 lines · Serge E. Hallyn
include/asm-i386/elf.h +1
-1@@ -108,7 +108,7 @@ typedef struct user_fxsr_struct elf_fpxrFor the moment, we have only optimizations for the Intel generations, but that could change... */ -#define ELF_PLATFORM (system_utsname.machine) +#define ELF_PLATFORM (init_utsname()->machine)#ifdef __KERNEL__#define SET_PERSONALITY (ex, ibcs2) do { } while (0)
I think this one needs to be utsname()->machine.
Currently it doesn't matter. But Herbert has expressed the desire to make a machine appear like an older one.
Quoted 47 lines
net/ipv4/ipconfig.c +3
-3@@ -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_utsname ()->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_utsname ()->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 *eic_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_utsname ()->domainname, ext+1 , *ext, __NEW_UTS_LEN);break ; }}
net/ipv4/ipconfig.c +1
-3@@ -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_utsname ()->nodename, ic_domain,init_utsname ()->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(ccase 4 :if ((dp =strchr (ip,'.' ))) { *dp++ ='\0' ; -strlcpy (system_utsname.domainname, dp, -sizeof (system_utsname.domainname));
net/ipv4/ipconfig.c static int __init ip_auto_config_setup(c · line 1489
Quoted 10 lines
net/ipv4/ipconfig.c +4
-2+strlcpy (init_utsname ()->domainname, dp, +sizeof (init_utsname ()->domainname)); } -strlcpy (system_utsname.nodename, ip, -sizeof (system_utsname.nodename)); +strlcpy (init_utsname ()->nodename, ip, +sizeof (init_utsname ()->nodename)); ic_host_name_set =1 ;break ;case 5 :
This also probably makes sense as utsname(). It doesn't really matter as this is before init is executed. But logically this is a user space or per namespace action.
Quoted 7 lines
net/sunrpc/clnt.c +0
-0@@ -176,10 +176,10 @@ rpc_new_client(struct rpc_xprt *xprt, ch }
net/sunrpc/clnt.c rpc_new_client(struct rpc_xprt *xprt, ch · line 185
Quoted 10 lines
net/sunrpc/clnt.c +2
-2/* save the nodename */ - clnt->cl_nodelen =strlen (system_utsname.nodename); + clnt->cl_nodelen =strlen (init_utsname ()->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_utsname ()->nodename, clnt->cl_nodelen);return clnt; out_no_auth:
Using nodename is practically the definition of something that should per namespace I think. Plus it would be really inconsistent to use utsname() and the init_utsname for the nfs rpc calls.
Unless I am missing something.
Eric
Quoted 13 lines · Eric W. Biederman
Quoted 11 lines · Serge E. Hallyn
include/asm-i386/elf.h +1
-1@@ -108,7 +108,7 @@ typedef struct user_fxsr_struct elf_fpxrFor the moment, we have only optimizations for the Intel generations, but that could change... */ -#define ELF_PLATFORM (system_utsname.machine) +#define ELF_PLATFORM (init_utsname()->machine)
Quoted 7 lines
include/asm-i386/elf.h typedef struct user_fxsr_struct elf_fpxr · line 114
Quoted 2 lines
include/asm-i386/elf.h +0
-0#ifdef __KERNEL__#define SET_PERSONALITY (ex, ibcs2) do { } while (0)I think this one needs to be utsname()->machine.
Currently it doesn't matter. But Herbert has expressed the desire to make a machine appear like an older one.
Ok.
Quoted 2 lines
Quoted 2 lines
net/ipv4/ipconfig.c +0
-0
...
Quoted 12 lines
Quoted 12 lines
net/ipv4/ipconfig.c +3
-4@@ -1479,11 +1479,11 @@ static int __init ip_auto_config_setup(ccase 4 :if ((dp =strchr (ip,'.' ))) { *dp++ ='\0' ; -strlcpy (system_utsname.domainname, dp, -sizeof (system_utsname.domainname)); +strlcpy (init_utsname ()->domainname, dp, +sizeof (init_utsname ()->domainname)); } -strlcpy (system_utsname.nodename, ip, -sizeof (system_utsname.nodename)); + strlcpy(init_utsname()->nodename, ip,
Quoted 8 lines
net/ipv4/ipconfig.c static int __init ip_auto_config_setup(c · line 1489
Quoted 4 lines
net/ipv4/ipconfig.c +1
-0+ sizeof(init_utsname()->nodename)); ic_host_name_set =1 ;break ;case 5 :This also probably makes sense as
utsname(). It doesn't really matter as this is before init is executed. But logically this is a user space or per namespace action.
Right, I was kind of favoring using init_utsname() for anything __init. But utsname() will of course work just as well there.
Quoted 16 lines
Quoted 16 lines
net/sunrpc/clnt.c +2
-2@@ -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_utsname ()->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_utsname ()->nodename, clnt->cl_nodelen);return clnt;
Quoted 7 lines
net/sunrpc/clnt.c rpc_new_client(struct rpc_xprt *xprt, ch · line 185
Quoted 1 line
net/sunrpc/clnt.c +0
-0out_no_auth:Using nodename is practically the definition of something that should per namespace I think. Plus it would be really inconsistent to use
utsname()and theinit_utsnamefor the nfs rpc calls.Unless I am missing something.
It seemed like this would be happening in any old context, so that current->uts_ns could be any process'. Tracing it back further, it seems like nfs+lockd should have the context available. So I'll switch this as well.
thanks,
-serge
Quoted 6 lines · Serge E. Hallyn
Quoted 3 lines
This also probably makes sense as
utsname(). It doesn't really matter as this is before init is executed. But logically this is a user space or per namespace action.Right, I was kind of favoring using
init_utsname()for anything__init. Bututsname()will of course work just as well there.
Basically anything that should move to klibc I favor using utsname() for. That tends to make it clear it follows the usual user space rules.
With a little luck HPA might actually have this code deleted in -mm before we get to far.
Quoted 22 lines
Quoted 22 lines
Quoted 7 lines
net/sunrpc/clnt.c +0
-0@@ -176,10 +176,10 @@ rpc_new_client(struct rpc_xprt *xprt, ch }net/sunrpc/clnt.c rpc_new_client(struct rpc_xprt *xprt, ch · line 185
Quoted 10 lines
net/sunrpc/clnt.c +2
-2/* save the nodename */ - clnt->cl_nodelen =strlen (system_utsname.nodename); + clnt->cl_nodelen =strlen (init_utsname ()->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_utsname ()->nodename, clnt->cl_nodelen);return clnt; out_no_auth:Using nodename is practically the definition of something that should per namespace I think. Plus it would be really inconsistent to use
utsname()and theinit_utsnamefor the nfs rpc calls.
Quoted 6 lines
Quoted 1 line
Unless I am missing something.
It seemed like this would be happening in any old context, so that
current->uts_nscould be any process'. Tracing it back further, it seems like nfs+lockd should have the context available. So I'll switch this as well.
I have not traced that path recently. So I don't remember. This is one of those odd cases that makes a real difference.
This reminds me of another piece of the conversation. kernel_thread vs. kthread, and the oddities of daemonize.
In general user space cannot kill kernel threads, so having a kernel thread inside a namespace is dangerous because it means the namespace can never exit.
There are two ways to avoid the associated problems.
- modify daemonize to always use the instance of that namespace associated with init_task.
- modify all interesting kernel threads to use the kthread api instead of kernel_thread. Using kthread makes the kernel threads children of keventd and always in the initial namespace instance. As such we know we aren't inside of any user space namespace instance.
Eric
Quoted 8 lines · Eric W. Biederman
There are two ways to avoid the associated problems.
- modify daemonize to always use the instance of that namespace associated withinit_task.
- modify all interesting kernel threads to use the kthread api instead ofkernel_thread. Using kthread makes the kernel threads children of keventd and always in the initial namespace instance. As such we know we aren't inside of any user space namespace instance.
I've added a deprecation entry for the kernel_thread export and plan to convert all users to the kthread API. Any help on that is of course greatly appreciated.
And folks, please remove [email protected] from this thead, it's subscribers only and gives everyone else nasty bounces.
Quoted 2 lines · Christoph Hellwig
And folks, please remove [email protected] from this thead, it's subscribers only and gives everyone else nasty bounces.
Odd. I haven't been getting bounces, and I'm not subscribed.
I wonder if some of the principals in the conversation were given an explicit exception. If so that is a subtle pain.
Eric
Quoted 9 lines · Eric W. Biederman
Quoted 6 lines · Serge E. Hallyn
Quoted 3 lines
This also probably makes sense as
utsname(). It doesn't really matter as this is before init is executed. But logically this is a user space or per namespace action.Right, I was kind of favoring using
init_utsname()for anything__init. Bututsname()will of course work just as well there.
Quoted 6 lines
Basically anything that should move to klibc I favor using
utsname()for. That tends to make it clear it follows the usual user space rules.With a little luck HPA might actually have this code deleted in -mm before we get to far.
Here is a new version of the init_utsname patch. I'm sending a new version of the utsname() patch in reply to the original [2/7] patch.
From: Serge Hallyn <[email protected]>
Subject: [PATCH 3/7] uts namespaces: use init_utsname when appropriate
In some places, particularly drivers and __init code, the init utsns is the appropriate one to use. This patch replaces those with a the init_utsname helper.
Changes: Removed several uses of init_utsname(). Hope I picked all the
right ones in net/ipv4/ipconfig.c. These are now changed to utsname() (the per-process namespace utsname) in the previous patch (2/7)
---
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-sh/bugs.h | 2 +- kernel/power/snapshot.c | 10 +++++----- net/ipv4/ipconfig.c | 2 +- sound/core/info_oss.c | 10 +++++----- 25 files changed, 45 insertions(+), 45 deletions(-)
3941501899f74ae1fee21a074cdc2e420a4b3f27
arch/arm/kernel/setup.c +1 -1
@@ -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_utsname ()->machine,"%s%c" , list->arch_name,ENDIANNESS );sprintf (elf_platform,"%s%c" , list->elf_name,ENDIANNESS ); elf_hwcap = list->elf_hwcap;
arch/arm26/kernel/setup.c +1 -1
@@ -144,7 +144,7 @@ static void __init setup_processor(void)dump_cpu_info (); -sprintf (system_utsname.machine,"%s" , list->arch_name); +sprintf (init_utsname ()->machine,"%s" , list->arch_name);sprintf (elf_platform,"%s" , list->elf_name); elf_hwcap = list->elf_hwcap;
arch/cris/kernel/setup.c +1 -1
@@ -161,7 +161,7 @@ setup_arch(char **cmdline_p)show_etrax_copyright ();/* Setup utsname */ -strcpy (system_utsname.machine, cris_machine_name); +strcpy (init_utsname ()->machine, cris_machine_name); }static void *c_start (struct seq_file *m,loff_t *pos)
arch/i386/kernel/process.c +3 -3
@@ -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_utsname ()->release, + (int )strcspn (init_utsname ()->version," " ), +init_utsname ()->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",
arch/i386/kernel/traps.c +3 -3
@@ -260,9 +260,9 @@ void show_registers(struct pt_regs *regsprintk (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_utsname ()->release, + (int )strcspn (init_utsname ()->version," " ), +init_utsname ()->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);
arch/powerpc/kernel/process.c +1 -1
@@ -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_utsname ()->release);printk ("MSR: " REG " " , regs->msr);printbits (regs->msr, msr_bits);printk (" CR: %08lX XER: %08lX\n" , regs->ccr, regs->xer);
arch/powerpc/kernel/setup_64.c +1 -1
@@ -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_utsname ()->version);printk ("-----------------------------------------------------\n" );printk ("ppc64_pft_size = 0x%lx\n" , ppc64_pft_size);
arch/powerpc/platforms/pseries/setup.c +1 -1
@@ -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_utsname ()->version,0 );return 0 ; }
arch/sh/kernel/setup.c +1 -1
@@ -481,7 +481,7 @@ static int show_cpuinfo(struct seq_fileseq_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_utsname ()->machine);seq_printf (m,"cpu type\t: %s\n" ,get_cpu_subtype ());show_cpuflags (m);
arch/um/kernel/um_arch.c +3 -3
@@ -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_utsname ()->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_utsname ()->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_utsname ()->machine);#ifdef CONFIG_CMDLINE_ON_HOST argv1_begin = argv[1 ];
arch/um/sys-x86_64/sysrq.c +1 -1
@@ -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_utsname ()->release);printk ("RIP: %04lx:[<%016lx>] " ,PT_REGS_CS (regs) &0xffff ,PT_REGS_RIP (regs)); printk("\nRSP: %016lx EFLAGS: %08lx\n", PT_REGS_RSP(regs),
arch/x86_64/kernel/process.c +3 -3
@@ -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_utsname ()->release, + (int )strcspn (init_utsname ()->version," " ), +init_utsname ()->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,
drivers/infiniband/hw/ipath/ipath_verbs.c +1 -1
@@ -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_utsname ()->nodename); ret =ib_register_device (dev);if (ret)
drivers/parisc/led.c +1 -1
@@ -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_utsname ()->release);/* Work around the buggy PDC of KittyHawk-machines */ switch (CPU_HVERSION ) {
drivers/scsi/lpfc/lpfc_ct.c +4 -4
@@ -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_utsname ()->sysname,init_utsname ()->release, +init_utsname ()->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_utsname ()->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_utsname ()->nodename[0 ] !='\0' ) {lpfc_fdmi_cmd (phba, ndlp,SLI_MGMT_DHBA ); }else {mod_timer (&phba->fc_fdmitmo, jiffies +HZ *60 );
drivers/usb/core/hcd.c +2 -2
@@ -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_utsname ()->sysname, +init_utsname ()->release, hcd->driver->description);// unsupported IDs --> "protocol stall" }else
drivers/usb/gadget/ether.c +1 -1
@@ -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_utsname ()->sysname,init_utsname ()->release, gadget->name);/* If there's an RNDIS configuration, that's what Windows wants to
drivers/usb/gadget/file_storage.c +1 -1
@@ -3965,7 +3965,7 @@ static int __init fsg_bind(struct usb_gausb_gadget_set_selfpowered (gadget);snprintf (manufacturer,sizeof manufacturer,"%s %s with %s" , - system_utsname.sysname, system_utsname.release, +init_utsname ()->sysname,init_utsname ()->release, gadget->name);/* On a real device, serial[] would be loaded from permanent
drivers/usb/gadget/serial.c +1 -1
@@ -1496,7 +1496,7 @@ static int __init gs_bind(struct usb_gadreturn -ENOMEM ;snprintf (manufacturer,sizeof (manufacturer),"%s %s with %s" , - system_utsname.sysname, system_utsname.release, +init_utsname ()->sysname,init_utsname ()->release, gadget->name);memset (dev,0 ,sizeof (struct gs_dev ));
drivers/usb/gadget/zero.c +1 -1
@@ -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_utsname ()->sysname,init_utsname ()->release, gadget->name);return 0 ;
include/asm-i386/bugs.h +1 -1
@@ -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_utsname ()->machine[1 ] ='0' + (boot_cpu_data.x86 >6 ?6 : boot_cpu_data.x86);alternative_instructions (); }
include/asm-sh/bugs.h +1 -1
@@ -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_utsname ()->machine[2 ];/* "sh" */ cpu_data->loops_per_jiffy = loops_per_jiffy;
kernel/power/snapshot.c +5 -5
@@ -523,7 +523,7 @@ static void init_header(struct swsusp_inmemset (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_utsname (),sizeof (struct new_utsname )); 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_utsname ()->sysname)) reason ="system type" ; -if (strcmp (info->uts.release,system_utsname.release)) +if (strcmp (info->uts.release,init_utsname ()->release)) reason ="kernel release" ; -if (strcmp (info->uts.version,system_utsname.version)) +if (strcmp (info->uts.version,init_utsname ()->version)) reason ="version" ; -if (strcmp (info->uts.machine,system_utsname.machine)) +if (strcmp (info->uts.machine,init_utsname ()->machine)) reason ="machine" ;if (reason) {printk (KERN_ERR "swsusp: Resume mismatch: %s\n" , reason);
net/ipv4/ipconfig.c +1 -1
@@ -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_utsname ()->nodename,"%u.%u.%u.%u" ,NIPQUAD (ic_myaddr));if (root_server_addr ==INADDR_NONE ) root_server_addr = ic_servaddr;
sound/core/info_oss.c +5 -5
@@ -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_utsname ()->sysname, +init_utsname ()->nodename, +init_utsname ()->release, +init_utsname ()->version, +init_utsname ()->machine);snd_iprintf (buffer,"Config options: 0\n" );snd_iprintf (buffer,"\nInstalled drivers: \n" );snd_iprintf (buffer,"Type 10: ALSA emulation\n" );
Signature · 1 line
1.1.6
Quoted 3 lines · Serge E. Hallyn
Here is a new version of the
init_utsnamepatch. I'm sending a new version of theutsname()patch in reply to the original [2/7] patch.
Then again, I can't find the rest of the /7 series. I'm assuming at least those cc:d got the full set, so will the resend.
Here is the updated the utsname() usage patch.
From: Serge Hallyn <[email protected]>
Subject: [PATCH 2/7] uts namespaces: 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
---
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/asm-i386/elf.h | 2 +- include/linux/lockd/lockd.h | 2 +- kernel/sys.c | 14 +++++++------- net/ipv4/ipconfig.c | 14 +++++++------- net/sunrpc/clnt.c | 4 ++-- 35 files changed, 131 insertions(+), 131 deletions(-)
dd728b16d71caef35e6c5b55fff9f39a4ca1c0b1
arch/alpha/kernel/osf_sys.c +12 -12
@@ -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, intdown_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 */
arch/i386/kernel/sys_i386.c +6 -6
@@ -210,7 +210,7 @@ asmlinkage int sys_uname(struct old_utsnif (!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 oldoldown_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);
arch/ia64/sn/kernel/sn2/sn_hwperf.c +1 -1
@@ -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);
arch/m32r/kernel/sys_m32r.c +1 -1
@@ -206,7 +206,7 @@ asmlinkage int sys_uname(struct old_utsnif (!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 ; }
arch/mips/kernel/linux32.c +1 -1
@@ -1100,7 +1100,7 @@ asmlinkage long sys32_newuname(struct neint 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);
arch/mips/kernel/syscall.c +9 -9
@@ -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 oldolif (!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, lonreturn -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 ; }
arch/mips/kernel/sysirix.c +6 -6
@@ -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);
arch/parisc/hpux/sys_hpux.c +11 -11
@@ -266,15 +266,15 @@ static int hpux_uname(struct hpux_utsnamdown_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 ldown_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:
arch/powerpc/kernel/syscalls.c +7 -7
@@ -260,7 +260,7 @@ long ppc_newuname(struct new_utsname __uint 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 __userint 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);
arch/sh/kernel/sys_sh.c +1 -1
@@ -267,7 +267,7 @@ asmlinkage int sys_uname(struct old_utsnif (!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 ; }
arch/sh64/kernel/sys_sh64.c +1 -1
@@ -279,7 +279,7 @@ asmlinkage int sys_uname(struct old_utsnif (!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 ; }
arch/sparc/kernel/sys_sparc.c +2 -2
@@ -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:
arch/sparc/kernel/sys_sunos.c +5 -5
@@ -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 ;
arch/sparc64/kernel/sys_sparc.c +2 -2
@@ -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:
arch/sparc64/kernel/sys_sunos32.c +5 -5
@@ -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 );
arch/sparc64/solaris/misc.c +3 -3
@@ -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 ;
arch/um/drivers/mconsole_kern.c +3 -3
@@ -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 ); }
arch/um/kernel/syscall_kern.c +6 -6
@@ -110,7 +110,7 @@ long sys_uname(struct old_utsname __userif (!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_utsnamedown_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);
arch/um/sys-x86_64/syscalls.c +1 -1
@@ -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 );
arch/x86_64/ia32/sys_ia32.c +5 -5
@@ -801,13 +801,13 @@ asmlinkage long sys32_olduname(struct oldown_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 __usif (!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 );
arch/x86_64/kernel/sys_x86_64.c +1 -1
@@ -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 );
arch/xtensa/kernel/syscalls.c +1 -1
@@ -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 ; }
drivers/char/random.c +2 -2
@@ -888,8 +888,8 @@ static void init_std_data(struct entropydo_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 )
fs/cifs/connect.c +14 -14
@@ -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 xistrcpy (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 */
fs/exec.c +1 -1
@@ -1347,7 +1347,7 @@ static void format_corename(char *corenacase '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;
fs/lockd/clntproc.c +2 -2
@@ -130,11 +130,11 @@ static void nlmclnt_setlockargs(struct nnlmclnt_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;
fs/lockd/mon.c +1 -1
@@ -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);
fs/lockd/svclock.c +1 -1
@@ -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 */
fs/lockd/xdr.c +1 -1
@@ -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)
fs/nfs/nfsroot.c +1 -1
@@ -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 ;
include/asm-i386/elf.h +1 -1
@@ -108,7 +108,7 @@ typedef struct user_fxsr_struct elf_fpxrFor the moment, we have only optimizations for the Intel generations, but that could change... */ -#define ELF_PLATFORM (system_utsname.machine) +#define ELF_PLATFORM (utsname()->machine)#ifdef __KERNEL__#define SET_PERSONALITY (ex, ibcs2) do { } while (0)
include/linux/lockd/lockd.h +1 -1
@@ -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 */
kernel/sys.c +7 -7
@@ -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 __udown_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 __uif (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);
net/ipv4/ipconfig.c +7 -7
@@ -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 (utsname ()->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 *eic_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 (utsname ()->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); +utsname ()->nodename, ic_domain,utsname ()->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(ccase 4 :if ((dp =strchr (ip,'.' ))) { *dp++ ='\0' ; -strlcpy (system_utsname.domainname, dp, -sizeof (system_utsname.domainname)); +strlcpy (utsname ()->domainname, dp, +sizeof (utsname ()->domainname)); } -strlcpy (system_utsname.nodename, ip, -sizeof (system_utsname.nodename)); +strlcpy (utsname ()->nodename, ip, +sizeof (utsname ()->nodename)); ic_host_name_set =1 ;break ;case 5 :
net/sunrpc/clnt.c +2 -2
@@ -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 (utsname ()->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,utsname ()->nodename, clnt->cl_nodelen);return clnt; out_no_auth:
Signature · 1 line
1.1.6
Quoted 8 lines · Eric W. Biederman
Review
Quoted 5 lines
(quoted diff) +1
-1-#define ELF_PLATFORM (system_utsname.machine) +#define ELF_PLATFORM (init_utsname()->machine) #ifdef __KERNEL__ #define SET_PERSONALITY(ex, ibcs2) do { } while (0)I think this one needs to be utsname()->machine. Currently it doesn't matter. But Herbert has expressed the desire to make a machine appear like an older one.
This is extremely useful for faking it as "i386" on x86_64 systems, for instance.
Sam.
Quoted 16 lines · Sam Vilain
Quoted 12 lines · Eric W. Biederman
Quoted 7 lines
(quoted diff) +1
-1-#define ELF_PLATFORM (system_utsname.machine) +#define ELF_PLATFORM (init_utsname()->machine)#ifdef
__KERNEL__
#defineSET_PERSONALITY(ex, ibcs2)do { } while (0)I think this one needs to be utsname()->machine. Currently it doesn't matter. But Herbert has expressed the desire to make a machine appear like an older one.
Quoted 4 lines
This is extremely useful for faking it as "i386" on
x86_64systems, for instance.
Could 'setarch' be of any help here? Works fine for us. Or am I missing something?
Quoted 17 lines · Kir Kolyshkin
Quoted 15 lines · Sam Vilain
Quoted 11 lines · Eric W. Biederman
Quoted 6 lines
(quoted diff) +1
-1-#define ELF_PLATFORM (system_utsname.machine) +#define ELF_PLATFORM (init_utsname()->machine)#ifdef
__KERNEL__
#defineSET_PERSONALITY(ex, ibcs2)do { } while (0)I think this one needs to be utsname()->machine. Currently it doesn't matter. But Herbert has expressed the desire to make a machine appear like an older one.
Quoted 6 lines
Quoted 4 lines
This is extremely useful for faking it as "i386" on
x86_64systems, for instance.Could 'setarch' be of any help here? Works fine for us. Or am I missing something?
For the specific case that is clearly the better solution, as it already exists, and it handles the weird 32/64bit logic. The ELF_PLATFORM bit I was commenting on was 32bit only.
I'm not ready to implement any new functionality at the moment, but what I heard suggested and was it may be reasonable to allow machine to be modified on a per uts namespace basis. If that kind of thing is ever to happen ELF_PLATFORM needs to be per uts on x86. Actually allowing modification of machine is an entirely different conversation.
Eric
Re: [PATCH 0/7] uts namespaces: Introduction
In reply to a message not in the archiveSerge,
I have just imported your series into the GIT repository where I have been collating the various recent related submissions at:
git://vserver.utsl.gen.nz/vserver
A summary of the submissions imported to date are at:
http://www.utsl.gen.nz/gitweb/?p=vserver;a=heads
I will endeavour to continue to collect and catalogue all vserver related submissions I receive, see on LKML, or get pull requests for, as a part of my efforts to merge this functionality.
Sam.
Quoted 25 lines · Serge E. Hallyn
Introduce utsname namespaces. Instead of a single
system_utsnamecontaining 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.
Aside from the debugging patch which comes last, this patchset does not actually implement a way for processes to unshare the uts namespace. The proper unsharing semantics are to be worked out later.
Changes since last submission:
Restructured patchset so it compiles after each patch RemovedEXPORT_SYMBOLforunshare_uts_nsandfree_uts_ns.
The former is now in the debugging pach and the latter gone entirely, as unsharing is likely not something to be done from modules!-serge
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [Devel] [PATCH 4/7] uts namespaces: implement utsname namespaces
Quoted 13 lines · Serge E. Hallyn
...
(quoted diff) +5
-7-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 = {
Review
Quoted 10 lines
(quoted diff) +7
-1+ .sysname = UTS_SYSNAME, + .nodename = UTS_NODENAME, + .release = UTS_RELEASE, + .version = UTS_VERSION, + .machine = UTS_MACHINE, + .domainname = UTS_DOMAINNAME, + }, }; -EXPORT_SYMBOL(system_utsname);
this should problably be replaced with
EXPORT_SYMBOL(init_uts_ns);
or export init_utsname().
C.
Re: [Devel] [PATCH 4/7] uts namespaces: implement utsname namespaces
Quoted 23 lines · Cedric Le Goater
Quoted 22 lines · Serge E. Hallyn
...
(quoted diff) +12
-7-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, + }, };
Quoted 7 lines
Quoted 1 line
-EXPORT_SYMBOL(system_utsname);
this should problably be replaced with
EXPORT_SYMBOL(init_uts_ns);or export
init_utsname().
True, here's an updated version of the uts_ns introduction patch.
From: Serge Hallyn <[email protected]>
Subject: [PATCH 4/7] This patch defines the uts namespace and some manipulators.
Adds the uts namespace to task_struct, and initializes a system-wide init namespace.
It leaves a #define for system_utsname so sysctl will compile. This define will be removed in a separate patch.
Changes:
Export init_uts_ns.
---
include/linux/init_task.h | 2 + include/linux/sched.h | 2 + include/linux/utsname.h | 43 +++++++++++++++++++++++++--- init/Kconfig | 8 +++++ init/version.c | 69 ++++++++++++++++++++++++++++++++++++++++----- kernel/exit.c | 2 + kernel/fork.c | 9 +++++- 7 files changed, 121 insertions(+), 14 deletions(-)
087afa02b1165104da8352cbf35512cf0c681f2f
include/linux/init_task.h +2 -0
@@ -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, \ }
include/linux/sched.h +2 -0
@@ -684,6 +684,7 @@ static inline void prefetch_stack(structstruct 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;
include/linux/utsname.h +39 -4
59 lines not on this page · raw message
init/Kconfig +8 -0
@@ -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
init/version.c +61 -8
83 lines not on this page · raw message
kernel/exit.c +2 -0
@@ -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;
kernel/fork.c +7 -2
@@ -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 lonspin_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 lonspin_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 lonproc_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:
Signature · 1 line
1.1.6