Linux Container Development
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: "Serge E. Hallyn" <serue@us.ibm.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Linux Containers <containers@lists.osdl.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] utsns: Restore proper namespace handling.
Date: Mon, 26 Nov 2007 22:55:17 -0800	[thread overview]
Message-ID: <20071126225517.0245a86d.akpm@linux-foundation.org> (raw)
In-Reply-To: <20071126151917.GF547@sergelap.austin.ibm.com>

On Mon, 26 Nov 2007 09:19:17 -0600 "Serge E. Hallyn" <serue@us.ibm.com> wrote:

> Quoting Eric W. Biederman (ebiederm@xmission.com):
> > 
> > When CONFIG_UTS_NS was removed it seems that we also deleted
> > the code for handling sysctls in the other then the initial
> > uts namespace.   This patch restores that code.
> > 
> > Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
> 
> Thanks, Eric.
> 
> Acked-by: Serge Hallyn <serue@us.ibm.com>
> 
> > ---
> >  kernel/utsname_sysctl.c |    2 ++
> >  1 files changed, 2 insertions(+), 0 deletions(-)
> > 
> > diff --git a/kernel/utsname_sysctl.c b/kernel/utsname_sysctl.c
> > index c76c064..71f58c3 100644
> > --- a/kernel/utsname_sysctl.c
> > +++ b/kernel/utsname_sysctl.c
> > @@ -18,6 +18,8 @@
> >  static void *get_uts(ctl_table *table, int write)
> >  {
> >  	char *which = table->data;
> > +	struct uts_namespace *uts_ns = current->nsproxy->uts_ns;
> > +	which = (which - (char *)&init_uts_ns) + (char *)uts_ns;
> > 
> >  	if (!write)
> >  		down_read(&uts_sem);

I already have a (more codingstylely attractive) version of this from
Pavel, for which I shall steal your ack.

--- a/kernel/utsname_sysctl.c~isolate-the-uts-namespaces-domainname-and-hostname-back
+++ a/kernel/utsname_sysctl.c
@@ -18,6 +18,10 @@
 static void *get_uts(ctl_table *table, int write)
 {
 	char *which = table->data;
+	struct uts_namespace *uts_ns;
+
+	uts_ns = current->nsproxy->uts_ns;
+	which = (which - (char *)&init_uts_ns) + (char *)uts_ns;
 
 	if (!write)
 		down_read(&uts_sem);
_


Those pointer tricksies are revolting.  What's going on in there?

  reply	other threads:[~2007-11-27  6:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-23 19:25 [PATCH] utsns: Restore proper namespace handling Eric W. Biederman
2007-11-26 15:19 ` Serge E. Hallyn
2007-11-27  6:55   ` Andrew Morton [this message]
2007-11-27  9:20     ` Eric W. Biederman
2007-11-27 16:28     ` 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=20071126225517.0245a86d.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=containers@lists.osdl.org \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=serue@us.ibm.com \
    --cc=torvalds@linux-foundation.org \
    /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