From patchwork Thu Oct 24 19:17:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Serge E. Hallyn" X-Patchwork-Id: 286003 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id A4FC02C00B8 for ; Fri, 25 Oct 2013 06:08:26 +1100 (EST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1VZQGX-0008RO-6J; Thu, 24 Oct 2013 19:08:17 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1VZQGR-0008Qg-Ik for kernel-team@lists.ubuntu.com; Thu, 24 Oct 2013 19:08:11 +0000 Received: from [70.35.39.20] (helo=ac100) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1VZQGR-0004g2-3v for kernel-team@lists.ubuntu.com; Thu, 24 Oct 2013 19:08:11 +0000 Date: Thu, 24 Oct 2013 14:17:24 -0500 From: Serge Hallyn To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/1] device_cgroup: remove can_attach Message-ID: <20131024191724.GB19904@ac100> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com [ Hi - the following patch has been applied to Tejun's cgroup/for-3.13 branch. It's needed for non-root users to be able to create containers ] It is really only wanting to duplicate a check which is already done by the cgroup subsystem. With this patch, user jdoe still cannot move pid 1 into a devices cgroup he owns, but now he can move his own other tasks into devices cgroups. Signed-off-by: Serge Hallyn Signed-off-by: Tejun Heo Cc: Aristeu Rozanski --- security/device_cgroup.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/security/device_cgroup.c b/security/device_cgroup.c index c123628..7c2a0a7 100644 --- a/security/device_cgroup.c +++ b/security/device_cgroup.c @@ -63,16 +63,6 @@ static inline struct dev_cgroup *task_devcgroup(struct task_struct *task) struct cgroup_subsys devices_subsys; -static int devcgroup_can_attach(struct cgroup_subsys_state *new_css, - struct cgroup_taskset *set) -{ - struct task_struct *task = cgroup_taskset_first(set); - - if (current != task && !capable(CAP_SYS_ADMIN)) - return -EPERM; - return 0; -} - /* * called under devcgroup_mutex */ @@ -697,7 +687,6 @@ static struct cftype dev_cgroup_files[] = { struct cgroup_subsys devices_subsys = { .name = "devices", - .can_attach = devcgroup_can_attach, .css_alloc = devcgroup_css_alloc, .css_free = devcgroup_css_free, .css_online = devcgroup_online,