[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20101209173050.GA10206@mail.hallyn.com>
Date: Thu, 9 Dec 2010 17:30:50 +0000
From: "Serge E. Hallyn" <serge@...lyn.com>
To: LSM <linux-security-module@...r.kernel.org>
Cc: containers@...ts.linux-foundation.org,
Kees Cook <kees.cook@...onical.com>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
kernel list <linux-kernel@...r.kernel.org>
Subject: [RFC PATCH 3/4] allow sethostname in a container
To test this, you can:
1. clone a new user namespace without a new uts namespace.
You can NOT set hostname.
2. clone both a new user and uts namespace. You can set
hostname.
Signed-off-by: Serge E. Hallyn <serge.hallyn@...onical.com>
---
kernel/sys.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/kernel/sys.c b/kernel/sys.c
index 2745dcd..9b9b03b 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -1171,7 +1171,7 @@ SYSCALL_DEFINE2(sethostname, char __user *, name, int, len)
int errno;
char tmp[__NEW_UTS_LEN];
- if (!capable(CAP_SYS_ADMIN))
+ if (!ns_capable(current->nsproxy->uts_ns->user_ns, CAP_SYS_ADMIN))
return -EPERM;
if (len < 0 || len > __NEW_UTS_LEN)
return -EINVAL;
--
1.7.2.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists