diff options
author | Daniel Díaz <daniel.diaz@linaro.org> | 2018-06-11 22:25:10 -0500 |
---|---|---|
committer | Daniel Díaz <daniel.diaz@linaro.org> | 2018-06-12 07:55:51 -0500 |
commit | ac9a79c87c67e6786e18b94b72c7ef0eef8cc847 (patch) | |
tree | 21cee1a29eb06fc3d1593a3054aa358ce6801ef9 | |
parent | 127137fc37d1412620c97e723c438baf48c7e54a (diff) |
ltp: sync with OE-core as of 2018-06-07, add 1 patch
Add new patch from OE-core:
* 0040-read_all-Define-FNM_EXTMATCH-if-not-already-like-und.patch
and one that is yet to be merged upstream:
* 0041-cve-2017-5669-shmat-for-0-or-PAGESIZE-with-RND-flag-.patch
Add new RDEPENDS: procps.
Change a few things in the recipe, chiefly the part where it
deals with the packaging of a static library.
Change-Id: I8663dd70809ac323e990e2f2a5c390cfe5cac229
Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org>
3 files changed, 147 insertions, 8 deletions
diff --git a/core/recipes-extended/ltp/ltp/0040-read_all-Define-FNM_EXTMATCH-if-not-already-like-und.patch b/core/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/core/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/core/recipes-extended/ltp/ltp/0041-cve-2017-5669-shmat-for-0-or-PAGESIZE-with-RND-flag-.patch b/core/recipes-extended/ltp/ltp/0041-cve-2017-5669-shmat-for-0-or-PAGESIZE-with-RND-flag-.patch new file mode 100644 index 0000000..38ccee8 --- /dev/null +++ b/core/recipes-extended/ltp/ltp/0041-cve-2017-5669-shmat-for-0-or-PAGESIZE-with-RND-flag-.patch @@ -0,0 +1,96 @@ +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 +--- + 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/core/recipes-extended/ltp/ltp_20180515.bb b/core/recipes-extended/ltp/ltp_20180515.bb index 115152f..f8680dd 100644 --- a/core/recipes-extended/ltp/ltp_20180515.bb +++ b/core/recipes-extended/ltp/ltp_20180515.bb @@ -40,6 +40,8 @@ SRC_URI = "git://github.com/linux-test-project/ltp.git \ file://0035-fix-test_proc_kill-hang.patch \ file://0036-testcases-network-nfsv4-acl-acl1.c-Security-fix-on-s.patch \ file://0039-commands-ar01-Fix-for-test-in-deterministic-mode.patch \ + file://0040-read_all-Define-FNM_EXTMATCH-if-not-already-like-und.patch \ + file://0041-cve-2017-5669-shmat-for-0-or-PAGESIZE-with-RND-flag-.patch \ " S = "${WORKDIR}/git" @@ -92,6 +94,7 @@ RDEPENDS_${PN} = "\ logrotate \ net-tools \ perl \ + procps \ python-core \ quota \ tar \ @@ -100,15 +103,11 @@ RDEPENDS_${PN} = "\ which \ " -FILES_${PN}-staticdev += "/opt/ltp/lib/libmem.a /opt/ltp/testcases/data/nm01/lib.a" +FILES_${PN} += "/opt/ltp/* /opt/ltp/runtest/* /opt/ltp/scenario_groups/* /opt/ltp/testcases/bin/* /opt/ltp/testcases/bin/*/bin/* /opt/ltp/testscripts/* /opt/ltp/testcases/open_posix_testsuite/* /opt/ltp/testcases/open_posix_testsuite/conformance/* /opt/ltp/testcases/open_posix_testsuite/Documentation/* /opt/ltp/testcases/open_posix_testsuite/functional/* /opt/ltp/testcases/open_posix_testsuite/include/* /opt/ltp/testcases/open_posix_testsuite/scripts/* /opt/ltp/testcases/open_posix_testsuite/stress/* /opt/ltp/testcases/open_posix_testsuite/tools/* /opt/ltp/testcases/data/nm01/lib.a /opt/ltp/lib/libmem.a" -FILES_${PN} += "/opt/ltp/* /opt/ltp/runtest/* /opt/ltp/scenario_groups/* /opt/ltp/testcases/bin/* /opt/ltp/testcases/bin/*/bin/* /opt/ltp/testscripts/* /opt/ltp/testcases/open_posix_testsuite/* /opt/ltp/testcases/open_posix_testsuite/conformance/* /opt/ltp/testcases/open_posix_testsuite/Documentation/* /opt/ltp/testcases/open_posix_testsuite/functional/* /opt/ltp/testcases/open_posix_testsuite/include/* /opt/ltp/testcases/open_posix_testsuite/scripts/* /opt/ltp/testcases/open_posix_testsuite/stress/* /opt/ltp/testcases/open_posix_testsuite/tools/*" - -# Avoid generated binaries stripping. Otherwise some of the ltp tests such as ldd01 & nm01 fails -INHIBIT_PACKAGE_STRIP = "1" -INHIBIT_PACKAGE_DEBUG_SPLIT = "1" -# However, test_arch_stripped is already stripped, so... -INSANE_SKIP_${PN} += "already-stripped" +# Avoid stripping some generated binaries otherwise some of the ltp tests such as ldd01 & nm01 fail +INHIBIT_PACKAGE_STRIP_FILES = "/opt/ltp/testcases/bin/nm01 /opt/ltp/testcases/bin/ldd01" +INSANE_SKIP_${PN} += "already-stripped staticdev" # Avoid file dependency scans, as LTP checks for things that may or may not # exist on the running system. For instance it has specific checks for |