summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHongzhi.Song <hongzhi.song@windriver.com>2018-10-15 22:54:19 -0400
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-10-16 20:35:43 +0100
commit8bea6f81d0b2f8c415735fbaa12a732e4f261946 (patch)
treea0eece8b5842eab5cc41a84ee80c613575c06074
parentbfa9068b4013bbd9ea47229d34f39853c973b63f (diff)
downloadpoky-8bea6f81d0b2f8c415735fbaa12a732e4f261946.tar.gz
ltp: modify mmap_24-2 testcase
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. (From OE-Core rev: ff1d158fb15f7a8bc7bca542baac6f9873a58f68) Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-extended/ltp/ltp/0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch68
-rw-r--r--meta/recipes-extended/ltp/ltp_20180515.bb1
2 files changed, 69 insertions, 0 deletions
diff --git a/meta/recipes-extended/ltp/ltp/0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch b/meta/recipes-extended/ltp/ltp/0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch
new file mode 100644
index 0000000000..4d771c0b9c
--- /dev/null
+++ b/meta/recipes-extended/ltp/ltp/0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch
@@ -0,0 +1,68 @@
1From 85c972f730e8efe891a06ea3a2dfb5cbbdfbfbf4 Mon Sep 17 00:00:00 2001
2From: "Hongzhi.Song" <hongzhi.song@windriver.com>
3Date: Wed, 10 Oct 2018 22:07:05 -0400
4Subject: [PATCH] open_posix_testsuite/mmap24-2: Relax condition a bit
5
6Mips will return EINVAL instead of ENOMEM as expected
7if the range [addr + len) exceeds TASK_SIZE.
8
9Linux kernel code: arch/mips/mm/mmap.c
10if (flags & MAP_FIXED) {
11 /* Even MAP_FIXED mappings must reside within TASK_SIZE */
12 if (TASK_SIZE - len < addr)
13 return -EINVAL;
14
15Relax the condition and accept both ENOMEM and EINVAL
16as expected outcome.
17
18Upstream-Status: Submitted [https://lists.linux.it/pipermail/ltp/2018-October/009624.html]
19
20Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com>
21---
22 .../open_posix_testsuite/conformance/interfaces/mmap/24-2.c | 10 +++++-----
23 1 file changed, 5 insertions(+), 5 deletions(-)
24
25diff --git a/testcases/open_posix_testsuite/conformance/interfaces/mmap/24-2.c b/testcases/open_posix_testsuite/conformance/interfaces/mmap/24-2.c
26index de51d43..810e5c8 100644
27--- a/testcases/open_posix_testsuite/conformance/interfaces/mmap/24-2.c
28+++ b/testcases/open_posix_testsuite/conformance/interfaces/mmap/24-2.c
29@@ -7,7 +7,7 @@
30 * source tree.
31 *
32 * The mmap() function shall fail if:
33- * [ENOMEM] MAP_FIXED was specified,
34+ * [ENOMEM or EINVAL] MAP_FIXED was specified,
35 * and the range [addr,addr+len) exceeds that allowed
36 * for the address space of a process; or, if MAP_FIXED was not specified and
37 * there is insufficient room in the address space to effect the mapping.
38@@ -15,7 +15,7 @@
39 * Test Step:
40 * 1. Map a shared memory object, with size exceeding the value get from
41 * rlim_cur of resource RLIMIT_AS, setting MAP_FIXED;
42- * 3. Should get ENOMEM.
43+ * 3. Should get ENOMEM or EINVAL.
44 */
45
46 #define _XOPEN_SOURCE 600
47@@ -93,8 +93,8 @@ int main(void)
48 (unsigned long)len);
49 pa = mmap(addr, len, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_SHARED, fd,
50 0);
51- if (pa == MAP_FAILED && errno == ENOMEM) {
52- printf("Got ENOMEM: %s\nTest PASSED\n", strerror(errno));
53+ if (pa == MAP_FAILED && (errno == ENOMEM || errno == EINVAL)) {
54+ printf("Got ENOMEM or EINVAL: %s\nTest PASSED\n", strerror(errno));
55 exit(PTS_PASS);
56 }
57
58@@ -103,6 +103,6 @@ int main(void)
59 else
60 munmap(pa, len);
61 close(fd);
62- printf("Test Fail: Did not get ENOMEM as expected\n");
63+ printf("Test Failed: Did not get ENOMEM or EINVAL as expected\n");
64 return PTS_FAIL;
65 }
66--
672.8.1
68
diff --git a/meta/recipes-extended/ltp/ltp_20180515.bb b/meta/recipes-extended/ltp/ltp_20180515.bb
index 643239f793..ff85be723f 100644
--- a/meta/recipes-extended/ltp/ltp_20180515.bb
+++ b/meta/recipes-extended/ltp/ltp_20180515.bb
@@ -55,6 +55,7 @@ SRC_URI = "git://github.com/linux-test-project/ltp.git \
55 file://0001-syscalls-fcntl-make-OFD-command-use-fcntl64-syscall-.patch \ 55 file://0001-syscalls-fcntl-make-OFD-command-use-fcntl64-syscall-.patch \
56 file://0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch \ 56 file://0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch \
57 file://0001-netns_helper.sh-use-ping-6-when-ping6-is-not-avaliab.patch \ 57 file://0001-netns_helper.sh-use-ping-6-when-ping6-is-not-avaliab.patch \
58 file://0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch \
58 " 59 "
59 60
60S = "${WORKDIR}/git" 61S = "${WORKDIR}/git"