lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 13 Jul 2016 10:59:38 -0400
From:	Stephen Smalley <sds@...ho.nsa.gov>
To:	Vivek Goyal <vgoyal@...hat.com>, miklos@...redi.hu,
	pmoore@...hat.com, casey@...aufler-ca.com,
	linux-kernel@...r.kernel.org, linux-unionfs@...r.kernel.org,
	linux-security-module@...r.kernel.org
Cc:	dwalsh@...hat.com, dhowells@...hat.com, viro@...IV.linux.org.uk,
	linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH 7/9] selinux: Implement dentry_create_files_as() hook

On 07/13/2016 10:44 AM, Vivek Goyal wrote:
> Calculate what would be the label of newly created file and set that secid
> in the passed creds.
> 
> Context of the task which is actually creating file is retrieved from
> set of creds passed in. (old->security).
> 
> Signed-off-by: Vivek Goyal <vgoyal@...hat.com>

Acked-by: Stephen Smalley <sds@...ho.nsa.gov>

> ---
>  security/selinux/hooks.c | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
> index ae11fd9..77eb5a8 100644
> --- a/security/selinux/hooks.c
> +++ b/security/selinux/hooks.c
> @@ -2825,6 +2825,27 @@ static int selinux_dentry_init_security(struct dentry *dentry, int mode,
>  	return security_sid_to_context(newsid, (char **)ctx, ctxlen);
>  }
>  
> +static int selinux_dentry_create_files_as(struct dentry *dentry, int mode,
> +					  struct qstr *name,
> +					  const struct cred *old,
> +					  struct cred *new)
> +{
> +	u32 newsid;
> +	int rc;
> +	struct task_security_struct *tsec;
> +
> +	rc = selinux_determine_inode_label(old->security,
> +					   d_inode(dentry->d_parent), name,
> +					   inode_mode_to_security_class(mode),
> +					   &newsid);
> +	if (rc)
> +		return rc;
> +
> +	tsec = new->security;
> +	tsec->create_sid = newsid;
> +	return 0;
> +}
> +
>  static int selinux_inode_init_security(struct inode *inode, struct inode *dir,
>  				       const struct qstr *qstr,
>  				       const char **name,
> @@ -6066,6 +6087,7 @@ static struct security_hook_list selinux_hooks[] = {
>  	LSM_HOOK_INIT(sb_parse_opts_str, selinux_parse_opts_str),
>  
>  	LSM_HOOK_INIT(dentry_init_security, selinux_dentry_init_security),
> +	LSM_HOOK_INIT(dentry_create_files_as, selinux_dentry_create_files_as),
>  
>  	LSM_HOOK_INIT(inode_alloc_security, selinux_inode_alloc_security),
>  	LSM_HOOK_INIT(inode_free_security, selinux_inode_free_security),
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