From d96d3e11710909f469c94351b26da3b84b50a0b3 Mon Sep 17 00:00:00 2001
From: Changhyeok Bae <changhyeok.bae@gmail.com>
Date: Wed, 13 Dec 2017 11:27:12 +0000
Subject: [PATCH] linux-yocto: Rename .bbappend to match new version from
 meta-openembedded

Bug-AGL: SPEC-1181

Change-Id: I87b72202bb728a33bd16e0b275c268946ce61aff
Signed-off-by: Changhyeok Bae <changhyeok.bae@gmail.com>
---
 .../recipes-kernel/linux/linux-yocto_4.1.bbappend  | 12 -----
 ...octo_4.4.bbappend => linux-yocto_4.12.bbappend} |  2 +-
 .../0001-Smack-File-receive-for-sockets.patch      | 62 ----------------------
 .../0002-smack-fix-cache-of-access-labels.patch    | 43 ---------------
 ...ack-ignore-null-signal-in-smack_task_kill.patch | 39 --------------
 ...n-smack_known_web-label-for-kernel-thread.patch | 49 -----------------
 .../0001-Smack-File-receive-for-sockets.patch      |  0
 .../0002-smack-fix-cache-of-access-labels.patch    |  0
 ...ack-ignore-null-signal-in-smack_task_kill.patch |  0
 ...n-smack_known_web-label-for-kernel-thread.patch |  0
 10 files changed, 1 insertion(+), 206 deletions(-)
 delete mode 100644 meta-app-framework/recipes-kernel/linux/linux-yocto_4.1.bbappend
 rename meta-app-framework/recipes-kernel/linux/{linux-yocto_4.4.bbappend => linux-yocto_4.12.bbappend} (84%)
 delete mode 100644 meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.1/0001-Smack-File-receive-for-sockets.patch
 delete mode 100644 meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.1/0002-smack-fix-cache-of-access-labels.patch
 delete mode 100644 meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.1/0003-Smack-ignore-null-signal-in-smack_task_kill.patch
 delete mode 100644 meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.1/0004-Smack-Assign-smack_known_web-label-for-kernel-thread.patch
 rename meta-app-framework/recipes-kernel/linux/linux/{linux-yocto-4.4 => linux-yocto-4.12}/0001-Smack-File-receive-for-sockets.patch (100%)
 rename meta-app-framework/recipes-kernel/linux/linux/{linux-yocto-4.4 => linux-yocto-4.12}/0002-smack-fix-cache-of-access-labels.patch (100%)
 rename meta-app-framework/recipes-kernel/linux/linux/{linux-yocto-4.4 => linux-yocto-4.12}/0003-Smack-ignore-null-signal-in-smack_task_kill.patch (100%)
 rename meta-app-framework/recipes-kernel/linux/linux/{linux-yocto-4.4 => linux-yocto-4.12}/0004-Smack-Assign-smack_known_web-label-for-kernel-thread.patch (100%)

