Linux Container Development
 help / color / mirror / Atom feed
* [PATCH] utsns: Restore proper namespace handling.
@ 2007-11-23 19:25 Eric W. Biederman
  2007-11-26 15:19 ` Serge E. Hallyn
  0 siblings, 1 reply; 5+ messages in thread
From: Eric W. Biederman @ 2007-11-23 19:25 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Andrew Morton, Linux Containers, linux-kernel


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>
---
 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);
-- 
1.5.3.rc6.17.g1911

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] utsns: Restore proper namespace handling.
  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
  0 siblings, 1 reply; 5+ messages in thread
From: Serge E. Hallyn @ 2007-11-26 15:19 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: Linus Torvalds, Linux Containers, Andrew Morton, linux-kernel

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);
> -- 
> 1.5.3.rc6.17.g1911
> 
> _______________________________________________
> Containers mailing list
> Containers@lists.linux-foundation.org
> https://lists.linux-foundation.org/mailman/listinfo/containers

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] utsns: Restore proper namespace handling.
  2007-11-26 15:19 ` Serge E. Hallyn
@ 2007-11-27  6:55   ` Andrew Morton
  2007-11-27  9:20     ` Eric W. Biederman
  2007-11-27 16:28     ` Serge E. Hallyn
  0 siblings, 2 replies; 5+ messages in thread
From: Andrew Morton @ 2007-11-27  6:55 UTC (permalink / raw)
  To: Serge E. Hallyn
  Cc: Eric W. Biederman, Linus Torvalds, Linux Containers, linux-kernel

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?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] utsns: Restore proper namespace handling.
  2007-11-27  6:55   ` Andrew Morton
@ 2007-11-27  9:20     ` Eric W. Biederman
  2007-11-27 16:28     ` Serge E. Hallyn
  1 sibling, 0 replies; 5+ messages in thread
From: Eric W. Biederman @ 2007-11-27  9:20 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Serge E. Hallyn, Linus Torvalds, Linux Containers, linux-kernel

Andrew Morton <akpm@linux-foundation.org> writes:


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

Perfectly fine.  I overlooked that one when I generated this patch
the first time (Oops). Let's just get this bug fixed.

Eric

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] utsns: Restore proper namespace handling.
  2007-11-27  6:55   ` Andrew Morton
  2007-11-27  9:20     ` Eric W. Biederman
@ 2007-11-27 16:28     ` Serge E. Hallyn
  1 sibling, 0 replies; 5+ messages in thread
From: Serge E. Hallyn @ 2007-11-27 16:28 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Serge E. Hallyn, Eric W. Biederman, Linus Torvalds,
	Linux Containers, linux-kernel

Quoting Andrew Morton (akpm@linux-foundation.org):
> 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.

Cool, thanks.

> --- 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?

This is true.  There is only one sysctl table, and it's data points
to the location of the desired field in the initial namespace.  So
the trickery finds the same field in the target namespace.

I believe Eric and Pavel are working on a patchset that will make
this trickery unnecessary by having sort of shadow sysctls.

-serge

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-11-27 16:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2007-11-27  9:20     ` Eric W. Biederman
2007-11-27 16:28     ` Serge E. Hallyn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox