]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
ltp: diotest4: Let kernel pick an address when calling mmap
authorHongzhi.Song <hongzhi.song@windriver.com>
Mon, 1 Jul 2019 09:47:46 +0000 (02:47 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 2 Jul 2019 07:10:42 +0000 (08:10 +0100)
Error:
diotest4 10 TBROK : diotest4.c:368: can't mmap file: Invalid argument
diotest4 11 TBROK : diotest4.c:368: Remaining cases broken

This is because the manually specified addr from mmap is invalid.
We should let kernel itself pick an addrress.

Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-extended/ltp/ltp/0001-diotest4-Let-kernel-pick-an-address-when-calling-mma.patch [new file with mode: 0644]
meta/recipes-extended/ltp/ltp_20190115.bb

diff --git a/meta/recipes-extended/ltp/ltp/0001-diotest4-Let-kernel-pick-an-address-when-calling-mma.patch b/meta/recipes-extended/ltp/ltp/0001-diotest4-Let-kernel-pick-an-address-when-calling-mma.patch
new file mode 100644 (file)
index 0000000..620027b
--- /dev/null
@@ -0,0 +1,49 @@
+From 785809201ad7dea2872d493efbfd65bb215710d6 Mon Sep 17 00:00:00 2001
+From: "Hongzhi.Song" <hongzhi.song@windriver.com>
+Date: Sun, 30 Jun 2019 21:56:16 -0400
+Subject: [PATCH] diotest4: Let kernel pick an address when calling mmap
+
+Error:
+diotest4 10 TBROK : diotest4.c:368: can't mmap file: Invalid argument
+diotest4 11 TBROK : diotest4.c:368: Remaining cases broken
+
+This is because the specified addr from mmap is invalid.
+We should let kernel itself pick an addrress.
+
+Signed-off-by: Jan Stancek <jstancek@redhat.com>
+
+Upstream-Status: Submitted [https://lists.linux.it/pipermail/ltp/2019-June/012570.html]
+
+Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com>
+---
+ testcases/kernel/io/direct_io/diotest4.c | 8 ++------
+ 1 file changed, 2 insertions(+), 6 deletions(-)
+
+diff --git a/testcases/kernel/io/direct_io/diotest4.c b/testcases/kernel/io/direct_io/diotest4.c
+index e4616e4..d88c431 100644
+--- a/testcases/kernel/io/direct_io/diotest4.c
++++ b/testcases/kernel/io/direct_io/diotest4.c
+@@ -352,18 +352,14 @@ int main(int argc, char *argv[])
+       total++;
+       /* Test-10: read, write to a mmaped file */
+-      shm_base = (char *)(((long)sbrk(0) + (shmsz - 1)) & ~(shmsz - 1));
+-      if (shm_base == NULL) {
+-              tst_brkm(TBROK, cleanup, "sbrk failed: %s", strerror(errno));
+-      }
+       offset = 4096;
+       count = bufsize;
+       if ((fd = open(filename, O_DIRECT | O_RDWR)) < 0) {
+               tst_brkm(TBROK, cleanup, "can't open %s: %s",
+                        filename, strerror(errno));
+       }
+-      shm_base = mmap(shm_base, 0x100000, PROT_READ | PROT_WRITE,
+-                      MAP_SHARED | MAP_FIXED, fd, 0);
++      shm_base = mmap(NULL, 0x100000, PROT_READ | PROT_WRITE,
++                      MAP_SHARED, fd, 0);
+       if (shm_base == (caddr_t) - 1) {
+               tst_brkm(TBROK, cleanup, "can't mmap file: %s",
+                        strerror(errno));
+-- 
+2.8.1
+
index e91dea2f196d7bb9975c401338b7c74092d711a4..b8a7e673d38e31cd16fe9dcad41e5b1e55dd69b4 100644 (file)
@@ -50,7 +50,8 @@ SRC_URI = "git://github.com/linux-test-project/ltp.git \
            file://define-sigrtmin-and-sigrtmax-for-musl.patch \
            file://setregid01-security-string-formatting.patch \
            file://0001-syscalls-setrlimit03.c-read-proc-sys-fs-nr_open-for-.patch \
-                  file://0001-shmctl01-don-t-use-hardcoded-index-0-for-SHM_STAT-te.patch \
+           file://0001-shmctl01-don-t-use-hardcoded-index-0-for-SHM_STAT-te.patch \
+           file://0001-diotest4-Let-kernel-pick-an-address-when-calling-mma.patch\
            "
 
 S = "${WORKDIR}/git"