reset upstream subtrees to yocto 2.6

Reset the following subtrees on thud HEAD:

  poky: 87e3a9739d
  meta-openembedded: 6094ae18c8
  meta-security: 31dc4e7532
  meta-raspberrypi: a48743dc36
  meta-xilinx: c42016e2e6

Also re-apply backports that didn't make it into thud:
  poky:
    17726d0 systemd-systemctl-native: handle Install wildcards

  meta-openembedded:
    4321a5d libtinyxml2: update to 7.0.1
    042f0a3 libcereal: Add native and nativesdk classes
    e23284f libcereal: Allow empty package
    030e8d4 rsyslog: curl-less build with fmhttp PACKAGECONFIG
    179a1b9 gtest: update to 1.8.1

Squashed OpenBMC subtree compatibility updates:
  meta-aspeed:
    Brad Bishop (1):
          aspeed: add yocto 2.6 compatibility

  meta-ibm:
    Brad Bishop (1):
          ibm: prepare for yocto 2.6

  meta-ingrasys:
    Brad Bishop (1):
          ingrasys: set layer compatibility to yocto 2.6

  meta-openpower:
    Brad Bishop (1):
          openpower: set layer compatibility to yocto 2.6

  meta-phosphor:
    Brad Bishop (3):
          phosphor: set layer compatibility to thud
          phosphor: libgpg-error: drop patches
          phosphor: react to fitimage artifact rename

    Ed Tanous (4):
          Dropbear: upgrade options for latest upgrade
          yocto2.6: update openssl options
          busybox: remove upstream watchdog patch
          systemd: Rebase CONFIG_CGROUP_BPF patch

