OpenVZ Forum - RDF feed
type: channel
items: [PATCH 3/7] uts namespaces: use init_utsname when appropriate
items: Re: [PATCH 3/7] uts namespaces: use init_utsname when appropriate
items: Re: Re: [PATCH 3/7] uts namespaces: use init_utsname when appropriate

[PATCH 3/7] uts namespaces: use init_utsname when appropriate
type: item
description: 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. Signed-off-by: Serge E. Hallyn <serue@us.ibm.com> --- arch/arm/kernel/setup.c | 2 +- arch/arm26/kernel/setup.c | 2 +- arch/cris/kernel/setup.c | 2 +- arch/i386/kernel/process.c | 6 +++--- arch/i386/kernel/traps.c | 6 +++--- arch/powerpc/kernel/process.c | 2 +- arch/powerpc/kernel/setup_64.c | 2 +- arch/powerpc/platforms/pseries/setup.c | 2 +- arch/sh/kernel/setup.c | 2 +- arch/um/kernel/um_arch.c | 6 +++--- arch/um/sys-x86_64/sysrq.c | 2 +- arch/x86_64/kernel/process.c | 6 +++--- drivers/infiniband/hw/ipath/ipath_verbs.c | 2 +- drivers/parisc/led.c | 2 +- drivers/scsi/lpfc/lpfc_ct.c | 8 ++++---- drivers/usb/core/hcd.c | 4 ++-- drivers/usb/gadget/ether.c | 2 +- drivers/usb/gadget/file_storage.c | 2 +- drivers/usb/gadget/serial.c | 2 +- drivers/usb/gadget/zero.c | 2 +- include/asm-i386/bugs.h | 2 +- include/asm-i386/elf.h | 2 +- include/asm-sh/bugs.h | 2 +- kernel/power/snapshot.c | 10 +++++----- net/ipv4/ipconfig.c | 16 ++++++++-------- net/sunrpc/clnt.c | 4 ++-- sound/core/info_oss.c | 10 +++++----- 27 files changed, 55 insertions(+), 55 deletions(-) 65af7f7767c4447ccb3fafa6580844f4a65bcfdc diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 4375284..a4dc8de 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -319,7 +319,7 @@ static void __init setup_processor(void) cpu_name, processor_id, (int)processor_id & 15, proc_arch[cpu_architecture()]); - sprintf(system_utsname.machine, "%s%c", list->arch_name, ENDIANNESS); + sprintf(init_utsname()->machine, "%s%c", list->arch_name, ENDIANNESS); sprintf(elf_platform, "%s%c", list->elf_name, ENDIANNESS); elf_hwcap = list->elf_hwcap; diff --git a/arch/arm26/kernel/setup.c b/arch/arm26/kernel/setup.c index 4eb329e..8e6a441 100644 --- a/arch/arm26/kernel/setup.c +++ b/arch/arm26/kernel/setup.c @@ -144,7 +144,7 @@ static void __init setup_p…
creator: serue
date: 2006-04-08T04:52:06-00:00

Re: [PATCH 3/7] uts namespaces: use init_utsname when appropriate
type: item
description: "Serge E. Hallyn" <serue@us.ibm.com> writes: > diff --git a/include/asm-i386/elf.h b/include/asm-i386/elf.h > index 4153d80..8d455e2 100644 > --- a/include/asm-i386/elf.h > +++ b/include/asm-i386/elf.h > @@ -108,7 +108,7 @@ typedef struct user_fxsr_struct elf_fpxr > For the moment, we have only optimizations for the Intel generations, > but that could change... */ > > -#define ELF_PLATFORM (system_utsname.machine) > +#define ELF_PLATFORM (init_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. > diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c > index cb8a92f..81db372 100644 > --- a/net/ipv4/ipconfig.c > +++ b/net/ipv4/ipconfig.c > @@ -367,7 +367,7 @@ static int __init ic_defaults(void) > */ > > if (!ic_host_name_set) > - sprintf(system_utsname.nodename, "%u.%u.%u.%u", NIPQUAD(ic_myaddr)); > + sprintf(init_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 *e > ic_bootp_string(root_server_path, ext+1, *ext, > sizeof(root_server_path)); > break; > case 40: /* NIS Domain name (_not_ DNS) */ > - ic_bootp_string(system_utsname.domainname, ext+1, *ext, __NEW_UTS_LEN); > + ic_bootp_string(init_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…
creator: ebiederm
date: 2006-04-08T07:09:03-00:00

