mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serue@us.ibm.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: "Serge E. Hallyn" <serue@us.ibm.com>,
	linux-kernel@vger.kernel.org, Kirill Korotaev <dev@sw.ru>,
	herbert@13thfloor.at, devel@openvz.org, sam@vilain.net,
	xemul@sw.ru, James Morris <jmorris@namei.org>
Subject: Re: [PATCH 3/7] uts namespaces: use init_utsname when appropriate
Date: Sat, 8 Apr 2006 15:27:01 -0500	[thread overview]
Message-ID: <20060408202701.GA26403@sergelap.austin.ibm.com> (raw)
In-Reply-To: <m1psjslf1s.fsf@ebiederm.dsl.xmission.com>

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 = 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.

thanks,
-serge

  reply	other threads:[~2006-04-08 20:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20060407234815.849357768@sergelap>
     [not found] ` <20060408045206.EAA8E19B8FF@sergelap.hallyn.com>
2006-04-08  7:09   ` Eric W. Biederman
2006-04-08 20:27     ` Serge E. Hallyn [this message]
2006-04-09  9:44       ` Eric W. Biederman
2006-04-09 10:14         ` Christoph Hellwig
2006-04-09 10:25           ` Christoph Hellwig
2006-04-09 10:36             ` Eric W. Biederman
2006-04-10 20:39         ` Serge E. Hallyn
2006-04-10 20:46           ` Serge E. Hallyn
2006-04-08 23:44     ` Sam Vilain
2006-04-09  0:12       ` [Devel] " Kir Kolyshkin
2006-04-09  9:25         ` Eric W. Biederman
2006-04-10  1:15 ` [PATCH 0/7] uts namespaces: Introduction Sam Vilain
     [not found] ` <20060408045206.EFDD819B901@sergelap.hallyn.com>
2006-04-10 16:06   ` [Devel] [PATCH 4/7] uts namespaces: implement utsname namespaces Cedric Le Goater
2006-04-10 20:48     ` Serge E. Hallyn
2006-05-01 19:53 [PATCH 2/7] uts namespaces: switch to using uts namespaces Serge E. Hallyn
2006-05-01 19:53 ` [PATCH 3/7] uts namespaces: use init_utsname when appropriate Serge E. Hallyn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060408202701.GA26403@sergelap.austin.ibm.com \
    --to=serue@us.ibm.com \
    --cc=dev@sw.ru \
    --cc=devel@openvz.org \
    --cc=ebiederm@xmission.com \
    --cc=herbert@13thfloor.at \
    --cc=jmorris@namei.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sam@vilain.net \
    --cc=xemul@sw.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®