diff options
author | Daniel Díaz <daniel.diaz@linaro.org> | 2018-11-19 21:31:16 -0600 |
---|---|---|
committer | Daniel Díaz <daniel.diaz@linaro.org> | 2018-11-21 11:08:30 -0600 |
commit | fa10a47d10275b31f5d35a5dc1dcdd7df4e1b75d (patch) | |
tree | 06dd6bc0cb9a09b65f0edd60a7b2d149f6b5a9d7 /core/recipes-extended/ltp | |
parent | 9504f6a1219be8f6dc1f1face57918beb377d4c2 (diff) |
ltp: Import LTP 20180926 from OE-Core
This is ltp 20180926 as merged and available in OE-Core on
11/21, commit e45948d4be14c14eff0a5c8c8597a7523f2edff1.
Change-Id: Ica7e32a385d424452a6323b3efab24bc927e31fb
Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org>
Diffstat (limited to 'core/recipes-extended/ltp')
11 files changed, 498 insertions, 349 deletions
diff --git a/core/recipes-extended/ltp/ltp/0001-netns_helper.sh-use-ping-6-when-ping6-is-not-avaliab.patch b/core/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/core/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/core/recipes-extended/ltp/ltp/0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch b/core/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/core/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/core/recipes-extended/ltp/ltp/0001-setrlimit05-Use-another-method-to-get-bad-address.patch b/core/recipes-extended/ltp/ltp/0001-setrlimit05-Use-another-method-to-get-bad-address.patch new file mode 100644 index 0000000..4bfe276 --- /dev/null +++ b/core/recipes-extended/ltp/ltp/0001-setrlimit05-Use-another-method-to-get-bad-address.patch @@ -0,0 +1,61 @@ +From c4d02b23d12b7136b5739b3075e817fc037e41d4 Mon Sep 17 00:00:00 2001 +From: "Hongzhi.Song" <hongzhi.song@windriver.com> +Date: Mon, 19 Nov 2018 23:07:01 -0800 +Subject: [PATCH] setrlimit05: Use another method to get bad address + +This testcase fails on mips32. The process is killed by SIGBUS which +is not as expect. + +This is because: +((void *)-1) is not a legal bad address which causes the process +killed by SIGBUG on mips. + +'tst_get_bad_addr()' returns an address that should works on mips +and other arches. + +Upstream-Status: Accepted [80bed467bc6ab48a6cd88a8ab74ca15d08830cb0] + +Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com> +--- + testcases/kernel/syscalls/setrlimit/setrlimit05.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/testcases/kernel/syscalls/setrlimit/setrlimit05.c b/testcases/kernel/syscalls/setrlimit/setrlimit05.c +index e7167229b4..004a149a65 100644 +--- a/testcases/kernel/syscalls/setrlimit/setrlimit05.c ++++ b/testcases/kernel/syscalls/setrlimit/setrlimit05.c +@@ -26,6 +26,8 @@ + + #include "tst_test.h" + ++static void *bad_addr; ++ + static void verify_setrlimit(void) + { + int status; +@@ -33,7 +35,7 @@ static void verify_setrlimit(void) + + pid = SAFE_FORK(); + if (!pid) { +- TEST(setrlimit(RLIMIT_NOFILE, (void *) -1)); ++ TEST(setrlimit(RLIMIT_NOFILE, bad_addr)); + if (TST_RET != -1) { + tst_res(TFAIL, "setrlimit() succeeded unexpectedly"); + exit(0); +@@ -67,7 +69,13 @@ static void verify_setrlimit(void) + tst_res(TBROK, "child %s", tst_strstatus(status)); + } + ++static void setup(void) ++{ ++ bad_addr = tst_get_bad_addr(NULL); ++} ++ + static struct tst_test test = { + .test_all = verify_setrlimit, + .forks_child = 1, ++ .setup = setup, + }; +-- +2.11.0 + diff --git a/core/recipes-extended/ltp/ltp/0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch b/core/recipes-extended/ltp/ltp/0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch new file mode 100644 index 0000000..c412c89 --- /dev/null +++ b/core/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/core/recipes-extended/ltp/ltp/0001-statx-fix-compile-errors.patch b/core/recipes-extended/ltp/ltp/0001-statx-fix-compile-errors.patch new file mode 100644 index 0000000..c4fd8d0 --- /dev/null +++ b/core/recipes-extended/ltp/ltp/0001-statx-fix-compile-errors.patch @@ -0,0 +1,34 @@ +From a945304b6a2286d0665c70250cc5475eb07fd21e Mon Sep 17 00:00:00 2001 +From: Thadeu Lima de Souza Cascardo <cascardo@canonical.com> +Date: Wed, 26 Sep 2018 11:15:45 -0300 +Subject: [PATCH] statx: fix compile errors + +struct statx is only defined in sys/stat.h when _GNU_SOURCE is defined. +The testcases do define _GNU_SOURCE, but not the m4 struct check. + +Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com> +Acked-by: Cyril Hrubis <chrubis@suse.cz> +--- + m4/ltp-statx.m4 | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/m4/ltp-statx.m4 b/m4/ltp-statx.m4 +index 44303d30c..5f79a94cd 100644 +--- a/m4/ltp-statx.m4 ++++ b/m4/ltp-statx.m4 +@@ -23,6 +23,11 @@ dnl + AC_DEFUN([LTP_CHECK_STATX],[ + AC_CHECK_FUNCS(statx,,,[[#include <sys/stat.h>]]) + AC_CHECK_HEADER(linux/fs.h,,,) +-AC_CHECK_TYPES([struct statx],,,[[#include <sys/stat.h>]]) +-AC_CHECK_TYPES([struct statx_timestamp],,,[[#include <sys/stat.h>]]) ++AC_CHECK_TYPES([struct statx],,,[[ ++ #define _GNU_SOURCE ++ #include <sys/stat.h> ++]]) ++AC_CHECK_TYPES([struct statx_timestamp],,,[[ ++ #define _GNU_SOURCE ++ #include <sys/stat.h>]]) + ]) +-- +2.19.1 diff --git a/core/recipes-extended/ltp/ltp/0001-syscalls-fcntl-make-OFD-command-use-fcntl64-syscall-.patch b/core/recipes-extended/ltp/ltp/0001-syscalls-fcntl-make-OFD-command-use-fcntl64-syscall-.patch new file mode 100644 index 0000000..2755596 --- /dev/null +++ b/core/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/core/recipes-extended/ltp/ltp/0039-commands-ar01-Fix-for-test-in-deterministic-mode.patch b/core/recipes-extended/ltp/ltp/0039-commands-ar01-Fix-for-test-in-deterministic-mode.patch index e7c927e..9244a06 100644 --- a/core/recipes-extended/ltp/ltp/0039-commands-ar01-Fix-for-test-in-deterministic-mode.patch +++ b/core/recipes-extended/ltp/ltp/0039-commands-ar01-Fix-for-test-in-deterministic-mode.patch @@ -21,16 +21,18 @@ Signed-off-by: Yi Zhao <yi.zhao@windriver.com> 1 file changed, 52 insertions(+), 40 deletions(-) diff --git a/testcases/commands/ar/ar01 b/testcases/commands/ar/ar01 -index ddab2e0..d688f76 100644 +index be105f6da..813a51d9c 100644 --- a/testcases/commands/ar/ar01 +++ b/testcases/commands/ar/ar01 -@@ -23,14 +23,26 @@ - # This is a basic ar command test. +@@ -24,16 +24,28 @@ # + AR="${AR:=ar}" TST_CNT=17 +TST_SETUP=setup TST_TESTFUNC=test TST_NEEDS_TMPDIR=1 + TST_NEEDS_CMDS="$AR" + . tst_test.sh +setup() @@ -53,7 +55,7 @@ index ddab2e0..d688f76 100644 ROD ar -t lib.a \> ar.out printf "file1.in\nfile2.in\nfile3.in\n" > ar.exp -@@ -47,9 +59,9 @@ test1() +@@ -50,9 +62,9 @@ test1() test2() { @@ -66,7 +68,7 @@ index ddab2e0..d688f76 100644 ROD ar -t lib.a \> ar.out printf "file1.in\nfile4.in\nfile2.in\nfile3.in\n" > ar.exp -@@ -66,8 +78,8 @@ test2() +@@ -69,8 +81,8 @@ test2() test3() { @@ -77,7 +79,7 @@ index ddab2e0..d688f76 100644 ROD ar -t lib.a \> ar.out printf "file1.in\nfile2.in\nfile3.in\n" > ar.exp -@@ -84,9 +96,9 @@ test3() +@@ -87,9 +99,9 @@ test3() test4() { @@ -90,7 +92,7 @@ index ddab2e0..d688f76 100644 ROD ar -t lib.a \> ar.out printf "file1.in\nfile2.in\nfile3.in\n" > ar.exp -@@ -103,7 +115,7 @@ test4() +@@ -106,7 +118,7 @@ test4() test5() { @@ -99,7 +101,7 @@ index ddab2e0..d688f76 100644 if [ -s ar.out ]; then tst_res TFAIL "ar produced output unexpectedly (-c)" -@@ -117,7 +129,7 @@ test5() +@@ -120,7 +132,7 @@ test5() test6() { @@ -108,7 +110,7 @@ index ddab2e0..d688f76 100644 if [ -s ar.out ]; then tst_res TFAIL "ar produced output unexpectedly (-qc)" -@@ -131,9 +143,9 @@ test6() +@@ -134,9 +146,9 @@ test6() test7() { @@ -121,7 +123,7 @@ index ddab2e0..d688f76 100644 ROD ar -t lib.a \> ar.out printf "file3.in\n" > ar.exp -@@ -150,9 +162,9 @@ test7() +@@ -153,9 +165,9 @@ test7() test8() { @@ -134,7 +136,7 @@ index ddab2e0..d688f76 100644 ROD ar -t lib.a \> ar.out printf "file1.in\nfile2.in\nfile3.in\n" > ar.exp -@@ -169,8 +181,8 @@ test8() +@@ -172,8 +184,8 @@ test8() test9() { @@ -145,7 +147,7 @@ index ddab2e0..d688f76 100644 ROD ar -t lib.a \> ar.out printf "file1.in\nfile2.in\nfile3.in\n" > ar.exp -@@ -187,9 +199,9 @@ test9() +@@ -190,9 +202,9 @@ test9() test10() { @@ -158,7 +160,7 @@ index ddab2e0..d688f76 100644 ROD ar -t lib.a \> ar.out printf "file1.in\nfile2.in\nfile3.in\n" > ar.exp -@@ -206,9 +218,9 @@ test10() +@@ -209,9 +221,9 @@ test10() test11() { @@ -171,7 +173,7 @@ index ddab2e0..d688f76 100644 ROD ar -t lib.a \> ar.out printf "file1.in\nfile2.in\nfile3.in\n" > ar.exp -@@ -225,9 +237,9 @@ test11() +@@ -228,9 +240,9 @@ test11() test12() { @@ -184,7 +186,7 @@ index ddab2e0..d688f76 100644 printf "This is file one\nThis is file two\nThis is file three\n" > ar.exp -@@ -244,9 +256,9 @@ test12() +@@ -247,9 +259,9 @@ test12() test13() { @@ -197,7 +199,7 @@ index ddab2e0..d688f76 100644 ROD ar -t lib.a \> ar.out printf "file1.in\nfile2.in\nfile3.in\nfile4.in\n" > ar.exp -@@ -264,14 +276,14 @@ test13() +@@ -267,14 +279,14 @@ test13() test14() { ROD touch file0.in @@ -214,7 +216,7 @@ index ddab2e0..d688f76 100644 file0_mtime2=$(ar -tv lib.a | grep file0.in) file1_mtime2=$(ar -tv lib.a | grep file1.in) -@@ -293,7 +305,7 @@ test14() +@@ -296,7 +308,7 @@ test14() test15() { @@ -223,7 +225,7 @@ index ddab2e0..d688f76 100644 ROD ar -tv lib.a \> ar.out if grep -q '[rwx-]\{9\} [0-9].*/[0-9].*\s*[0-9].*.*file1.in' ar.out; then -@@ -308,9 +320,9 @@ test15() +@@ -311,9 +323,9 @@ test15() test16() { @@ -236,7 +238,7 @@ index ddab2e0..d688f76 100644 printf "x - file1.in\nx - file2.in\nx - file3.in\n" > ar.exp -@@ -332,8 +344,8 @@ test16() +@@ -335,8 +347,8 @@ test16() test17() { @@ -248,5 +250,5 @@ index ddab2e0..d688f76 100644 printf "x - file2.in\n" > ar.exp -- -2.7.4 +2.19.0.rc2 diff --git a/core/recipes-extended/ltp/ltp/0040-fs-read_all-define-FNM_EXTMATCH-if-needed.patch b/core/recipes-extended/ltp/ltp/0040-fs-read_all-define-FNM_EXTMATCH-if-needed.patch deleted file mode 100644 index 7310472..0000000 --- a/core/recipes-extended/ltp/ltp/0040-fs-read_all-define-FNM_EXTMATCH-if-needed.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 822ad20433799193e2180862137c36f24e5d27d6 Mon Sep 17 00:00:00 2001 -From: Rafael David Tinoco <rafael.tinoco@linaro.org> -Date: Tue, 28 Aug 2018 14:16:54 -0300 -Subject: [PATCH] fs/read_all: define FNM_EXTMATCH if needed -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -FNM_EXTMATCH is not defined in musl libc: - -| 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 - -Even not being 100% musl ready at the moment, this seems a trivial fix -to allow LTP to be built with musl libc. - -Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org> -Signed-off-by: Rafael David Tinoco <rafael.tinoco@linaro.org> -Tested-by: Daniel Díaz <daniel.diaz@linaro.org> -Acked-by: Cyril Hrubis <chrubis@suse.cz> ---- - include/lapi/fnmatch.h | 14 ++++++++++++++ - testcases/kernel/fs/read_all/read_all.c | 1 + - 2 files changed, 15 insertions(+) - create mode 100644 include/lapi/fnmatch.h - -diff --git a/include/lapi/fnmatch.h b/include/lapi/fnmatch.h -new file mode 100644 -index 0000000..9628ac4 ---- /dev/null -+++ b/include/lapi/fnmatch.h -@@ -0,0 +1,14 @@ -+// SPDX-License-Identifier: GPL-2.0-or-later -+/* -+ * Copyright (c) 2018 Linaro Limited. All rights reserved. -+ * Author: Rafael David Tinoco <rafael.tinoco@linaro.org> -+ */ -+ -+#ifndef FNMATCH_H__ -+#define FNMATCH_H__ -+ -+#ifndef FNM_EXTMATCH -+#define FNM_EXTMATCH 0 -+#endif -+ -+#endif -diff --git a/testcases/kernel/fs/read_all/read_all.c b/testcases/kernel/fs/read_all/read_all.c -index ac463db..1f0b315 100644 ---- a/testcases/kernel/fs/read_all/read_all.c -+++ b/testcases/kernel/fs/read_all/read_all.c -@@ -40,6 +40,7 @@ - */ - #include <sys/types.h> - #include <sys/stat.h> -+#include <lapi/fnmatch.h> - #include <stdlib.h> - #include <stdio.h> - #include <dirent.h> --- -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 deleted file mode 100644 index 0d2d2cb..0000000 --- a/core/recipes-extended/ltp/ltp/0041-cve-2017-5669-shmat-for-0-or-PAGESIZE-with-RND-flag-.patch +++ /dev/null @@ -1,97 +0,0 @@ -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/core/recipes-extended/ltp/ltp/0042-cve-meltdown-read-saved_command_line.patch b/core/recipes-extended/ltp/ltp/0042-cve-meltdown-read-saved_command_line.patch deleted file mode 100644 index 05b274a..0000000 --- a/core/recipes-extended/ltp/ltp/0042-cve-meltdown-read-saved_command_line.patch +++ /dev/null @@ -1,155 +0,0 @@ -From 16cf0c9220897f1cb312c7d9531cedf2049479ad Mon Sep 17 00:00:00 2001 -From: Jan Stancek <jstancek@redhat.com> -Date: Wed, 20 Jun 2018 13:51:58 +0200 -Subject: [PATCH] cve/meltdown: read *saved_command_line - -After commit 8c06c7740d19 ("x86/pti: Leave kernel text global for !PCID"), -kernel can now map all of kernel text into the user page tables. -So, read of "linux_proc_banner" can succeed and report a false positive. - -This patch changes the test to read value of "saved_command_line" -pointer and then also memory pointed to by it. And compares result -(first 32 bytes) to /proc/cmdline. saved_command_line string is -allocated dynamically and falls outside of (_text, _end) area: - crash> p/x _text - $2 = 0xffffffff81000000 <startup_64> - crash> p/x _end - $3 = 0xffffffff82411000 - crash> p/x &saved_command_line - $4 = 0xffffffff81cf3008 - crash> p/x saved_command_line - $5 = 0xffff88007ff55100 -so test should work on kernels with and without the patch. - -saved_command_line is allocated dynamically since 2.6.21: - 30d7e0d466b3 ("[PATCH] Dynamic kernel command-line: common") - -Signed-off-by: Jan Stancek <jstancek@redhat.com> -Reviewed-by: Li Wang <liwang@redhat.com> -Reviewed-by: Petr Vorel <pvorel@suse.cz> -Acked-by: Cyril Hrubis <chrubis@suse.cz> - -Upstream-Status: Backport [https://github.com/linux-test-project/ltp/commit/4db15cd7922a3880cd63b3a6aed77b85eecb9e47] ---- - testcases/cve/meltdown.c | 64 ++++++++++++++++++++++++++++++++++++------------ - 1 file changed, 48 insertions(+), 16 deletions(-) - -diff --git a/testcases/cve/meltdown.c b/testcases/cve/meltdown.c -index dce84a0..a53ea9b 100644 ---- a/testcases/cve/meltdown.c -+++ b/testcases/cve/meltdown.c -@@ -189,7 +189,7 @@ readbit(int fd, unsigned long addr, char bit) - for (i = 0; i < CYCLES; i++) { - ret = pread(fd, buf, sizeof(buf), 0); - if (ret < 0) -- tst_res(TBROK | TERRNO, "can't read /proc/version"); -+ tst_res(TBROK | TERRNO, "can't read fd"); - - clflush_target(); - -@@ -298,17 +298,17 @@ find_kernel_symbol(const char *name) - return addr; - } - --unsigned long linux_proc_banner_addr; --int banner_fd; -+static unsigned long saved_cmdline_addr; -+static int spec_fd; - - static void setup(void) - { - set_cache_hit_threshold(); - -- linux_proc_banner_addr = find_kernel_symbol("linux_proc_banner"); -- tst_res(TINFO, "linux_proc_banner is at %lx", linux_proc_banner_addr); -+ saved_cmdline_addr = find_kernel_symbol("saved_command_line"); -+ tst_res(TINFO, "&saved_command_line == 0x%lx", saved_cmdline_addr); - -- banner_fd = SAFE_OPEN("/proc/version", O_RDONLY); -+ spec_fd = SAFE_OPEN("/proc/cmdline", O_RDONLY); - - memset(target_array, 1, sizeof(target_array)); - -@@ -316,37 +316,69 @@ static void setup(void) - tst_res(TBROK | TERRNO, "set_signal"); - } - -+#define READ_SIZE 32 -+ - static void run(void) - { -- unsigned int i, score, ret; -- static char expected[] = "%s version %s"; -- static char read[32]; -- unsigned long addr = linux_proc_banner_addr; -- unsigned long size = sizeof(expected) - 1; -- -+ unsigned int i, score = 0, ret; -+ unsigned long addr; -+ unsigned long size; -+ char read[READ_SIZE] = { 0 }; -+ char expected[READ_SIZE] = { 0 }; -+ int expected_len; -+ -+ expected_len = pread(spec_fd, expected, sizeof(expected), 0); -+ if (expected_len < 0) -+ tst_res(TBROK | TERRNO, "can't read test fd"); -+ -+ /* read address of saved_cmdline_addr */ -+ addr = saved_cmdline_addr; -+ size = sizeof(addr); - for (i = 0; i < size; i++) { -- ret = readbyte(banner_fd, addr); -+ ret = readbyte(spec_fd, addr); - - read[i] = ret; -- tst_res(TINFO, "read %lx = 0x%x %c", addr, ret, -+ tst_res(TINFO, "read %lx = 0x%02x %c", addr, ret, - isprint(ret) ? ret : ' '); - - addr++; - } - -- for (score = 0, i = 0; i < size; i++) -+ /* read value pointed to by saved_cmdline_addr */ -+ memcpy(&addr, read, sizeof(addr)); -+ memset(read, 0, sizeof(read)); -+ tst_res(TINFO, "save_command_line: 0x%lx", addr); -+ size = expected_len; -+ -+ if (!addr) -+ goto done; -+ -+ for (i = 0; i < size; i++) { -+ ret = readbyte(spec_fd, addr); -+ -+ read[i] = ret; -+ tst_res(TINFO, "read %lx = 0x%02x %c | expected 0x%02x |" -+ " match: %d", addr, ret, isprint(ret) ? ret : ' ', -+ expected[i], read[i] == expected[i]); -+ -+ addr++; -+ } -+ -+ for (i = 0; i < size; i++) - if (expected[i] == read[i]) - score++; - -+done: - if (score > size / 2) - tst_res(TFAIL, "I was able to read your kernel memory!!!"); - else - tst_res(TPASS, "I was not able to read your kernel memory"); -+ tst_res(TINFO, "score(matched/all): %u / %lu", score, size); - } - - static void cleanup(void) - { -- SAFE_CLOSE(banner_fd); -+ SAFE_CLOSE(spec_fd); - } - - static struct tst_test test = { --- -2.7.4 - diff --git a/core/recipes-extended/ltp/ltp_20180515.bb b/core/recipes-extended/ltp/ltp_20180926.bb index f3681b4..e471904 100644 --- a/core/recipes-extended/ltp/ltp_20180515.bb +++ b/core/recipes-extended/ltp/ltp_20180926.bb @@ -11,7 +11,6 @@ LIC_FILES_CHKSUM = "\ file://testcases/kernel/hotplug/cpu_hotplug/COPYING;md5=e04a2e542b2b8629bf9cd2ba29b0fe41 \ file://testcases/open_posix_testsuite/COPYING;md5=48b1c5ec633e3e30ec2cf884ae699947 \ file://testcases/realtime/COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e \ - file://tools/pounder21/COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \ file://utils/benchmark/kernbench-0.42/COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \ file://utils/ffsb-6.0-rc2/COPYING;md5=c46082167a314d785d012a244748d803 \ " @@ -28,7 +27,7 @@ CFLAGS_append_x86-64 = " -fomit-frame-pointer" CFLAGS_append_powerpc64 = " -D__SANE_USERSPACE_TYPES__" CFLAGS_append_mipsarchn64 = " -D__SANE_USERSPACE_TYPES__" -SRCREV = "96cbf48313afa65ef4d693d3441cbfd60a8d9b27" +SRCREV = "f424769b1ad9fca477118763f88a6cec98ea2c0a" SRC_URI = "git://github.com/linux-test-project/ltp.git \ file://0004-build-Add-option-to-select-libc-implementation.patch \ @@ -47,9 +46,12 @@ 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-fs-read_all-define-FNM_EXTMATCH-if-needed.patch \ - file://0041-cve-2017-5669-shmat-for-0-or-PAGESIZE-with-RND-flag-.patch \ - file://0042-cve-meltdown-read-saved_command_line.patch \ + file://0001-syscalls-fcntl-make-OFD-command-use-fcntl64-syscall-.patch \ + file://0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch \ + file://0001-netns_helper.sh-use-ping-6-when-ping6-is-not-avaliab.patch \ + file://0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch \ + file://0001-statx-fix-compile-errors.patch \ + file://0001-setrlimit05-Use-another-method-to-get-bad-address.patch \ " S = "${WORKDIR}/git" @@ -93,22 +95,19 @@ RDEPENDS_${PN} = "\ curl \ e2fsprogs-mke2fs \ expect \ - file \ gawk \ gzip \ iproute2 \ ldd \ libaio \ logrotate \ - net-tools \ perl \ - procps \ python-core \ - quota \ - tar \ + procps \ unzip \ util-linux \ which \ + tar \ " 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" |