Change-Id: I7b1fe71cca880d0372a82d94b5fd785323e3a9e7
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/poky/meta/recipes-extended/ltp/ltp/0001-configure-Fix-default-value-of-without-numa-switch-i.patch b/poky/meta/recipes-extended/ltp/ltp/0001-configure-Fix-default-value-of-without-numa-switch-i.patch
deleted file mode 100644
index da62687..0000000
--- a/poky/meta/recipes-extended/ltp/ltp/0001-configure-Fix-default-value-of-without-numa-switch-i.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From 4ace68a6ba501907a0741dba5f5f155e06a74c35 Mon Sep 17 00:00:00 2001
-From: Petr Vorel <pvorel@suse.cz>
-Date: Wed, 7 Feb 2018 11:09:49 +0100
-Subject: [PATCH] configure: Fix default value of --without-numa switch in help
-
-The default value is no.
-
-Fixes: 39a85a1f1 ("configure: add knob to control numa support")
-
-Signed-off-by: Petr Vorel <pvorel@suse.cz>
-Upstream-Status: Accepted
----
- configure.ac | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/configure.ac b/configure.ac
-index b39a31d..d66ea00 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -86,7 +86,7 @@ fi
- # Numa
- AC_ARG_WITH([numa],
-   AC_HELP_STRING([--without-numa],
--    [without numa support (default=yes)]),
-+    [without numa support (default=no)]),
-   [with_numa=no],
-   [with_numa=yes]
- )
--- 
-2.7.4
-
diff --git a/poky/meta/recipes-extended/ltp/ltp/0001-configure-add-knob-to-control-numa-support.patch b/poky/meta/recipes-extended/ltp/ltp/0001-configure-add-knob-to-control-numa-support.patch
deleted file mode 100644
index 8aaa287..0000000
--- a/poky/meta/recipes-extended/ltp/ltp/0001-configure-add-knob-to-control-numa-support.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-From 39a85a1f1e6624f554215ba4b6843d3689a8415e Mon Sep 17 00:00:00 2001
-From: Anders Roxell <anders.roxell@linaro.org>
-Date: Mon, 5 Feb 2018 11:56:04 +0100
-Subject: [PATCH] configure: add knob to control numa support
-
-Allow to disable numa from the top level.
-
-Based on patch:
-http://cgit.openembedded.org/openembedded-core/commit/meta/recipes-extended/ltp?id=4c7873552e13dfdba96afca7562c398d2966ca71
-
-Reported-by: Roy Li <rongqing.li@windriver.com>
-Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
-Signed-off-by: Petr Vorel <pvorel@suse.cz>
-Upstream-Status: Accepted
----
- configure.ac | 10 ++++++++++
- 1 file changed, 10 insertions(+)
-
-diff --git a/configure.ac b/configure.ac
-index 5c8d4ea..b39a31d 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -83,6 +83,14 @@ else
-     AC_SUBST([WITH_EXPECT],["no"])
- fi
- 
-+# Numa
-+AC_ARG_WITH([numa],
-+  AC_HELP_STRING([--without-numa],
-+    [without numa support (default=yes)]),
-+  [with_numa=no],
-+  [with_numa=yes]
-+)
-+
- # Perl
- AC_ARG_WITH([perl],
-   [AC_HELP_STRING([--with-perl],
-@@ -157,7 +165,9 @@ LTP_CHECK_SELINUX
- LTP_CHECK_SIGNAL
- LTP_CHECK_SYSCALL_EVENTFD
- LTP_CHECK_SYSCALL_MODIFY_LDT
-+if test "x$with_numa" = xyes; then
- LTP_CHECK_SYSCALL_NUMA
-+fi
- LTP_CHECK_SYSCALL_QUOTACTL
- LTP_CHECK_SYSCALL_SIGNALFD
- LTP_CHECK_SYSCALL_UNSHARE
--- 
-2.7.4
-
diff --git a/poky/meta/recipes-extended/ltp/ltp/0001-mmap15-mips64-return-EINVAL.patch b/poky/meta/recipes-extended/ltp/ltp/0001-mmap15-mips64-return-EINVAL.patch
new file mode 100644
index 0000000..18eba27
--- /dev/null
+++ b/poky/meta/recipes-extended/ltp/ltp/0001-mmap15-mips64-return-EINVAL.patch
@@ -0,0 +1,41 @@
+From b909805b4fc1b72e0ce299afb4abc02720ee81da Mon Sep 17 00:00:00 2001
+From: Dengke Du <dengke.du@windriver.com>
+Date: Wed, 12 Sep 2018 14:24:35 +0800
+Subject: [PATCH] mmap15: mips64 return EINVAL
+
+In mips64 kernel, system check the addr that passed to mmap:
+
+    if (TASK_SIZE - len < addr)
+        return -EINVAL;
+
+Link: https://github.com/torvalds/linux/blob/master/arch/mips/mm/mmap.c#L71
+
+Upstream-Status: Submitted [https://github.com/linux-test-project/ltp/pull/394]
+
+Signed-off-by: Dengke Du <dengke.du@windriver.com>
+---
+ testcases/kernel/syscalls/mmap/mmap15.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/testcases/kernel/syscalls/mmap/mmap15.c b/testcases/kernel/syscalls/mmap/mmap15.c
+index eff27d6..a10b5c7 100644
+--- a/testcases/kernel/syscalls/mmap/mmap15.c
++++ b/testcases/kernel/syscalls/mmap/mmap15.c
+@@ -81,9 +81,14 @@ int main(int ac, char **av)
+ 		}
+ 
+ 		if (errno != ENOMEM) {
++#ifdef __mips__
++			tst_resm(TPASS | TERRNO, "mmap into high region "
++                                 "failed as expected");                        
++#else
+ 			tst_resm(TFAIL | TERRNO, "mmap into high region "
+ 				 "failed unexpectedly - expect "
+ 				 "errno=ENOMEM, got");
++#endif
+ 		} else {
+ 			tst_resm(TPASS | TERRNO, "mmap into high region "
+ 				 "failed as expected");
+-- 
+2.7.4
+
diff --git a/poky/meta/recipes-extended/ltp/ltp/0001-netns_helper.sh-use-ping-6-when-ping6-is-not-avaliab.patch b/poky/meta/recipes-extended/ltp/ltp/0001-netns_helper.sh-use-ping-6-when-ping6-is-not-avaliab.patch
new file mode 100644
index 0000000..32e7a0e
--- /dev/null
+++ b/poky/meta/recipes-extended/ltp/ltp/0001-netns_helper.sh-use-ping-6-when-ping6-is-not-avaliab.patch
@@ -0,0 +1,45 @@
+From 76d8343ad300f6507233abcdf97629290e35848a Mon Sep 17 00:00:00 2001
+From: Lei Yang <Lei.Yang@windriver.com>
+Date: Wed, 29 Aug 2018 11:51:24 +0800
+Subject: [PATCH] netns_helper.sh: use 'ping -6' when ping6 is not avaliable
+
+ping6 has been merged into ping since 2015 by using "ping -6"
+in some distributions (e.g. OpenEmbedded) they dropped ping6 completely
+this patch will let both "ping -6" and ping6 work.
+
+[pvorel: change was done in s20150815:
+ebad35f ("ping: merge `ping6` command into `ping`"),
+before that release switch '-6' didn't exist.
+Upstream leaves ping6 symlink to distributions.]
+
+Upstream-Status: Backport
+[https://github.com/linux-test-project/ltp/commit/76d8343ad300f6507233abcdf97629290e35848a]
+
+Signed-off-by: Lei Yang <Lei.Yang@windriver.com>
+Signed-off-by: Petr Vorel <pvorel@suse.cz>
+Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
+---
+ testcases/kernel/containers/netns/netns_helper.sh | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/testcases/kernel/containers/netns/netns_helper.sh b/testcases/kernel/containers/netns/netns_helper.sh
+index 6aea10b..a9d0459 100755
+--- a/testcases/kernel/containers/netns/netns_helper.sh
++++ b/testcases/kernel/containers/netns/netns_helper.sh
+@@ -168,7 +168,12 @@ netns_setup()
+ 	ipv6)
+ 		IFCONF_IN6_ARG="inet6 add"
+ 		IP0=$6; IP1=$7;
+-		tping="ping6"; NETMASK=64
++		if which ping6 >/dev/null 2>&1; then
++		    tping="ping6"
++		else
++		    tping="ping -6"
++		fi
++		NETMASK=64
+ 		;;
+ 	*)
+ 		tst_brkm TBROK "second argument must be an ip version (ipv4|ipv6)"
+-- 
+2.7.4
+
diff --git a/poky/meta/recipes-extended/ltp/ltp/0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch b/poky/meta/recipes-extended/ltp/ltp/0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch
new file mode 100644
index 0000000..4d771c0
--- /dev/null
+++ b/poky/meta/recipes-extended/ltp/ltp/0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch
@@ -0,0 +1,68 @@
+From 85c972f730e8efe891a06ea3a2dfb5cbbdfbfbf4 Mon Sep 17 00:00:00 2001
+From: "Hongzhi.Song" <hongzhi.song@windriver.com>
+Date: Wed, 10 Oct 2018 22:07:05 -0400
+Subject: [PATCH] open_posix_testsuite/mmap24-2: Relax condition a bit
+
+Mips will return EINVAL instead of ENOMEM as expected
+if the range [addr + len) exceeds TASK_SIZE.
+
+Linux kernel code: arch/mips/mm/mmap.c
+if (flags & MAP_FIXED) {
+    /* Even MAP_FIXED mappings must reside within TASK_SIZE */
+    if (TASK_SIZE - len < addr)
+        return -EINVAL;
+
+Relax the condition and accept both ENOMEM and EINVAL
+as expected outcome.
+
+Upstream-Status: Submitted [https://lists.linux.it/pipermail/ltp/2018-October/009624.html]
+
+Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com>
+---
+ .../open_posix_testsuite/conformance/interfaces/mmap/24-2.c    | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mmap/24-2.c b/testcases/open_posix_testsuite/conformance/interfaces/mmap/24-2.c
+index de51d43..810e5c8 100644
+--- a/testcases/open_posix_testsuite/conformance/interfaces/mmap/24-2.c
++++ b/testcases/open_posix_testsuite/conformance/interfaces/mmap/24-2.c
+@@ -7,7 +7,7 @@
+  * source tree.
+  *
+  * The mmap() function shall fail if:
+- * [ENOMEM] MAP_FIXED was specified,
++ * [ENOMEM or EINVAL] MAP_FIXED was specified,
+  * and the range [addr,addr+len) exceeds that allowed
+  * for the address space of a process; or, if MAP_FIXED was not specified and
+  * there is insufficient room in the address space to effect the mapping.
+@@ -15,7 +15,7 @@
+  * Test Step:
+  * 1. Map a shared memory object, with size exceeding the value get from
+  *    rlim_cur of resource RLIMIT_AS, setting MAP_FIXED;
+- * 3. Should get ENOMEM.
++ * 3. Should get ENOMEM or EINVAL.
+  */
+ 
+ #define _XOPEN_SOURCE 600
+@@ -93,8 +93,8 @@ int main(void)
+ 	       (unsigned long)len);
+ 	pa = mmap(addr, len, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_SHARED, fd,
+ 		  0);
+-	if (pa == MAP_FAILED && errno == ENOMEM) {
+-		printf("Got ENOMEM: %s\nTest PASSED\n", strerror(errno));
++	if (pa == MAP_FAILED && (errno == ENOMEM || errno == EINVAL)) {
++		printf("Got ENOMEM or EINVAL: %s\nTest PASSED\n", strerror(errno));
+ 		exit(PTS_PASS);
+ 	}
+ 
+@@ -103,6 +103,6 @@ int main(void)
+ 	else
+ 		munmap(pa, len);
+ 	close(fd);
+-	printf("Test Fail: Did not get ENOMEM as expected\n");
++	printf("Test Failed: Did not get ENOMEM or EINVAL as expected\n");
+ 	return PTS_FAIL;
+ }
+-- 
+2.8.1
+
diff --git a/poky/meta/recipes-extended/ltp/ltp/0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch b/poky/meta/recipes-extended/ltp/ltp/0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch
new file mode 100644
index 0000000..c412c89
--- /dev/null
+++ b/poky/meta/recipes-extended/ltp/ltp/0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch
@@ -0,0 +1,75 @@
+From bb977ca0716ae98f10102c7122fe15bc0ddb5356 Mon Sep 17 00:00:00 2001
+From: "Hongzhi.Song" <hongzhi.song@windriver.com>
+Date: Thu, 20 Sep 2018 21:49:02 -0400
+Subject: [PATCH] sigwaitinfo01: recent glibc calls syscall directly
+
+glibc commit
+  8b0e795aaa44 ("Simplify Linux sig{timed}wait{info} implementations")
+changed sigwaitinfo to call sigtimedwait, which calls rt_sigtimedwait
+syscall directly.
+
+So, an invalid pointer no longer crashes child process and test
+reports failure. Fix it by accepting either crash or EFAULT.
+
+Signed-off-by: Jan Stancek <jstancek@redhat.com>
+
+Upstream-Status: Submitted [https://lists.linux.it/pipermail/ltp/2018-September/009338.html]
+
+Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com>
+---
+ .../kernel/syscalls/sigwaitinfo/sigwaitinfo01.c    | 30 +++++++++++++++++++---
+ 1 file changed, 26 insertions(+), 4 deletions(-)
+
+diff --git a/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c b/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c
+index 95a9436a4..8fa8ac34b 100644
+--- a/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c
++++ b/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c
+@@ -371,19 +371,41 @@ void test_bad_address2(swi_func sigwaitinfo, int signo)
+ 		tst_brkm(TBROK | TERRNO, NULL, "fork() failed");
+ 	case 0:
+ 		signal(SIGSEGV, SIG_DFL);
++
++       /*
++        * depending on glibc implementation we should
++        * either crash or get EFAULT
++        */
+ 		TEST(sigwaitinfo((void *)1, NULL, NULL));
+ 
+-		_exit(0);
++       if (TEST_RETURN == -1 && TEST_ERRNO == EFAULT)
++           _exit(0);
++
++       tst_resm(TINFO, "swi_func returned: %ld, errno: %d",
++           TEST_RETURN, TEST_ERRNO);
++       _exit(1);
++
+ 		break;
+ 	default:
+ 		break;
+ 	}
+ 
+ 	SUCCEED_OR_DIE(waitpid, "waitpid failed", pid, &status, 0);
+-	if (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)
++
++   if ((WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV)
++       || (WIFEXITED(status) && WEXITSTATUS(status) == 0)) {
+ 		tst_resm(TPASS, "Test passed");
+-	else
+-		tst_resm(TFAIL, "Unrecognised child exit code");
++       return;
++   }
++
++   if (WIFEXITED(status)) {
++       tst_resm(TFAIL, "Unrecognised child exit code: %d",
++           WEXITSTATUS(status));
++   }
++   if (WIFSIGNALED(status)) {
++       tst_resm(TFAIL, "Unrecognised child termsig: %d",
++           WTERMSIG(status));
++   }
+ }
+ 
+ void test_bad_address3(swi_func sigwaitinfo, int signo)
+-- 
+2.11.0
+
diff --git a/poky/meta/recipes-extended/ltp/ltp/0001-syscalls-fcntl-make-OFD-command-use-fcntl64-syscall-.patch b/poky/meta/recipes-extended/ltp/ltp/0001-syscalls-fcntl-make-OFD-command-use-fcntl64-syscall-.patch
new file mode 100644
index 0000000..2755596
--- /dev/null
+++ b/poky/meta/recipes-extended/ltp/ltp/0001-syscalls-fcntl-make-OFD-command-use-fcntl64-syscall-.patch
@@ -0,0 +1,184 @@
+From 8de03ea1200480b922d5ba05b69dc94db60496f5 Mon Sep 17 00:00:00 2001
+From: "Hongzhi.Song" <hongzhi.song@windriver.com>
+Date: Sat, 15 Sep 2018 22:39:32 -0400
+Subject: [PATCH] syscalls/fcntl: make OFD command use fcntl64() syscall on
+ 32-bit
+
+To cope with glibc commit:
+  06ab719d30b0 ("Fix Linux fcntl OFD locks for non-LFS architectures
+(BZ#20251)")
+
+WIP: Still need to test this with new glibc.
+     Test with old glibc look OK so far.
+
+Signed-off-by: Jan Stancek <jstancek@redhat.com>
+
+Upstream-Status: Backport
+    Backported from upstream maillist
+    https://lists.linux.it/pipermail/ltp/2018-September/009370.html
+
+Signed-off-by: Hongzhi Song <hongzhi.song@windriver.com>
+---
+ testcases/kernel/syscalls/fcntl/fcntl34.c      | 12 +++++++---
+ testcases/kernel/syscalls/fcntl/fcntl36.c      | 23 +++++++++++++-----
+ testcases/kernel/syscalls/fcntl/fcntl_common.h | 32 ++++++++++++++++++++++++++
+ 3 files changed, 58 insertions(+), 9 deletions(-)
+ create mode 100644 testcases/kernel/syscalls/fcntl/fcntl_common.h
+
+diff --git a/testcases/kernel/syscalls/fcntl/fcntl34.c b/testcases/kernel/syscalls/fcntl/fcntl34.c
+index aa29cf9..109f834 100644
+--- a/testcases/kernel/syscalls/fcntl/fcntl34.c
++++ b/testcases/kernel/syscalls/fcntl/fcntl34.c
+@@ -28,6 +28,7 @@
+ #include "lapi/fcntl.h"
+ #include "tst_safe_pthread.h"
+ #include "tst_test.h"
++#include "fcntl_common.h"
+ 
+ static int thread_cnt;
+ static const int max_thread_cnt = 32;
+@@ -68,7 +69,12 @@ void *thread_fn_01(void *arg)
+ 
+ 	memset(buf, (intptr_t)arg, write_size);
+ 
+-	struct flock64 lck = {
++    /* see explanation in fcntl_common.h */
++    #ifdef USE_STRUCT_FLOCK
++        struct flock lck = {
++    #else
++        struct flock64 lck = {
++    #endif
+ 		.l_whence = SEEK_SET,
+ 		.l_start  = 0,
+ 		.l_len    = 1,
+@@ -76,13 +82,13 @@ void *thread_fn_01(void *arg)
+ 
+ 	for (i = 0; i < writes_num; ++i) {
+ 		lck.l_type = F_WRLCK;
+-		SAFE_FCNTL(fd, F_OFD_SETLKW, &lck);
++        my_fcntl(fd, F_OFD_SETLKW, &lck);
+ 
+ 		SAFE_LSEEK(fd, 0, SEEK_END);
+ 		SAFE_WRITE(1, fd, buf, write_size);
+ 
+ 		lck.l_type = F_UNLCK;
+-		SAFE_FCNTL(fd, F_OFD_SETLKW, &lck);
++        my_fcntl(fd, F_OFD_SETLKW, &lck);
+ 
+ 		sched_yield();
+ 	}
+diff --git a/testcases/kernel/syscalls/fcntl/fcntl36.c b/testcases/kernel/syscalls/fcntl/fcntl36.c
+index 3246d13..f263b6b 100644
+--- a/testcases/kernel/syscalls/fcntl/fcntl36.c
++++ b/testcases/kernel/syscalls/fcntl/fcntl36.c
+@@ -57,6 +57,7 @@
+ #include "lapi/fcntl.h"
+ #include "tst_safe_pthread.h"
+ #include "tst_test.h"
++#include "fcntl_common.h"
+ 
+ static int thread_cnt;
+ static int fail_flag = 0;
+@@ -87,7 +88,12 @@ static void *fn_ofd_w(void *arg)
+ 	int fd = SAFE_OPEN(fname, O_RDWR);
+ 	long wt = pa->cnt;
+ 
+-	struct flock64 lck = {
++    /* see explanation in fcntl_common.h */
++    #ifdef USE_STRUCT_FLOCK
++        struct flock lck = {
++    #else
++        struct flock64 lck = {
++    #endif
+ 		.l_whence = SEEK_SET,
+ 		.l_start  = pa->offset,
+ 		.l_len    = pa->length,
+@@ -99,13 +105,13 @@ static void *fn_ofd_w(void *arg)
+ 		memset(buf, wt, pa->length);
+ 
+ 		lck.l_type = F_WRLCK;
+-		SAFE_FCNTL(fd, F_OFD_SETLKW, &lck);
++        my_fcntl(fd, F_OFD_SETLKW, &lck);
+ 
+ 		SAFE_LSEEK(fd, pa->offset, SEEK_SET);
+ 		SAFE_WRITE(1, fd, buf, pa->length);
+ 
+ 		lck.l_type = F_UNLCK;
+-		SAFE_FCNTL(fd, F_OFD_SETLKW, &lck);
++        my_fcntl(fd, F_OFD_SETLKW, &lck);
+ 
+ 		wt++;
+ 		if (wt >= 255)
+@@ -166,7 +172,12 @@ static void *fn_ofd_r(void *arg)
+ 	int i;
+ 	int fd = SAFE_OPEN(fname, O_RDWR);
+ 
+-	struct flock64 lck = {
++    /* see explanation in fcntl_common.h */
++    #ifdef USE_STRUCT_FLOCK
++        struct flock lck = {
++    #else
++        struct flock64 lck = {
++    #endif
+ 		.l_whence = SEEK_SET,
+ 		.l_start  = pa->offset,
+ 		.l_len    = pa->length,
+@@ -178,7 +189,7 @@ static void *fn_ofd_r(void *arg)
+ 		memset(buf, 0, pa->length);
+ 
+ 		lck.l_type = F_RDLCK;
+-		SAFE_FCNTL(fd, F_OFD_SETLKW, &lck);
++        my_fcntl(fd, F_OFD_SETLKW, &lck);
+ 
+ 		/* rlock acquired */
+ 		SAFE_LSEEK(fd, pa->offset, SEEK_SET);
+@@ -209,7 +220,7 @@ static void *fn_ofd_r(void *arg)
+ 		}
+ 
+ 		lck.l_type = F_UNLCK;
+-		SAFE_FCNTL(fd, F_OFD_SETLK, &lck);
++        my_fcntl(fd, F_OFD_SETLK, &lck);
+ 
+ 		sched_yield();
+ 	}
+diff --git a/testcases/kernel/syscalls/fcntl/fcntl_common.h b/testcases/kernel/syscalls/fcntl/fcntl_common.h
+new file mode 100644
+index 0000000..3fe399b
+--- /dev/null
++++ b/testcases/kernel/syscalls/fcntl/fcntl_common.h
+@@ -0,0 +1,32 @@
++#include "lapi/syscalls.h"
++
++/*
++ * glibc commit:
++ *   06ab719d30b0 ("Fix Linux fcntl OFD locks for non-LFS architectures (BZ#20251)")
++ * changed behavior of arg parameter for OFD commands. It is no
++ * longer passing arg directly to syscall, but expects it to be
++ * 'struct flock'.
++ *
++ * On 64-bit or _FILE_OFFSET_BITS == 64 we can use fcntl() and
++ * struct flock with any glibc version. struct flock and flock64
++ * should be identical.
++ *
++ * On 32-bit, older glibc would pass arg directly, recent one treats
++ * it as 'struct flock' and converts it to 'struct flock64'.
++ * So, for 32-bit we use fcntl64 syscall directly with struct flock64.
++ */
++#if __WORDSIZE == 64 || _FILE_OFFSET_BITS == 64
++#define USE_STRUCT_FLOCK
++static int my_fcntl(int fd, int cmd, void *lck)
++{
++        return SAFE_FCNTL(fd, cmd, lck);
++}
++#else
++static int my_fcntl(int fd, int cmd, void *lck)
++{
++        int ret = tst_syscall(__NR_fcntl64, fd, cmd, lck);
++        if (ret == -1)
++                tst_brk(TBROK|TERRNO, "fcntl64");
++        return ret;
++}
++#endif
+-- 
+2.8.1
+
diff --git a/poky/meta/recipes-extended/ltp/ltp/0003-Add-knob-to-control-tirpc-support.patch b/poky/meta/recipes-extended/ltp/ltp/0003-Add-knob-to-control-tirpc-support.patch
deleted file mode 100644
index 5cf1e05..0000000
--- a/poky/meta/recipes-extended/ltp/ltp/0003-Add-knob-to-control-tirpc-support.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-From b193011da301b3d944e8fddcf4817513c31c5b88 Mon Sep 17 00:00:00 2001
-From: Fathi Boudra <fathi.boudra@linaro.org>
-Date: Thu, 7 Jan 2016 17:36:19 +0000
-Subject: [PATCH 03/32] Add knob to control tirpc support
-
-allow to disable tirpc. Helps to disable it at top level for eg. musl it
-does not yet work.
-
-Signed-off-by: Fathi Boudra <fathi.boudra@linaro.org>
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-Upstream-Status: Pending
----
- configure.ac | 9 +++++++++
- 1 file changed, 9 insertions(+)
-
-diff --git a/configure.ac b/configure.ac
-index cc50397..9e2936b 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -98,6 +98,13 @@ if test "x$with_python" = xyes; then
- else
-     AC_SUBST([WITH_PYTHON],["no"])
- fi
-+
-+# TI RPC
-+AC_ARG_WITH([tirpc],
-+  AC_HELP_STRING([--without-tirpc],
-+    [without libtirpc support]),
-+  [],[with_tirpc=yes],
-+)
- # END tools knobs
- 
- # Testsuites knobs
-@@ -169,7 +176,9 @@ LTP_CHECK_RENAMEAT2
- LTP_CHECK_FALLOCATE
- LTP_CHECK_SYSCALL_FCNTL
- LTP_CHECK_SYSCALL_PERF_EVENT_OPEN
-+if test "x$with_tirpc" = xyes; then
- LTP_CHECK_TIRPC
-+fi
- LTP_CHECK_TEE
- LTP_CHECK_SPLICE
- LTP_CHECK_VMSPLICE
--- 
-2.7.0
-
diff --git a/poky/meta/recipes-extended/ltp/ltp/0004-build-Add-option-to-select-libc-implementation.patch b/poky/meta/recipes-extended/ltp/ltp/0004-build-Add-option-to-select-libc-implementation.patch
index 84ab37e..2df3855 100644
--- a/poky/meta/recipes-extended/ltp/ltp/0004-build-Add-option-to-select-libc-implementation.patch
+++ b/poky/meta/recipes-extended/ltp/ltp/0004-build-Add-option-to-select-libc-implementation.patch
@@ -22,10 +22,10 @@
  testcases/realtime/stress/pi-tests/Makefile | 5 +++++
  8 files changed, 35 insertions(+), 2 deletions(-)
 
-Index: git/Makefile
-===================================================================
---- git.orig/Makefile
-+++ git/Makefile
+diff --git a/Makefile b/Makefile
+index 297f8e7..906b280 100644
+--- a/Makefile
++++ b/Makefile
 @@ -49,6 +49,11 @@ SKIP_IDCHECK		?= 0
  UCLINUX			?= 0
  export UCLINUX
@@ -38,10 +38,10 @@
  # CLEAN_TARGETS:	Targets which exist solely in clean.
  # COMMON_TARGETS:	Targets which exist in all, clean, and install.
  # INSTALL_TARGETS:	Targets which exist in clean and install (contains
-Index: git/testcases/kernel/Makefile
-===================================================================
---- git.orig/testcases/kernel/Makefile
-+++ git/testcases/kernel/Makefile
+diff --git a/testcases/kernel/Makefile b/testcases/kernel/Makefile
+index 50a12fa..4f1987f 100644
+--- a/testcases/kernel/Makefile
++++ b/testcases/kernel/Makefile
 @@ -48,13 +48,16 @@ SUBDIRS			+= connectors \
  			   logging \
  			   mem \
@@ -60,10 +60,10 @@
  ifeq ($(WITH_POWER_MANAGEMENT_TESTSUITE),yes)
  SUBDIRS			+= power_management
  endif
-Index: git/testcases/kernel/sched/Makefile
-===================================================================
---- git.orig/testcases/kernel/sched/Makefile
-+++ git/testcases/kernel/sched/Makefile
+diff --git a/testcases/kernel/sched/Makefile b/testcases/kernel/sched/Makefile
+index 6245ed0..aa4eb7f 100644
+--- a/testcases/kernel/sched/Makefile
++++ b/testcases/kernel/sched/Makefile
 @@ -23,5 +23,7 @@
  top_srcdir		?= ../../..
  
@@ -73,10 +73,10 @@
 +	FILTER_OUT_DIRS += process_stress
 +endif
  include $(top_srcdir)/include/mk/generic_trunk_target.mk
-Index: git/testcases/kernel/syscalls/Makefile
-===================================================================
---- git.orig/testcases/kernel/syscalls/Makefile
-+++ git/testcases/kernel/syscalls/Makefile
+diff --git a/testcases/kernel/syscalls/Makefile b/testcases/kernel/syscalls/Makefile
+index 8acb395..b749126 100644
+--- a/testcases/kernel/syscalls/Makefile
++++ b/testcases/kernel/syscalls/Makefile
 @@ -28,6 +28,11 @@ ifeq ($(UCLINUX),1)
  FILTER_OUT_DIRS	+= capget capset chmod chown clone fork getcontext llseek \
  		   mincore mprotect nftw profil remap_file_pages sbrk
@@ -89,11 +89,11 @@
  
  ifeq ($(UCLIBC),1)
  FILTER_OUT_DIRS	+= profil
-Index: git/testcases/network/nfsv4/acl/Makefile
-===================================================================
---- git.orig/testcases/network/nfsv4/acl/Makefile
-+++ git/testcases/network/nfsv4/acl/Makefile
-@@ -26,4 +26,8 @@ include $(top_srcdir)/include/mk/env_pre
+diff --git a/testcases/network/nfsv4/acl/Makefile b/testcases/network/nfsv4/acl/Makefile
+index 8bc78c2..c36cf50 100644
+--- a/testcases/network/nfsv4/acl/Makefile
++++ b/testcases/network/nfsv4/acl/Makefile
+@@ -26,4 +26,8 @@ include $(top_srcdir)/include/mk/env_pre.mk
  
  LDLIBS			+= $(ACL_LIBS)
  
@@ -102,10 +102,10 @@
 +endif
 +
  include $(top_srcdir)/include/mk/generic_leaf_target.mk
-Index: git/testcases/network/rpc/basic_tests/Makefile
-===================================================================
---- git.orig/testcases/network/rpc/basic_tests/Makefile
-+++ git/testcases/network/rpc/basic_tests/Makefile
+diff --git a/testcases/network/rpc/basic_tests/Makefile b/testcases/network/rpc/basic_tests/Makefile
+index 3160813..9bdf5d0 100644
+--- a/testcases/network/rpc/basic_tests/Makefile
++++ b/testcases/network/rpc/basic_tests/Makefile
 @@ -23,4 +23,9 @@
  top_srcdir		?= ../../../..
  
@@ -116,11 +116,11 @@
 +endif
 +
  include $(top_srcdir)/include/mk/generic_trunk_target.mk
-Index: git/testcases/realtime/func/pi-tests/Makefile
-===================================================================
---- git.orig/testcases/realtime/func/pi-tests/Makefile
-+++ git/testcases/realtime/func/pi-tests/Makefile
-@@ -27,5 +27,9 @@ include $(top_srcdir)/include/mk/env_pre
+diff --git a/testcases/realtime/func/pi-tests/Makefile b/testcases/realtime/func/pi-tests/Makefile
+index 7a7a57a..5808866 100644
+--- a/testcases/realtime/func/pi-tests/Makefile
++++ b/testcases/realtime/func/pi-tests/Makefile
+@@ -27,5 +27,9 @@ include $(top_srcdir)/include/mk/env_pre.mk
  include $(abs_srcdir)/../../config.mk
  
  MAKE_TARGETS		:= testpi-0 testpi-1 testpi-2 testpi-4 testpi-5 testpi-6 testpi-7 sbrk_mutex
@@ -130,10 +130,10 @@
 +
  
  include $(top_srcdir)/include/mk/generic_leaf_target.mk
-Index: git/testcases/realtime/stress/pi-tests/Makefile
-===================================================================
---- git.orig/testcases/realtime/stress/pi-tests/Makefile
-+++ git/testcases/realtime/stress/pi-tests/Makefile
+diff --git a/testcases/realtime/stress/pi-tests/Makefile b/testcases/realtime/stress/pi-tests/Makefile
+index 5edc3b4..aa5987a 100644
+--- a/testcases/realtime/stress/pi-tests/Makefile
++++ b/testcases/realtime/stress/pi-tests/Makefile
 @@ -24,4 +24,9 @@ top_srcdir		?= ../../../..
  
  include $(top_srcdir)/include/mk/env_pre.mk
@@ -144,3 +144,6 @@
 +endif
 +
  include $(top_srcdir)/include/mk/generic_leaf_target.mk
+-- 
+2.7.0
+
diff --git a/poky/meta/recipes-extended/ltp/ltp/0008-Check-if-__GLIBC_PREREQ-is-defined-before-using-it.patch b/poky/meta/recipes-extended/ltp/ltp/0008-Check-if-__GLIBC_PREREQ-is-defined-before-using-it.patch
index e325ce4..428ac30 100644
--- a/poky/meta/recipes-extended/ltp/ltp/0008-Check-if-__GLIBC_PREREQ-is-defined-before-using-it.patch
+++ b/poky/meta/recipes-extended/ltp/ltp/0008-Check-if-__GLIBC_PREREQ-is-defined-before-using-it.patch
@@ -11,9 +11,9 @@
 Upstream-Status: Pending
 ---
  testcases/kernel/syscalls/accept4/accept4_01.c     |  9 ++++-
- testcases/kernel/syscalls/getcpu/getcpu01.c        | 40 +++++++++++++++++++++-
- .../sched_getaffinity/sched_getaffinity01.c        | 26 ++++++++++++++
- 3 files changed, 73 insertions(+), 2 deletions(-)
+ testcases/kernel/syscalls/getcpu/getcpu01.c        | 39 +++++++++++++++++++++-
+ .../sched_getaffinity/sched_getaffinity01.c        | 26 +++++++++++++++
+ 3 files changed, 72 insertions(+), 2 deletions(-)
 
 diff --git a/testcases/kernel/syscalls/accept4/accept4_01.c b/testcases/kernel/syscalls/accept4/accept4_01.c
 index 6072bfa..2b090cb 100644
@@ -102,7 +102,7 @@
  	*cpu_id = sched_getcpu();
  #endif
  	return 0;
-@@ -191,15 +204,20 @@ unsigned int set_cpu_affinity(void)
+@@ -191,15 +203,20 @@ unsigned int set_cpu_affinity(void)
  	cpu_set_t *set;
  	size_t size;
  	int nrcpus = 1024;
@@ -123,7 +123,7 @@
  #if __GLIBC_PREREQ(2, 7)
  	size = CPU_ALLOC_SIZE(nrcpus);
  	CPU_ZERO_S(size, set);
-@@ -207,8 +225,13 @@ realloc:
+@@ -207,8 +224,13 @@ realloc:
  	size = sizeof(cpu_set_t);
  	CPU_ZERO(set);
  #endif
@@ -137,7 +137,7 @@
  #if __GLIBC_PREREQ(2, 7)
  		if (errno == EINVAL && nrcpus < (1024 << 8)) {
  			nrcpus = nrcpus << 2;
-@@ -220,10 +243,17 @@ realloc:
+@@ -220,10 +242,17 @@ realloc:
  				 "NR_CPUS of the kernel is more than 1024, so we'd better use a newer glibc(>= 2.7)");
  		else
  #endif
@@ -155,7 +155,7 @@
  #if __GLIBC_PREREQ(2, 7)
  	CPU_ZERO_S(size, set);
  	CPU_SET_S(cpu_max, size, set);
-@@ -231,6 +261,10 @@ realloc:
+@@ -231,6 +260,10 @@ realloc:
  	CPU_ZERO(set);
  	CPU_SET(cpu_max, set);
  #endif
@@ -166,7 +166,7 @@
  	if (sched_setaffinity(0, size, set) < 0) {
  		CPU_FREE(set);
  		tst_brkm(TFAIL, NULL, "sched_setaffinity:errno:%d", errno);
-@@ -247,11 +281,15 @@ unsigned int max_cpuid(size_t size, cpu_set_t * set)
+@@ -247,11 +280,15 @@ unsigned int max_cpuid(size_t size, cpu_set_t * set)
  {
  	unsigned int index, max = 0;
  	for (index = 0; index < size * BITS_PER_BYTE; index++)
@@ -186,7 +186,7 @@
 index 9d6a81a..4ed13b2 100644
 --- a/testcases/kernel/syscalls/sched_getaffinity/sched_getaffinity01.c
 +++ b/testcases/kernel/syscalls/sched_getaffinity/sched_getaffinity01.c
-@@ -66,9 +66,11 @@ do { \
+@@ -67,9 +67,11 @@ do { \
  	tst_resm((TEST_RETURN == -1 ? TPASS : TFAIL) | TTERRNO, #t); \
  } while (0)
  
@@ -198,7 +198,7 @@
  
  int main(int ac, char **av)
  {
-@@ -95,14 +97,19 @@ static void do_test(void)
+@@ -96,14 +98,19 @@ static void do_test(void)
  	pid_t unused_pid;
  	unsigned len;
  
@@ -218,7 +218,7 @@
  #if __GLIBC_PREREQ(2, 7)
  	len = CPU_ALLOC_SIZE(nrcpus);
  	CPU_ZERO_S(len, mask);
-@@ -110,10 +117,15 @@ realloc:
+@@ -111,10 +118,15 @@ realloc:
  	len = sizeof(cpu_set_t);
  	CPU_ZERO(mask);
  #endif
@@ -234,7 +234,7 @@
  #if __GLIBC_PREREQ(2, 7)
  		if (errno == EINVAL && nrcpus < (1024 << 8)) {
  			nrcpus = nrcpus << 2;
-@@ -125,17 +137,27 @@ realloc:
+@@ -126,17 +138,27 @@ realloc:
  				 "newer glibc(>= 2.7)");
  		else
  #endif
@@ -262,7 +262,7 @@
  			if (TEST_RETURN != -1)
  				tst_resm(TPASS, "sched_getaffinity() succeed, "
  					 "this process %d is running "
-@@ -143,11 +165,15 @@ realloc:
+@@ -144,11 +166,15 @@ realloc:
  		}
  	}
  
diff --git a/poky/meta/recipes-extended/ltp/ltp/0010-replace-__BEGIN_DECLS-and-__END_DECLS.patch b/poky/meta/recipes-extended/ltp/ltp/0010-replace-__BEGIN_DECLS-and-__END_DECLS.patch
deleted file mode 100644
index b9fce88..0000000
--- a/poky/meta/recipes-extended/ltp/ltp/0010-replace-__BEGIN_DECLS-and-__END_DECLS.patch
+++ /dev/null
@@ -1,75 +0,0 @@
-From 0130f4146ced320aadb01b22e36b13d269a8ebba Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Thu, 7 Jan 2016 19:48:14 +0000
-Subject: [PATCH 10/32] replace __BEGIN_DECLS and __END_DECLS
-
-They are not portable across libc implementations
-therefore replace them with expanded macros
-
-Include <asm-generic/types.h> to get __s32 definitions
-its not a generally available typedef
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
-Upstream-Status: Pending
----
- testcases/kernel/syscalls/epoll2/include/epoll.h | 8 ++++++--
- utils/sctp/include/netinet/sctp.h                | 9 +++++++--
- 2 files changed, 13 insertions(+), 4 deletions(-)
-
-diff --git a/testcases/kernel/syscalls/epoll2/include/epoll.h b/testcases/kernel/syscalls/epoll2/include/epoll.h
-index be599c7..8cc5e7e 100644
---- a/testcases/kernel/syscalls/epoll2/include/epoll.h
-+++ b/testcases/kernel/syscalls/epoll2/include/epoll.h
-@@ -85,7 +85,9 @@ struct epoll_event
- } EPOLL_PACKED;
- 
- 
--__BEGIN_DECLS
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
- 
- /* Creates an epoll instance.  Returns an fd for the new instance.
-    The "size" parameter is a hint specifying the number of file
-@@ -114,6 +116,8 @@ extern int epoll_ctl (int __epfd, int __op, int __fd,
- extern int epoll_wait (int __epfd, struct epoll_event *__events,
- 		       int __maxevents, int __timeout) __THROW;
- 
--__END_DECLS
-+#ifdef __cplusplus
-+}
-+#endif
- 
- #endif /* sys/epoll.h */
-diff --git a/utils/sctp/include/netinet/sctp.h b/utils/sctp/include/netinet/sctp.h
-index 51f5bfb..c61aef3 100644
---- a/utils/sctp/include/netinet/sctp.h
-+++ b/utils/sctp/include/netinet/sctp.h
-@@ -35,9 +35,12 @@
- 
- #include <stdint.h>
- #include <linux/types.h>
-+#include <asm-generic/types.h>
- #include <sys/socket.h>
- 
--__BEGIN_DECLS
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
- 
- typedef __s32 sctp_assoc_t;
- 
-@@ -862,6 +865,8 @@ int sctp_recvmsg(int s, void *msg, size_t len, struct sockaddr *from,
- /* Return the address length for an address family. */
- int sctp_getaddrlen(sa_family_t family);
- 
--__END_DECLS
-+#ifdef __cplusplus
-+}
-+#endif
- 
- #endif /* __linux_sctp_h__ */
--- 
-2.7.0
-
diff --git a/poky/meta/recipes-extended/ltp/ltp/0021-Define-_GNU_SOURCE-for-MREMAP_MAYMOVE-definition.patch b/poky/meta/recipes-extended/ltp/ltp/0021-Define-_GNU_SOURCE-for-MREMAP_MAYMOVE-definition.patch
index 462976d..6c5f360 100644
--- a/poky/meta/recipes-extended/ltp/ltp/0021-Define-_GNU_SOURCE-for-MREMAP_MAYMOVE-definition.patch
+++ b/poky/meta/recipes-extended/ltp/ltp/0021-Define-_GNU_SOURCE-for-MREMAP_MAYMOVE-definition.patch
@@ -18,10 +18,10 @@
  testcases/kernel/syscalls/mremap/mremap03.c | 2 ++
  3 files changed, 7 insertions(+), 1 deletion(-)
 
-Index: git/testcases/kernel/syscalls/mremap/mremap01.c
-===================================================================
---- git.orig/testcases/kernel/syscalls/mremap/mremap01.c
-+++ git/testcases/kernel/syscalls/mremap/mremap01.c
+diff --git a/testcases/kernel/syscalls/mremap/mremap01.c b/testcases/kernel/syscalls/mremap/mremap01.c
+index d63d1e4..24ca174 100644
+--- a/testcases/kernel/syscalls/mremap/mremap01.c
++++ b/testcases/kernel/syscalls/mremap/mremap01.c
 @@ -76,10 +76,12 @@
   */
  #include <unistd.h>
@@ -36,10 +36,10 @@
  
  #include "test.h"
  #include "safe_macros.h"
-Index: git/testcases/kernel/syscalls/mremap/mremap02.c
-===================================================================
---- git.orig/testcases/kernel/syscalls/mremap/mremap02.c
-+++ git/testcases/kernel/syscalls/mremap/mremap02.c
+diff --git a/testcases/kernel/syscalls/mremap/mremap02.c b/testcases/kernel/syscalls/mremap/mremap02.c
+index 5a51b9a..a530a6b 100644
+--- a/testcases/kernel/syscalls/mremap/mremap02.c
++++ b/testcases/kernel/syscalls/mremap/mremap02.c
 @@ -75,9 +75,11 @@
  #include <errno.h>
  #include <unistd.h>
@@ -52,10 +52,10 @@
  
  #include "test.h"
  
-Index: git/testcases/kernel/syscalls/mremap/mremap03.c
-===================================================================
---- git.orig/testcases/kernel/syscalls/mremap/mremap03.c
-+++ git/testcases/kernel/syscalls/mremap/mremap03.c
+diff --git a/testcases/kernel/syscalls/mremap/mremap03.c b/testcases/kernel/syscalls/mremap/mremap03.c
+index 12e3829..9b39f8b 100644
+--- a/testcases/kernel/syscalls/mremap/mremap03.c
++++ b/testcases/kernel/syscalls/mremap/mremap03.c
 @@ -76,9 +76,11 @@
  #include <errno.h>
  #include <unistd.h>
@@ -68,3 +68,6 @@
  
  #include "test.h"
  
+-- 
+2.7.0
+
diff --git a/poky/meta/recipes-extended/ltp/ltp/0028-rt_sigaction.h-Use-sighandler_t-instead-of-__sighand.patch b/poky/meta/recipes-extended/ltp/ltp/0028-rt_sigaction.h-Use-sighandler_t-instead-of-__sighand.patch
index c730d46..40ee894 100644
--- a/poky/meta/recipes-extended/ltp/ltp/0028-rt_sigaction.h-Use-sighandler_t-instead-of-__sighand.patch
+++ b/poky/meta/recipes-extended/ltp/ltp/0028-rt_sigaction.h-Use-sighandler_t-instead-of-__sighand.patch
@@ -11,14 +11,14 @@
 
 Upstream-Status: Pending
 ---
- include/lapi/rt_sigaction.h                      | 2 +-
+ include/lapi/rt_sigaction.h                      | 4 ++--
  testcases/kernel/syscalls/rt_sigsuspend/Makefile | 3 +++
- 2 files changed, 4 insertions(+), 1 deletion(-)
+ 2 files changed, 5 insertions(+), 2 deletions(-)
 
-Index: git/include/lapi/rt_sigaction.h
-===================================================================
---- git.orig/include/lapi/rt_sigaction.h
-+++ git/include/lapi/rt_sigaction.h
+diff --git a/include/lapi/rt_sigaction.h b/include/lapi/rt_sigaction.h
+index 18236db..15facda 100644
+--- a/include/lapi/rt_sigaction.h
++++ b/include/lapi/rt_sigaction.h
 @@ -36,12 +36,12 @@
  #if defined(__mips__)
  struct kernel_sigaction {
@@ -34,10 +34,10 @@
  	unsigned long sa_flags;
  	void (*sa_restorer) (void);
  	sigset_t sa_mask;
-Index: git/testcases/kernel/syscalls/rt_sigsuspend/Makefile
-===================================================================
---- git.orig/testcases/kernel/syscalls/rt_sigsuspend/Makefile
-+++ git/testcases/kernel/syscalls/rt_sigsuspend/Makefile
+diff --git a/testcases/kernel/syscalls/rt_sigsuspend/Makefile b/testcases/kernel/syscalls/rt_sigsuspend/Makefile
+index 37bc3a9..2ca7f7c 100644
+--- a/testcases/kernel/syscalls/rt_sigsuspend/Makefile
++++ b/testcases/kernel/syscalls/rt_sigsuspend/Makefile
 @@ -19,4 +19,7 @@
  top_srcdir		?= ../../../..
  
diff --git a/poky/meta/recipes-extended/ltp/ltp/0036-testcases-network-nfsv4-acl-acl1.c-Security-fix-on-s.patch b/poky/meta/recipes-extended/ltp/ltp/0036-testcases-network-nfsv4-acl-acl1.c-Security-fix-on-s.patch
index 04532be..e826d48 100644
--- a/poky/meta/recipes-extended/ltp/ltp/0036-testcases-network-nfsv4-acl-acl1.c-Security-fix-on-s.patch
+++ b/poky/meta/recipes-extended/ltp/ltp/0036-testcases-network-nfsv4-acl-acl1.c-Security-fix-on-s.patch
@@ -27,7 +27,7 @@
 index b8b67b4..7c7c506 100644
 --- a/testcases/network/nfsv4/acl/acl1.c
 +++ b/testcases/network/nfsv4/acl/acl1.c
-@@ -314,7 +314,7 @@ void test_acl_default(char *dir, acl_t acl)
+@@ -303,7 +303,7 @@ void test_acl_default(char *dir, acl_t acl)
  	char *cmd = malloc(256);
  
  	strcpy(cmd, "chmod 7777 ");
diff --git a/poky/meta/recipes-extended/ltp/ltp/0040-read_all-Define-FNM_EXTMATCH-if-not-already-like-und.patch b/poky/meta/recipes-extended/ltp/ltp/0040-read_all-Define-FNM_EXTMATCH-if-not-already-like-und.patch
new file mode 100644
index 0000000..0245a89
--- /dev/null
+++ b/poky/meta/recipes-extended/ltp/ltp/0040-read_all-Define-FNM_EXTMATCH-if-not-already-like-und.patch
@@ -0,0 +1,44 @@
+From 23518508de307790231d16af307291f1b45e903a Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Daniel=20D=C3=ADaz?= <daniel.diaz@linaro.org>
+Date: Tue, 5 Jun 2018 15:36:30 -0500
+Subject: [PATCH] read_all: Define FNM_EXTMATCH if not already (like under
+ musl).
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+With musl, FNM_EXTMATCH is not defined:
+| read_all.c: In function 'read_test':
+| read_all.c:201:41: error: 'FNM_EXTMATCH' undeclared (first use in this function); did you mean 'FNM_NOMATCH'?
+|   if (exclude && !fnmatch(exclude, path, FNM_EXTMATCH)) {
+|                                          ^~~~~~~~~~~~
+|                                          FNM_NOMATCH
+| read_all.c:201:41: note: each undeclared identifier is reported only once for each function it appears in
+| <builtin>: recipe for target 'read_all' failed
+| make[4]: *** [read_all] Error 1
+
+Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org>
+
+Upstream-Status: Pending
+---
+ testcases/kernel/fs/read_all/read_all.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/testcases/kernel/fs/read_all/read_all.c b/testcases/kernel/fs/read_all/read_all.c
+index a8e1611..e9ff47a 100644
+--- a/testcases/kernel/fs/read_all/read_all.c
++++ b/testcases/kernel/fs/read_all/read_all.c
+@@ -59,6 +59,10 @@
+ #define MAX_PATH 4096
+ #define MAX_DISPLAY 40
+ 
++#if !defined(FNM_EXTMATCH)
++#define FNM_EXTMATCH 0
++#endif
++
+ struct queue {
+ 	sem_t sem;
+ 	int front;
+-- 
+2.7.4
+
diff --git a/poky/meta/recipes-extended/ltp/ltp/0040-safe_macros-make-is_fuse-return-zero-if-fs_type-is-N.patch b/poky/meta/recipes-extended/ltp/ltp/0040-safe_macros-make-is_fuse-return-zero-if-fs_type-is-N.patch
deleted file mode 100644
index 5096a85..0000000
--- a/poky/meta/recipes-extended/ltp/ltp/0040-safe_macros-make-is_fuse-return-zero-if-fs_type-is-N.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-From 67af7dbe8bdf29f9ed980d8d29feeae32a0a7a1d Mon Sep 17 00:00:00 2001
-From: Li Wang <liwang@redhat.com>
-Date: Tue, 23 Jan 2018 17:46:35 +0800
-Subject: [PATCH] safe_macros: make is_fuse() return zero if fs_type is NULL
-
-This commmit 28507e514c(safe_mount: Do not try mount() syscall for FUSE fs)
-involves FUSE fs check in safe_mount(), but we'd better guarantee the "fs_type"
-is legal to check in is_fuse() function otherwise system will kill the program.
-
-  cmdline="fanotify06"
-  contacts=""
-  analysis=exit
-  <<<test_output>>>
-  tst_test.c:980: INFO: Timeout per run is 0h 10m 00s
-  tst_test.c:1025: BROK: Test killed by SIGSEGV!
-
-Signed-off-by: Li Wang <liwang@redhat.com>
-Acked-by: Jan Stancek <jstancek@redhat.com>
-Upstream-Status: Accepted [https://github.com/linux-test-project/ltp/commit/67af7dbe8bdf29f9ed980d8d29feeae32a0a7a1d]
----
- lib/safe_macros.c | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/lib/safe_macros.c b/lib/safe_macros.c
-index c48e436dc..abdeca013 100644
---- a/lib/safe_macros.c
-+++ b/lib/safe_macros.c
-@@ -708,6 +708,9 @@ static int is_fuse(const char *fs_type)
- {
- 	unsigned int i;
- 
-+	if (!fs_type)
-+		return 0;
-+
- 	for (i = 0; i < ARRAY_SIZE(fuse_fs_types); i++) {
- 		if (!strcmp(fuse_fs_types[i], fs_type))
- 			return 1;
--- 
-2.11.0
-
diff --git a/poky/meta/recipes-extended/ltp/ltp/0041-cve-2017-5669-shmat-for-0-or-PAGESIZE-with-RND-flag-.patch b/poky/meta/recipes-extended/ltp/ltp/0041-cve-2017-5669-shmat-for-0-or-PAGESIZE-with-RND-flag-.patch
new file mode 100644
index 0000000..0d2d2cb
--- /dev/null
+++ b/poky/meta/recipes-extended/ltp/ltp/0041-cve-2017-5669-shmat-for-0-or-PAGESIZE-with-RND-flag-.patch
@@ -0,0 +1,97 @@
+From b767b73ef027ba8d35f297c7d3659265ac80425b Mon Sep 17 00:00:00 2001
+From: Rafael David Tinoco <rafael.tinoco@canonical.com>
+Date: Wed, 30 May 2018 09:14:34 -0300
+Subject: [PATCH] cve-2017-5669: shmat() for 0 (or <PAGESIZE with RND flag) has
+ to fail with REMAPs
+
+Fixes: https://github.com/linux-test-project/ltp/issues/319
+
+According to upstream thread (https://lkml.org/lkml/2018/5/28/2056),
+cve-2017-5669 needs to address the "new" way of handling nil addresses
+for shmat() when used with MAP_FIXED or SHM_REMAP flags.
+
+- mapping nil-page is OK on lower addresses with MAP_FIXED (or else X11 is broken)
+- mapping nil-page is NOT OK with SHM_REMAP on lower addresses
+
+Addresses Davidlohr Bueso's comments/changes:
+
+commit 8f89c007b6de
+Author: Davidlohr Bueso <dave@stgolabs.net>
+Date:   Fri May 25 14:47:30 2018 -0700
+
+    ipc/shm: fix shmat() nil address after round-down when remapping
+
+commit a73ab244f0da
+Author: Davidlohr Bueso <dave@stgolabs.net>
+Date:   Fri May 25 14:47:27 2018 -0700
+
+    Revert "ipc/shm: Fix shmat mmap nil-page protection"
+
+For previously test, and now broken, made based on:
+
+commit 95e91b831f87
+Author: Davidlohr Bueso <dave@stgolabs.net>
+Date:   Mon Feb 27 14:28:24 2017 -0800
+
+    ipc/shm: Fix shmat mmap nil-page protection
+
+Signed-off-by: Rafael David Tinoco <rafael.tinoco@linaro.org>
+Tested-by: Naresh Kamboju <naresh.kamboju@linaro.org>
+Reviewed-by: Jan Stancek <jstancek@redhat.com>
+
+Upstream-Status: Accepted [https://github.com/linux-test-project/ltp/pull/324]
+CVE: CVE-2017-5669
+Signed-off-by: Rafael David Tinoco <rafael.tinoco@linaro.org>
+---
+ testcases/cve/cve-2017-5669.c | 20 +++++++++++++++++++-
+ 1 file changed, 19 insertions(+), 1 deletion(-)
+
+diff --git a/testcases/cve/cve-2017-5669.c b/testcases/cve/cve-2017-5669.c
+index 1ca5983..0834626 100644
+--- a/testcases/cve/cve-2017-5669.c
++++ b/testcases/cve/cve-2017-5669.c
+@@ -28,7 +28,20 @@
+  * is just to see if we get an access error or some other unexpected behaviour.
+  *
+  * See commit 95e91b831f (ipc/shm: Fix shmat mmap nil-page protection)
++ *
++ * The commit above disallowed SHM_RND maps to zero (and rounded) entirely and
++ * that broke userland for cases like Xorg. New behavior disallows REMAPs to
++ * lower addresses (0<=PAGESIZE).
++ *
++ * See commit a73ab244f0da (Revert "ipc/shm: Fix shmat mmap nil-page protect...)
++ * See commit 8f89c007b6de (ipc/shm: fix shmat() nil address after round-dow...)
++ * See https://github.com/linux-test-project/ltp/issues/319
++ *
++ * This test needs root permissions or else security_mmap_addr(), from
++ * get_unmapped_area(), will cause permission errors when trying to mmap lower
++ * addresses.
+  */
++
+ #include <sys/types.h>
+ #include <sys/ipc.h>
+ #include <sys/shm.h>
+@@ -60,7 +73,11 @@ static void cleanup(void)
+ static void run(void)
+ {
+ 	tst_res(TINFO, "Attempting to attach shared memory to null page");
+-	shm_addr = shmat(shm_id, ((void *)1), SHM_RND);
++	/*
++	 * shmat() for 0 (or < PAGESIZE with RND flag) has to fail with REMAPs
++	 * https://github.com/linux-test-project/ltp/issues/319
++	 */
++	shm_addr = shmat(shm_id, ((void *)1), SHM_RND | SHM_REMAP);
+ 	if (shm_addr == (void *)-1) {
+ 		shm_addr = NULL;
+ 		if (errno == EINVAL) {
+@@ -89,6 +106,7 @@ static void run(void)
+ }
+ 
+ static struct tst_test test = {
++	.needs_root = 1,
+ 	.setup = setup,
+ 	.cleanup = cleanup,
+ 	.test_all = run,
+-- 
+2.7.4
+
diff --git a/poky/meta/recipes-extended/ltp/ltp/0042-fs-ftest-ftest06.c-Fix-too-small-name-string-and-rel.patch b/poky/meta/recipes-extended/ltp/ltp/0042-fs-ftest-ftest06.c-Fix-too-small-name-string-and-rel.patch
new file mode 100644
index 0000000..407d98e
--- /dev/null
+++ b/poky/meta/recipes-extended/ltp/ltp/0042-fs-ftest-ftest06.c-Fix-too-small-name-string-and-rel.patch
@@ -0,0 +1,34 @@
+From baeef026f80e19a634a4096e97286419aca1cf68 Mon Sep 17 00:00:00 2001
+From: He Zhe <zhe.he@windriver.com>
+Date: Thu, 23 Aug 2018 00:22:04 +0800
+Subject: [PATCH] fs/ftest/ftest06.c: Fix too small name string and related
+ failure
+
+The name string is too small to contain normal full path names and causes
+the following failure.
+
+"ftest06     2  TFAIL  :  ftest06.c:223: Can't chdir(): errno=ENOENT(2): No such file or directory"
+
+Upstream-Status: Submitted [ltp-list@lists.sourceforge.net]
+
+Signed-off-by: He Zhe <zhe.he@windriver.com>
+---
+ testcases/kernel/fs/ftest/ftest06.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/testcases/kernel/fs/ftest/ftest06.c b/testcases/kernel/fs/ftest/ftest06.c
+index 2ca7c88..b434067 100644
+--- a/testcases/kernel/fs/ftest/ftest06.c
++++ b/testcases/kernel/fs/ftest/ftest06.c
+@@ -100,7 +100,7 @@ static char *fstyp;
+ int main(int ac, char *av[])
+ {
+ 	int pid, child, status, count, k, j;
+-	char name[3];
++	char name[MAXPATHLEN];
+ 
+ 	int lc;
+ 
+-- 
+2.7.4
+
diff --git a/poky/meta/recipes-extended/ltp/ltp/0043-open-creat-skip-S_ISGID-check-on-files-created-by-no.patch b/poky/meta/recipes-extended/ltp/ltp/0043-open-creat-skip-S_ISGID-check-on-files-created-by-no.patch
new file mode 100644
index 0000000..dc61fcc
--- /dev/null
+++ b/poky/meta/recipes-extended/ltp/ltp/0043-open-creat-skip-S_ISGID-check-on-files-created-by-no.patch
@@ -0,0 +1,81 @@
+From 3c87ef2961dedb10d1f674c6a530e00dbab8ec1b Mon Sep 17 00:00:00 2001
+From: Jan Stancek <jstancek@redhat.com>
+Date: Tue, 17 Jul 2018 10:26:39 +0200
+Subject: [PATCH] open|creat: skip S_ISGID check on files created by non-group
+ members
+
+0fa3ecd87848 ("Fix up non-directory creation in SGID directories")
+fixes problem described in CVE-2018-13405. This commit is getting
+backported to older streams as well.
+
+This patch removes S_ISGID check for files created by non-group members
+in LTP tests creat08 and open10.
+
+Once 0fa3ecd87848 will be in non-rc kernel, we could add a new test
+for this CVE that would be limited to 4.18+ kernels.
+
+Signed-off-by: Jan Stancek <jstancek@redhat.com>
+Acked-by: Cyril Hrubis <chrubis@suse.cz>
+Reviewed-by: Naresh Kamboju <naresh.kamboju@linaro.org>
+
+Upstream-Status: Backport
+[ git://github.com/linux-test-project/ltp.git
+  3c87ef2961dedb10d1f674c6a530e00dbab8ec1b
+  "open|creat: skip S_ISGID check on files created by non-group members" ]
+
+Signed-off-by: He Zhe <zhe.he@windriver.com>
+---
+ testcases/kernel/syscalls/creat/creat08.c | 13 ++++++-------
+ testcases/kernel/syscalls/open/open10.c   | 12 +++++-------
+ 2 files changed, 11 insertions(+), 14 deletions(-)
+
+diff --git a/testcases/kernel/syscalls/creat/creat08.c b/testcases/kernel/syscalls/creat/creat08.c
+index 50f2b3993..d22558ac3 100644
+--- a/testcases/kernel/syscalls/creat/creat08.c
++++ b/testcases/kernel/syscalls/creat/creat08.c
+@@ -361,13 +361,12 @@ int main(int ac, char **av)
+ 			local_flag = FAILED;
+ 		}
+ 
+-		/* Verify modes */
+-		if (!(buf.st_mode & S_ISGID)) {
+-			tst_resm(TFAIL,
+-				 "%s: Incorrect modes, setgid bit should be set",
+-				 setgid_B);
+-			local_flag = FAILED;
+-		}
++		/*
++		 * Skip S_ISGID check
++		 * 0fa3ecd87848 ("Fix up non-directory creation in SGID directories")
++		 * clears S_ISGID for files created by non-group members
++		 */
++
+ 		close(fd);
+ 
+ 		if (local_flag == PASSED) {
+diff --git a/testcases/kernel/syscalls/open/open10.c b/testcases/kernel/syscalls/open/open10.c
+index 613f2288f..14feec9e1 100644
+--- a/testcases/kernel/syscalls/open/open10.c
++++ b/testcases/kernel/syscalls/open/open10.c
+@@ -345,13 +345,11 @@ int main(int ac, char *av[])
+ 			local_flag = FAILED;
+ 		}
+ 
+-		/* Verify modes */
+-		if (!(buf.st_mode & S_ISGID)) {
+-			tst_resm(TFAIL,
+-				 "%s: Incorrect modes, setgid bit not set",
+-				 setgid_B);
+-			local_flag = FAILED;
+-		}
++		/*
++		 * Skip S_ISGID check
++		 * 0fa3ecd87848 ("Fix up non-directory creation in SGID directories")
++		 * clears S_ISGID for files created by non-group members
++		 */
+ 
+ 		if (local_flag == PASSED) {
+ 			tst_resm(TPASS, "Test passed in block2.");
+-- 
+2.11.0
+