Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1437261
| From | Casey Schaufler <casey@schaufler-ca.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 3/5] selinux: Pass security pointer to determine_inode_label() |
| Date | 2016-07-05 22:30 +0200 |
| Message-ID | <rRF8J-7G3-17@gated-at.bofh.it> (permalink) |
| References | <rRAVs-4Ms-13@gated-at.bofh.it> <rRAVs-4Ms-29@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 7/5/2016 8:50 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 <vgoyal@redhat.com>
> ---
> security/selinux/hooks.c | 17 +++++++++--------
> 1 file changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
> index c68223c..86a07ed 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,
> +static int selinux_determine_inode_label(const void *security,
You know the type. Why not use it?
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();
> + const struct task_security_struct *tsec = 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);
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/5][RFC] Overlayfs SELinux Support Vivek Goyal <vgoyal@redhat.com> - 2016-07-05 18:00 +0200
[PATCH 3/5] selinux: Pass security pointer to determine_inode_label() Vivek Goyal <vgoyal@redhat.com> - 2016-07-05 18:00 +0200
Re: [PATCH 3/5] selinux: Pass security pointer to determine_inode_label() Casey Schaufler <casey@schaufler-ca.com> - 2016-07-05 22:30 +0200
Re: [PATCH 3/5] selinux: Pass security pointer to determine_inode_label() Vivek Goyal <vgoyal@redhat.com> - 2016-07-05 23:10 +0200
[PATCH 5/5] overlayfs: Use vfs_getxattr_noperm() for real inode Vivek Goyal <vgoyal@redhat.com> - 2016-07-05 18:00 +0200
Re: [PATCH 5/5] overlayfs: Use vfs_getxattr_noperm() for real inode Casey Schaufler <casey@schaufler-ca.com> - 2016-07-05 22:40 +0200
Re: [PATCH 5/5] overlayfs: Use vfs_getxattr_noperm() for real inode Vivek Goyal <vgoyal@redhat.com> - 2016-07-05 23:20 +0200
Re: [PATCH 5/5] overlayfs: Use vfs_getxattr_noperm() for real inode Miklos Szeredi <miklos@szeredi.hu> - 2016-07-06 06:40 +0200
Re: [PATCH 5/5] overlayfs: Use vfs_getxattr_noperm() for real inode Vivek Goyal <vgoyal@redhat.com> - 2016-07-06 13:00 +0200
Re: [PATCH 5/5] overlayfs: Use vfs_getxattr_noperm() for real inode Miklos Szeredi <miklos@szeredi.hu> - 2016-07-06 17:00 +0200
Re: [PATCH 5/5] overlayfs: Use vfs_getxattr_noperm() for real inode Vivek Goyal <vgoyal@redhat.com> - 2016-07-07 20:40 +0200
Re: [PATCH 5/5] overlayfs: Use vfs_getxattr_noperm() for real inode Miklos Szeredi <miklos@szeredi.hu> - 2016-07-08 09:10 +0200
Re: [PATCH 5/5] overlayfs: Use vfs_getxattr_noperm() for real inode Casey Schaufler <casey@schaufler-ca.com> - 2016-07-08 17:30 +0200
csiph-web