Re: [PATCH 3/7] uts namespaces: use init_utsname when appropriate
type: item
description: Quoting Eric W. Biederman (ebiederm@xmission.com): > "Serge E. Hallyn" <serue@us.ibm.com> writes: > > > diff --git a/include/asm-i386/elf.h b/include/asm-i386/elf.h > > index 4153d80..8d455e2 100644 > > --- a/include/asm-i386/elf.h > > +++ b/include/asm-i386/elf.h > > @@ -108,7 +108,7 @@ typedef struct user_fxsr_struct elf_fpxr > > For the moment, we have only optimizations for the Intel generations, > > but that could change... */ > > > > -#define ELF_PLATFORM (system_utsname.machine) > > +#define ELF_PLATFORM (init_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. Ok. > > diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c > > index cb8a92f..81db372 100644 ... > > @@ -1479,11 +1479,11 @@ static int __init ip_auto_config_setup(c > > case 4: > > if ((dp = strchr(ip, '.'))) { > > *dp++ = '\0'; > > - strlcpy(system_utsname.domainname, dp, > > - sizeof(system_utsname.domainname)); > > + strlcpy(init_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. Right, I was kind of favoring using init_utsname() for anything __init. But utsname() will of course work just as well there. > > diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c > > index aa8965e..97c8439 100644 > > --- a/net/sunrpc/clnt.c > > +++ b/net/sunrpc/clnt.c > > @@ -176,10 +176,10 @@ rpc_new_client(struct rpc_xprt *xprt, ch > > } > > > > /* save the nodename */ > > - clnt->cl_nodelen …
creator: serue
date: 2006-04-08T20:27:01-00:00

Re: [PATCH 3/7] uts namespaces: use init_utsname when appropriate
type: item
description: On Sat, 2006-04-08 at 01:09 -0600, Eric W. Biederman wrote: > > -#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.
creator: Sam Vilain
date: 2006-04-08T23:44:39-00:00

Re: Re: [PATCH 3/7] uts namespaces: use init_utsname when appropriate
type: item
description: Sam Vilain wrote: >On Sat, 2006-04-08 at 01:09 -0600, Eric W. Biederman wrote: > > >>>-#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. > > Could 'setarch' be of any help here? Works fine for us. Or am I missing something?
creator: kir
date: 2006-04-09T00:12:58-00:00

Re: Re: [PATCH 3/7] uts namespaces: use init_utsname when appropriate
type: item
description: Kir Kolyshkin <kir@openvz.org> writes: > Sam Vilain wrote: > >>On Sat, 2006-04-08 at 01:09 -0600, Eric W. Biederman wrote: >> >> >>>>-#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. >> >> > 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
creator: ebiederm
date: 2006-04-09T09:25:04-00:00

Re: [PATCH 3/7] uts namespaces: use init_utsname when appropriate
type: item
description: "Serge E. Hallyn" <serue@us.ibm.com> writes: >> 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. 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. >> > diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c >> > index aa8965e..97c8439 100644 >> > --- a/net/sunrpc/clnt.c >> > +++ b/net/sunrpc/clnt.c >> > @@ -176,10 +176,10 @@ rpc_new_client(struct rpc_xprt *xprt, ch >> > } >> > >> > /* save the nodename */ >> > - clnt->cl_nodelen = strlen(system_utsname.nodename); >> > + clnt->cl_nodelen = strlen(init_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. > > 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. 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 havi…
creator: ebiederm
date: 2006-04-09T09:44:19-00:00

Re: [PATCH 3/7] uts namespaces: use init_utsname when appropriate
type: item
description: On Sun, Apr 09, 2006 at 03:44:19AM -0600, Eric W. Biederman wrote: > 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. 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.
creator: Christoph Hellwig
date: 2006-04-09T10:14:36-00:00

Re: [PATCH 3/7] uts namespaces: use init_utsname when appropriate
type: item
description: Quoting Eric W. Biederman (ebiederm@xmission.com): > "Serge E. Hallyn" <serue@us.ibm.com> writes: > > >> 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. > > 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 <serue@us.ibm.com> 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) Signed-off-by: Serge E. Hallyn <serue@us.ibm.com> --- arch/arm/kernel/setup.c | 2 +- arch/arm26/kernel/setup.c | 2 +- arch/cris/kernel/setup.c | 2 +- arch/i386/kernel/process.c | 6 +++--- arch/i386/kernel/traps.c | 6 +++--- arch/powerpc/kernel/process.c | 2 +- arch/powerpc/kernel/setup_64.c | 2 +- arch/powerpc/platforms/pseries/setup.c | 2 +- arch/sh/kernel/setup.c | 2 +- arch/um/kernel/um_arch.c | 6 +++--- arch/um/sys-x86_64/sysrq.c | 2 +- arch/x86_64/kernel/process.c | 6 +++--- drivers/infiniband/hw/ipath/ipath_verbs.c | 2 +- drivers/parisc/led.c | 2 +- drivers/scsi/lpfc/lpfc_ct.c | 8 ++++---- drivers/usb/core/hcd.c | 4 ++-- drivers/usb/gadget/ether.c | 2 +- drivers/usb/gadget/file_storage.c | 2 +- drivers/usb/gadget…
creator: serue
date: 2006-04-10T20:39:03-00:00