diff --git a/meta-app-framework/recipes-kernel/linux/linux-yocto_4.1.bbappend b/meta-app-framework/recipes-kernel/linux/linux-yocto_4.1.bbappend
deleted file mode 100644
index c1c657201..000000000
--- a/meta-app-framework/recipes-kernel/linux/linux-yocto_4.1.bbappend
+++ /dev/null
@@ -1,12 +0,0 @@
-FILESEXTRAPATHS_prepend := "${THISDIR}/linux/linux-yocto-4.1:"
-
-#-------------------------------------------------------------------------
-# smack patches for handling bluetooth
-
-SRC_URI_append_smack = "\
-	file://0001-Smack-File-receive-for-sockets.patch \
-	file://0002-smack-fix-cache-of-access-labels.patch \
-	file://0003-Smack-ignore-null-signal-in-smack_task_kill.patch \
-	file://0004-Smack-Assign-smack_known_web-label-for-kernel-thread.patch \
-"
-
diff --git a/meta-app-framework/recipes-kernel/linux/linux-yocto_4.4.bbappend b/meta-app-framework/recipes-kernel/linux/linux-yocto_4.12.bbappend
similarity index 84%
rename from meta-app-framework/recipes-kernel/linux/linux-yocto_4.4.bbappend
rename to meta-app-framework/recipes-kernel/linux/linux-yocto_4.12.bbappend
index 51df08719..b1eadaffa 100644
--- a/meta-app-framework/recipes-kernel/linux/linux-yocto_4.4.bbappend
+++ b/meta-app-framework/recipes-kernel/linux/linux-yocto_4.12.bbappend
@@ -1,4 +1,4 @@
-FILESEXTRAPATHS_prepend := "${THISDIR}/linux/linux-yocto-4.4:"
+FILESEXTRAPATHS_prepend := "${THISDIR}/linux/linux-yocto-4.12:"
 
 #-------------------------------------------------------------------------
 # smack patches for handling bluetooth
