From mboxrd@z Thu Jan 1 00:00:00 1970 From: Casey Schaufler Subject: cgroup dentry insufficiently initialized prior to calling d_instantiate. Date: Fri, 10 May 2013 15:02:36 -0700 Message-ID: <518D6E7C.9050204@schaufler-ca.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1368223355; bh=Y9pT+ZtjzdmrrMSHaLHPWolHZQZLtiY3Ss/1CkM5kTI=; h=X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:X-Rocket-Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:Content-Type:Content-Transfer-Encoding; b=oRydRNYYTcqHTjfrJuEaZcK7D1fe9O/jeySpb85DdcVgyWNEFAOo4JdQa5+FlGM4p8pnLgyIgN/ZlxZiohVJI3m2I59mop7uqyWTEbbA35WJGpT/a4jcV0XwxxhaVC9qKKSCkvGkxNgXqCafo1LuqkaHJ7S2QKOII3Ciy2wCMwg= List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org, containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, lkml-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, LSM Cc: Casey Schaufler In kernel/cgroup.c in cgroup_add_file() we have: dentry = lookup_one_len(name, dir, strlen(name)); if (IS_ERR(dentry)) { error = PTR_ERR(dentry); goto out; } mode = cgroup_file_mode(cft); error = cgroup_create_file(dentry, mode | S_IFREG, cgrp->root->sb); if (!error) { cfe->type = (void *)cft; cfe->dentry = dentry; dentry->d_fsdata = cfe; simple_xattrs_init(&cfe->xattrs); list_add_tail(&cfe->node, &parent->files); cfe = NULL; } dput(dentry); cgroup_create_file() calls d_instantiate, which may decide to look at the xattrs on the file. Smack always does this and SELinux can be configured to do so, although no one seems to be using that option. Since the dentry has not been initialized panics in __d_xattr ensue. See bugzilla 57791.