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] [day] [month] [year] [list]
Message-ID: <54906016.7020004@schaufler-ca.com>
Date:	Tue, 16 Dec 2014 08:38:46 -0800
From:	Casey Schaufler <casey@...aufler-ca.com>
To:	Łukasz Stelmach <l.stelmach@...sung.com>,
	James Morris <james.l.morris@...cle.com>,
	"Serge E. Hallyn" <serge@...lyn.com>,
	linux-security-module@...r.kernel.org, linux-kernel@...r.kernel.org
CC:	Karol Lewandowski <k.lewandowsk@...sung.com>,
	l.skalski@...sung.com, m.wereski@...tner.samsung.com,
	r.krypa@...sung.com, Casey Schaufler <casey@...aufler-ca.com>
Subject: Re: [PATCH v2] smack: introduce a special case for tmpfs in smack_d_instantiate()

On 12/16/2014 7:53 AM, Łukasz Stelmach wrote:
> Files created with __shmem_file_stup() appear to have somewhat fake
> dentries which make them look like root directories and not get
> the label the current process or ("*") star meant for tmpfs files.
>
> Signed-off-by: Łukasz Stelmach <l.stelmach@...sung.com>

Applied to git://git.gitorious.org/smack-next/kernel.git#smack-for-3.20

> ---
>  security/smack/smack_lsm.c | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
> index e8bed86..b774029 100644
> --- a/security/smack/smack_lsm.c
> +++ b/security/smack/smack_lsm.c
> @@ -3036,18 +3036,30 @@ static void smack_d_instantiate(struct dentry *opt_dentry, struct inode *inode)
>  	 * If that is the case use the root value out
>  	 * of the superblock.
>  	 */
>  	if (opt_dentry->d_parent == opt_dentry) {
> -		if (sbp->s_magic == CGROUP_SUPER_MAGIC) {
> +		switch (sbp->s_magic) {
> +		case CGROUP_SUPER_MAGIC:
>  			/*
>  			 * The cgroup filesystem is never mounted,
>  			 * so there's no opportunity to set the mount
>  			 * options.
>  			 */
>  			sbsp->smk_root = &smack_known_star;
>  			sbsp->smk_default = &smack_known_star;
> +			isp->smk_inode = sbsp->smk_root;
> +			break;
> +		case TMPFS_MAGIC:
> +			/*
> +			 * What about shmem/tmpfs anonymous files with dentry
> +			 * obtained from d_alloc_pseudo()?
> +			 */
> +			isp->smk_inode = smk_of_current();
> +			break;
> +		default:
> +			isp->smk_inode = sbsp->smk_root;
> +			break;
>  		}
> -		isp->smk_inode = sbsp->smk_root;
>  		isp->smk_flags |= SMK_INODE_INSTANT;
>  		goto unlockandout;
>  	}
>  

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