From ede19ea0c47fb23f3fc779833d1e57cf76f3371e Mon Sep 17 00:00:00 2001 From: Yannick GICQUEL Date: Mon, 19 Oct 2015 15:57:07 +0200 Subject: kernel: smack security backport from kernel 4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: José Bollo --- ...rrectly-remove-SMACK64TRANSMUTE-attribute.patch | 64 ++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 meta-rcar-gen2/recipes-kernel/linux/linux-renesas/smack/0029-Smack-Correctly-remove-SMACK64TRANSMUTE-attribute.patch (limited to 'meta-rcar-gen2/recipes-kernel/linux/linux-renesas/smack/0029-Smack-Correctly-remove-SMACK64TRANSMUTE-attribute.patch') diff --git a/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/smack/0029-Smack-Correctly-remove-SMACK64TRANSMUTE-attribute.patch b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/smack/0029-Smack-Correctly-remove-SMACK64TRANSMUTE-attribute.patch new file mode 100644 index 0000000..b70522d --- /dev/null +++ b/meta-rcar-gen2/recipes-kernel/linux/linux-renesas/smack/0029-Smack-Correctly-remove-SMACK64TRANSMUTE-attribute.patch @@ -0,0 +1,64 @@ +From cb4e7f82cf806db0fb08aa83e6b3b4aa3918af60 Mon Sep 17 00:00:00 2001 +From: Casey Schaufler +Date: Thu, 10 Apr 2014 16:35:36 -0700 +Subject: [PATCH 29/54] Smack: Correctly remove SMACK64TRANSMUTE attribute + +Sam Henderson points out that removing the SMACK64TRANSMUTE +attribute from a directory does not result in the directory +transmuting. This is because the inode flag indicating that +the directory is transmuting isn't cleared. The fix is a tad +less than trivial because smk_task and smk_mmap should have +been broken out, too. + +Targeted for git://git.gitorious.org/smack-next/kernel.git + +Signed-off-by: Casey Schaufler +--- + security/smack/smack_lsm.c | 25 +++++++++++++++++++------ + 1 file changed, 19 insertions(+), 6 deletions(-) + +diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c +index e6c0a57..b259a0d 100644 +--- a/security/smack/smack_lsm.c ++++ b/security/smack/smack_lsm.c +@@ -1026,18 +1026,31 @@ static int smack_inode_removexattr(struct dentry *dentry, const char *name) + } else + rc = cap_inode_removexattr(dentry, name); + ++ if (rc != 0) ++ return rc; ++ + smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_DENTRY); + smk_ad_setfield_u_fs_path_dentry(&ad, dentry); +- if (rc == 0) +- rc = smk_curacc(smk_of_inode(dentry->d_inode), MAY_WRITE, &ad); + +- if (rc == 0) { +- isp = dentry->d_inode->i_security; ++ rc = smk_curacc(smk_of_inode(dentry->d_inode), MAY_WRITE, &ad); ++ if (rc != 0) ++ return rc; ++ ++ isp = dentry->d_inode->i_security; ++ /* ++ * Don't do anything special for these. ++ * XATTR_NAME_SMACKIPIN ++ * XATTR_NAME_SMACKIPOUT ++ * XATTR_NAME_SMACKEXEC ++ */ ++ if (strcmp(name, XATTR_NAME_SMACK) == 0) + isp->smk_task = NULL; ++ else if (strcmp(name, XATTR_NAME_SMACKMMAP) == 0) + isp->smk_mmap = NULL; +- } ++ else if (strcmp(name, XATTR_NAME_SMACKTRANSMUTE) == 0) ++ isp->smk_flags &= ~SMK_INODE_TRANSMUTE; + +- return rc; ++ return 0; + } + + /** +-- +2.1.4 + -- cgit 1.2.3-korg