OpenVZ Forum


Home » Mailing lists » Devel » [PATCH] Isolate the UTS namespace's domainname and hostname back
[PATCH] Isolate the UTS namespace's domainname and hostname back [message #23637] Wed, 21 November 2007 11:06 Go to next message
Pavel Emelianov is currently offline  Pavel Emelianov
Messages: 1149
Registered: September 2006
Senior Member
The commit

commit 7d69a1f4a72b18876c99c697692b78339d491568
Author: Cedric Le Goater <clg@fr.ibm.com>
Date:   Sun Jul 15 23:40:58 2007 -0700

    remove CONFIG_UTS_NS and CONFIG_IPC_NS

accidentally removed the code, that prevented the uts->hostname
and uts->domainname values from being overwritten from another
namespace. In other words, setting hostname/domainname via sysfs 
(echo xxx > /proc/sys/kernel/(host|domain)name) cased the new
value to be set in init UTS namespace only.

Return the isolation back.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

---

diff --git a/kernel/utsname_sysctl.c b/kernel/utsname_sysctl.c
index c76c064..fe3a56c 100644
--- a/kernel/utsname_sysctl.c
+++ b/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);
_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
Re: [PATCH] Isolate the UTS namespace's domainname and hostname back [message #23639 is a reply to message #23637] Wed, 21 November 2007 11:14 Go to previous message
Cedric Le Goater is currently offline  Cedric Le Goater
Messages: 443
Registered: February 2006
Senior Member
Pavel Emelyanov wrote:
> The commit
> 
> commit 7d69a1f4a72b18876c99c697692b78339d491568
> Author: Cedric Le Goater <clg@fr.ibm.com>
> Date:   Sun Jul 15 23:40:58 2007 -0700
> 
>     remove CONFIG_UTS_NS and CONFIG_IPC_NS
> 
> accidentally removed the code, that prevented the uts->hostname
> and uts->domainname values from being overwritten from another
> namespace. In other words, setting hostname/domainname via sysfs 
> (echo xxx > /proc/sys/kernel/(host|domain)name) cased the new
> value to be set in init UTS namespace only.
> 
> Return the isolation back.

yep. sorry about that. I was going to send the same patch in a 
minute. 

> Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

Acked-by: Cedric Le Goater <clg@fr.ibm.com>

Thanks,

C.
_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
Previous Topic: [PATCH (resend)][DOCUMENTATION] The namespaces compatibility list doc
Next Topic: [PATCH][DOCUMENTATION] The namespaces compatibility list doc
Goto Forum:
  


Current Time: Fri Sep 12 14:56:51 GMT 2025

Total time taken to generate the page: 0.14427 seconds