From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753207AbcGMO6p (ORCPT ); Wed, 13 Jul 2016 10:58:45 -0400 Received: from smtp.nsa.gov ([8.44.101.9]:60782 "EHLO emsm-gh1-uea11.nsa.gov" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751136AbcGMO6h (ORCPT ); Wed, 13 Jul 2016 10:58:37 -0400 X-IronPort-AV: E=Sophos;i="5.28,357,1464652800"; d="scan'208";a="17611117" IronPort-PHdr: =?us-ascii?q?9a23=3AuDfyjx3My6x5L90UsmDT+DRfVm0co7zxezQtwd8Z?= =?us-ascii?q?se4SKPad9pjvdHbS+e9qxAeQG96Ks7QY06GJ4ujJYi8p2d65qncMcZhBBVcuqP?= =?us-ascii?q?49uEgeOvODElDxN/XwbiY3T4xoXV5h+GynYwAOQJ6tL2PbrnD61zMOABK3bVMz?= =?us-ascii?q?fbWtXNKKxJvmn8mJuLTrKz1SgzS8Zb4gZD6Xli728vcsvI15N6wqwQHIqHYbM8?= =?us-ascii?q?5fxGdvOE7B102kvpT41NdZ/i9Ro/Ms8dJbGeW/JvxgDO9lFjBuD0QZrI2u70GC?= =?us-ascii?q?HkOz4S4iU3sbkVJnBBnM6FmuQJj2oyL+nvBw1CmTIYv9SrViHXyn7qRvTwTAkz?= =?us-ascii?q?UKLTM18SfXl4g4lKdcpwisjwZyz47dfMeeM/86NqjUZt4LbXFKXs9MWShMGMa3?= =?us-ascii?q?Zs0ECO9FdeJZqZTt4lgDtx2zASGyC+71jDxFnHn72es9yetlWQXH2hEwWs8IsX?= =?us-ascii?q?PSos7dKqgfS6a2wbPOwDGFaOlZnX/56Y7VYlU6rPqRR7NsYI/UzkUyEw7tkFqd?= =?us-ascii?q?s8rmMimT2+BLtHKUvMR6Uuf6sHIqswF8pHCUw84ojoTYztYOxkvs6TRywIFzI8?= =?us-ascii?q?axDkF8f4j3Q9NrqyiGOt4uEYsZSGZytXN/k+detA=3D=3D?= X-IPAS-Result: =?us-ascii?q?A2FBCgBtVYZX/wHyM5BbGgEBAQGDIIEAUqN0AQEBAQEBBpA?= =?us-ascii?q?zgiaECYYYAoEtTAEBAQEBAQICYieCMgQBEgGCEwEBBCMEUhALDQEKAgImAgJXB?= =?us-ascii?q?gEMBgIBAYgssWeOfgEBAQEBAQQBAQEBAQEhgQGEYYJACIJNh0KCWgWOB4sVjle?= =?us-ascii?q?JZoVJSI9PVIIJHIFoIDKJNwEBAQ?= Subject: Re: [PATCH 5/9] selinux: Pass security pointer to determine_inode_label() To: Vivek Goyal , miklos@szeredi.hu, pmoore@redhat.com, casey@schaufler-ca.com, linux-kernel@vger.kernel.org, linux-unionfs@vger.kernel.org, linux-security-module@vger.kernel.org References: <1468421095-22322-1-git-send-email-vgoyal@redhat.com> <1468421095-22322-6-git-send-email-vgoyal@redhat.com> Cc: dwalsh@redhat.com, dhowells@redhat.com, viro@ZenIV.linux.org.uk, linux-fsdevel@vger.kernel.org From: Stephen Smalley Organization: National Security Agency Message-ID: Date: Wed, 13 Jul 2016 10:56:56 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <1468421095-22322-6-git-send-email-vgoyal@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/13/2016 10:44 AM, Vivek Goyal wrote: > Right now selinux_determine_inode_label() works on security pointer of > current task. Soon I need this to work on a security pointer retrieved > from a set of creds. So start passing in a pointer and caller can decide > where to fetch security pointer from. > > Signed-off-by: Vivek Goyal Acked-by: Stephen Smalley > --- > security/selinux/hooks.c | 19 ++++++++++--------- > 1 file changed, 10 insertions(+), 9 deletions(-) > > diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c > index 4fda548..ae11fd9 100644 > --- a/security/selinux/hooks.c > +++ b/security/selinux/hooks.c > @@ -1785,13 +1785,13 @@ out: > /* > * Determine the label for an inode that might be unioned. > */ > -static int selinux_determine_inode_label(struct inode *dir, > - const struct qstr *name, > - u16 tclass, > - u32 *_new_isid) > +static int > +selinux_determine_inode_label(const struct task_security_struct *tsec, > + struct inode *dir, > + const struct qstr *name, u16 tclass, > + u32 *_new_isid) > { > const struct superblock_security_struct *sbsec = dir->i_sb->s_security; > - const struct task_security_struct *tsec = current_security(); > > if ((sbsec->flags & SE_SBINITIALIZED) && > (sbsec->behavior == SECURITY_FS_USE_MNTPOINT)) { > @@ -1834,8 +1834,8 @@ static int may_create(struct inode *dir, > if (rc) > return rc; > > - rc = selinux_determine_inode_label(dir, &dentry->d_name, tclass, > - &newsid); > + rc = selinux_determine_inode_label(current_security(), dir, > + &dentry->d_name, tclass, &newsid); > if (rc) > return rc; > > @@ -2815,7 +2815,8 @@ static int selinux_dentry_init_security(struct dentry *dentry, int mode, > u32 newsid; > int rc; > > - rc = selinux_determine_inode_label(d_inode(dentry->d_parent), name, > + rc = selinux_determine_inode_label(current_security(), > + d_inode(dentry->d_parent), name, > inode_mode_to_security_class(mode), > &newsid); > if (rc) > @@ -2840,7 +2841,7 @@ static int selinux_inode_init_security(struct inode *inode, struct inode *dir, > sid = tsec->sid; > newsid = tsec->create_sid; > > - rc = selinux_determine_inode_label( > + rc = selinux_determine_inode_label(current_security(), > dir, qstr, > inode_mode_to_security_class(inode->i_mode), > &newsid); >