diff --git a/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.1/0001-Smack-File-receive-for-sockets.patch b/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.1/0001-Smack-File-receive-for-sockets.patch
deleted file mode 100644
index b0c5ee8f4..000000000
--- a/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.1/0001-Smack-File-receive-for-sockets.patch
+++ /dev/null
@@ -1,62 +0,0 @@
-From 2e65b888820ea372984d412cee3bd7dcba05d7d2 Mon Sep 17 00:00:00 2001
-From: Casey Schaufler <casey@schaufler-ca.com>
-Date: Mon, 7 Dec 2015 14:34:32 -0800
-Subject: [PATCH 1/4] Smack: File receive for sockets
-
-The existing file receive hook checks for access on
-the file inode even for UDS. This is not right, as
-the inode is not used by Smack to make access checks
-for sockets. This change checks for an appropriate
-access relationship between the receiving (current)
-process and the socket. If the process can't write
-to the socket's send label or the socket's receive
-label can't write to the process fail.
-
-This will allow the legitimate cases, where the
-socket sender and socket receiver can freely communicate.
-Only strangly set socket labels should cause a problem.
-
-Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
----
- security/smack/smack_lsm.c | 22 ++++++++++++++++++++++
- 1 file changed, 22 insertions(+)
-
-diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
-index b644757..487b2f3 100644
---- a/security/smack/smack_lsm.c
-+++ b/security/smack/smack_lsm.c
-@@ -1672,9 +1672,31 @@ static int smack_file_receive(struct file *file)
- 	int may = 0;
- 	struct smk_audit_info ad;
- 	struct inode *inode = file_inode(file);
-+	struct socket *sock;
-+	struct task_smack *tsp;
-+	struct socket_smack *ssp;
- 
- 	smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_PATH);
- 	smk_ad_setfield_u_fs_path(&ad, file->f_path);
-+
-+	if (S_ISSOCK(inode->i_mode)) {
-+		sock = SOCKET_I(inode);
-+		ssp = sock->sk->sk_security;
-+		tsp = current_security();
-+		/*
-+		 * If the receiving process can't write to the
-+		 * passed socket or if the passed socket can't
-+		 * write to the receiving process don't accept
-+		 * the passed socket.
-+		 */
-+		rc = smk_access(tsp->smk_task, ssp->smk_out, MAY_WRITE, &ad);
-+		rc = smk_bu_file(file, may, rc);
-+		if (rc < 0)
-+			return rc;
-+		rc = smk_access(ssp->smk_in, tsp->smk_task, MAY_WRITE, &ad);
-+		rc = smk_bu_file(file, may, rc);
-+		return rc;
-+	}
- 	/*
- 	 * This code relies on bitmasks.
- 	 */
--- 
-2.7.4
-
diff --git a/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.1/0002-smack-fix-cache-of-access-labels.patch b/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.1/0002-smack-fix-cache-of-access-labels.patch
deleted file mode 100644
index 51c3b31ec..000000000
--- a/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.1/0002-smack-fix-cache-of-access-labels.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From 5bcea0fc4e5360deca133e211fdc76717a1693a4 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Jos=C3=A9=20Bollo?= <jobol@nonadev.net>
-Date: Tue, 12 Jan 2016 21:23:40 +0100
-Subject: [PATCH 2/4] smack: fix cache of access labels
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Before this commit, removing the access property of
-a file, aka, the extended attribute security.SMACK64
-was not effictive until the cache had been cleaned.
-
-This patch fixes that problem.
-
-Signed-off-by: José Bollo <jobol@nonadev.net>
-Acked-by: Casey Schaufler <casey@schaufler-ca.com>
----
- security/smack/smack_lsm.c | 8 ++++++--
- 1 file changed, 6 insertions(+), 2 deletions(-)
-
-diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
-index 487b2f3..b9393e3 100644
---- a/security/smack/smack_lsm.c
-+++ b/security/smack/smack_lsm.c
-@@ -1256,9 +1256,13 @@ static int smack_inode_removexattr(struct dentry *dentry, const char *name)
- 	 * Don't do anything special for these.
- 	 *	XATTR_NAME_SMACKIPIN
- 	 *	XATTR_NAME_SMACKIPOUT
--	 *	XATTR_NAME_SMACKEXEC
- 	 */
--	if (strcmp(name, XATTR_NAME_SMACK) == 0)
-+	if (strcmp(name, XATTR_NAME_SMACK) == 0) {
-+		struct super_block *sbp = d_backing_inode(dentry)->i_sb;
-+		struct superblock_smack *sbsp = sbp->s_security;
-+
-+		isp->smk_inode = sbsp->smk_default;
-+	} else if (strcmp(name, XATTR_NAME_SMACKEXEC) == 0)
- 		isp->smk_task = NULL;
- 	else if (strcmp(name, XATTR_NAME_SMACKMMAP) == 0)
- 		isp->smk_mmap = NULL;
--- 
-2.7.4
-
diff --git a/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.1/0003-Smack-ignore-null-signal-in-smack_task_kill.patch b/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.1/0003-Smack-ignore-null-signal-in-smack_task_kill.patch
deleted file mode 100644
index 67761ae46..000000000
--- a/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.1/0003-Smack-ignore-null-signal-in-smack_task_kill.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From aa63c4f8ece0c54a9be735ac38667f11fcd6f44a Mon Sep 17 00:00:00 2001
-From: Rafal Krypa <r.krypa@samsung.com>
-Date: Mon, 4 Apr 2016 11:14:53 +0200
-Subject: [PATCH 3/4] Smack: ignore null signal in smack_task_kill
-
-Kill with signal number 0 is commonly used for checking PID existence.
-Smack treated such cases like any other kills, although no signal is
-actually delivered when sig == 0.
-
-Checking permissions when sig == 0 didn't prevent an unprivileged caller
-from learning whether PID exists or not. When it existed, kernel returned
-EPERM, when it didn't - ESRCH. The only effect of policy check in such
-case is noise in audit logs.
-
-This change lets Smack silently ignore kill() invocations with sig == 0.
-
-Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
-Acked-by: Casey Schaufler <casey@schaufler-ca.com>
----
- security/smack/smack_lsm.c | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
-index b9393e3..c916f58 100644
---- a/security/smack/smack_lsm.c
-+++ b/security/smack/smack_lsm.c
-@@ -2056,6 +2056,9 @@ static int smack_task_kill(struct task_struct *p, struct siginfo *info,
- 	struct smack_known *tkp = smk_of_task_struct(p);
- 	int rc;
- 
-+	if (!sig)
-+		return 0; /* null signal; existence test */
-+
- 	smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_TASK);
- 	smk_ad_setfield_u_tsk(&ad, p);
- 	/*
--- 
-2.7.4
-
diff --git a/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.1/0004-Smack-Assign-smack_known_web-label-for-kernel-thread.patch b/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.1/0004-Smack-Assign-smack_known_web-label-for-kernel-thread.patch
deleted file mode 100644
index 4281c201c..000000000
--- a/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.1/0004-Smack-Assign-smack_known_web-label-for-kernel-thread.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-From b2b9e7ec8e79ede841104f76464f4b77c057b011 Mon Sep 17 00:00:00 2001
-From: jooseong lee <jooseong.lee@samsung.com>
-Date: Thu, 3 Nov 2016 10:55:43 +0100
-Subject: [PATCH 4/4] Smack: Assign smack_known_web label for kernel thread's
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Assign smack_known_web label for kernel thread's socket in the sk_alloc_security hook
-
-Creating struct sock by sk_alloc function in various kernel subsystems
-like bluetooth dosen't call smack_socket_post_create(). In such case,
-received sock label is the floor('_') label and makes access deny.
-
-Refers-to: https://review.tizen.org/gerrit/#/c/80717/4
-
-Change-Id: I2e5c9359bfede84a988fd4d4d74cdb9dfdfc52d8
-Signed-off-by: jooseong lee <jooseong.lee@samsung.com>
-Signed-off-by: José Bollo <jose.bollo@iot.bzh>
----
- security/smack/smack_lsm.c | 12 ++++++++++--
- 1 file changed, 10 insertions(+), 2 deletions(-)
-
-diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
-index c916f58..cc6769b 100644
---- a/security/smack/smack_lsm.c
-+++ b/security/smack/smack_lsm.c
-@@ -2138,8 +2138,16 @@ static int smack_sk_alloc_security(struct sock *sk, int family, gfp_t gfp_flags)
- 	if (ssp == NULL)
- 		return -ENOMEM;
- 
--	ssp->smk_in = skp;
--	ssp->smk_out = skp;
-+	/*
-+	 * Sockets created by kernel threads receive web label.
-+	 */
-+	if (unlikely(current->flags & PF_KTHREAD)) {
-+		ssp->smk_in = &smack_known_web;
-+		ssp->smk_out = &smack_known_web;
-+	} else {
-+		ssp->smk_in = skp;
-+		ssp->smk_out = skp;
-+	}
- 	ssp->smk_packet = NULL;
- 
- 	sk->sk_security = ssp;
--- 
-2.7.4
-
diff --git a/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.4/0001-Smack-File-receive-for-sockets.patch b/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.12/0001-Smack-File-receive-for-sockets.patch
similarity index 100%
rename from meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.4/0001-Smack-File-receive-for-sockets.patch
rename to meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.12/0001-Smack-File-receive-for-sockets.patch
diff --git a/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.4/0002-smack-fix-cache-of-access-labels.patch b/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.12/0002-smack-fix-cache-of-access-labels.patch
similarity index 100%
rename from meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.4/0002-smack-fix-cache-of-access-labels.patch
rename to meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.12/0002-smack-fix-cache-of-access-labels.patch
diff --git a/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.4/0003-Smack-ignore-null-signal-in-smack_task_kill.patch b/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.12/0003-Smack-ignore-null-signal-in-smack_task_kill.patch
similarity index 100%
rename from meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.4/0003-Smack-ignore-null-signal-in-smack_task_kill.patch
rename to meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.12/0003-Smack-ignore-null-signal-in-smack_task_kill.patch
diff --git a/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.4/0004-Smack-Assign-smack_known_web-label-for-kernel-thread.patch b/meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.12/0004-Smack-Assign-smack_known_web-label-for-kernel-thread.patch
similarity index 100%
rename from meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.4/0004-Smack-Assign-smack_known_web-label-for-kernel-thread.patch
rename to meta-app-framework/recipes-kernel/linux/linux/linux-yocto-4.12/0004-Smack-Assign-smack_known_web-label-for-kernel-thread.patch
-- 
2.16.6