diff options
author | Yannick GICQUEL <yannick.gicquel@iot.bzh> | 2015-10-19 15:57:07 +0200 |
---|---|---|
committer | Gerrit Code Review <gerrit@172.30.200.200> | 2015-11-06 15:23:36 +0000 |
commit | ede19ea0c47fb23f3fc779833d1e57cf76f3371e (patch) | |
tree | 47d6fae2283c54def1871aaf2a73828ac68b1b34 /meta-rcar-gen2/recipes-kernel/linux/linux-renesas/smack/0047-smack-introduce-a-special-case-for-tmpfs-in-smack_d_.patch | |
parent | 1cd8ab18abca96e4ee108f80225058d875b28347 (diff) |
kernel: smack security backport from kernel 4
Here is the backport of all patches relating to smack support
on kernel side. For more details, see file:
meta-rcar-gen2/recipes-kernel/linux/linux-renesas/smack/README
Please note that patches are applied only if "smack" is in the
ditro features. Here are the 2 lines to add in the local.conf
OVERRIDES .= ":smack"
DISTRO_FEATURES_append = " smack"
Change-Id: I147a3532aec531f977d6ec34c576261835711f1e
Signed-off-by: Yannick GICQUEL <yannick.gicquel@iot.bzh>
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'meta-rcar-gen2/recipes-kernel/linux/linux-renesas/smack/0047-smack-introduce-a-special-case-for-tmpfs-in-smack_d_.patch')
-rw-r--r-- | meta-rcar-gen2/recipes-kernel/linux/linux-renesas/smack/0047-smack-introduce-a-special-case-for-tmpfs-in-smack_d_.patch | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/smack/0047-smack-introduce-a-special-case-for-tmpfs-in-smack_d_.patch b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/smack/0047-smack-introduce-a-special-case-for-tmpfs-in-smack_d_.patch new file mode 100644 index 0000000..255da99 --- /dev/null +++ b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/smack/0047-smack-introduce-a-special-case-for-tmpfs-in-smack_d_.patch @@ -0,0 +1,56 @@ +From 11d11ff47a952f09a85be5ed85c83ee19f8a74d2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C5=81ukasz=20Stelmach?= <l.stelmach@samsung.com> +Date: Tue, 16 Dec 2014 16:53:08 +0100 +Subject: [PATCH 47/54] smack: introduce a special case for tmpfs in + smack_d_instantiate() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +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> +--- + 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 2ec6cdb..bc43227 100644 +--- a/security/smack/smack_lsm.c ++++ b/security/smack/smack_lsm.c +@@ -3037,7 +3037,8 @@ static void smack_d_instantiate(struct dentry *opt_dentry, struct inode *inode) + * 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 +@@ -3045,8 +3046,19 @@ static void smack_d_instantiate(struct dentry *opt_dentry, struct inode *inode) + */ + 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; + } +-- +2.1.4 + |