From: Casey Schaufler <casey@schaufler-ca.com>
To: "Łukasz Stelmach" <l.stelmach@samsung.com>,
"James Morris" <james.l.morris@oracle.com>,
"Serge E. Hallyn" <serge@hallyn.com>,
linux-security-module@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: Karol Lewandowski <k.lewandowsk@samsung.com>,
l.skalski@samsung.com, m.wereski@partner.samsung.com,
r.krypa@samsung.com, Casey Schaufler <casey@schaufler-ca.com>
Subject: Re: [PATCH v2] smack: introduce a special case for tmpfs in smack_d_instantiate()
Date: Tue, 16 Dec 2014 08:38:46 -0800 [thread overview]
Message-ID: <54906016.7020004@schaufler-ca.com> (raw)
In-Reply-To: <1418745188-23662-1-git-send-email-l.stelmach@samsung.com>
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@samsung.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;
> }
>
prev parent reply other threads:[~2014-12-16 16:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-16 15:53 [PATCH v2] smack: introduce a special case for tmpfs in smack_d_instantiate() Łukasz Stelmach
2014-12-16 16:38 ` Casey Schaufler [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54906016.7020004@schaufler-ca.com \
--to=casey@schaufler-ca.com \
--cc=james.l.morris@oracle.com \
--cc=k.lewandowsk@samsung.com \
--cc=l.skalski@samsung.com \
--cc=l.stelmach@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=m.wereski@partner.samsung.com \
--cc=r.krypa@samsung.com \
--cc=serge@hallyn.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.