diff options
| author | He Zhe <zhe.he@windriver.com> | 2020-06-23 16:30:47 +0800 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-06-24 18:06:43 +0100 |
| commit | 20d5537aaecc6c88734b8a6765f64e3ab1379e12 (patch) | |
| tree | cbe95cb4aeaec5445e267e8ca3cd2ec61094f49e | |
| parent | d80a359682f3f38183dd1b734e31c5d8fc9da031 (diff) | |
| download | poky-20d5537aaecc6c88734b8a6765f64e3ab1379e12.tar.gz | |
ltp: Fix copy_file_rang02 for 32-bit arches
Fix the following error.
copy_file_range02.c:139: FAIL: copy_file_range failed unexpectedly; expected EOVERFLOW, but got: EFBIG (27)
(From OE-Core rev: 860d927e8e1c47d291e02119898d73a436fee259)
Signed-off-by: He Zhe <zhe.he@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/recipes-extended/ltp/ltp/0001-syscalls-copy_file_range02-Expect-EFBIG-in-subcase-m.patch | 57 | ||||
| -rw-r--r-- | meta/recipes-extended/ltp/ltp_20200515.bb | 1 |
2 files changed, 58 insertions, 0 deletions
diff --git a/meta/recipes-extended/ltp/ltp/0001-syscalls-copy_file_range02-Expect-EFBIG-in-subcase-m.patch b/meta/recipes-extended/ltp/ltp/0001-syscalls-copy_file_range02-Expect-EFBIG-in-subcase-m.patch new file mode 100644 index 0000000000..09b6f54874 --- /dev/null +++ b/meta/recipes-extended/ltp/ltp/0001-syscalls-copy_file_range02-Expect-EFBIG-in-subcase-m.patch | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | From 99687ab002f9f750f6f18fa1d70a91f0aa4f8ba2 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: He Zhe <zhe.he@windriver.com> | ||
| 3 | Date: Thu, 18 Jun 2020 17:18:27 +0800 | ||
| 4 | Subject: [PATCH] syscalls/copy_file_range02: Expect EFBIG in subcase max | ||
| 5 | length on 32-bit architectures | ||
| 6 | |||
| 7 | For syscall | ||
| 8 | ssize_t copy_file_range(int fd_in, loff_t *off_in, | ||
| 9 | int fd_out, loff_t *off_out, | ||
| 10 | size_t len, unsigned int flags); | ||
| 11 | off_out is loff_t* that is long long, 64 bits on 32-bit architectures, | ||
| 12 | while len is size_t that unsigned int, 32 bits on 32-bit architectures. | ||
| 13 | |||
| 14 | In subcase "max length", simplified as below, | ||
| 15 | |||
| 16 | dst = tst_max_lfs_filesize(); | ||
| 17 | TEST(sys_copy_file_range(fd_src, 0, *tc->copy_to_fd, &dst, tc->len, tc->flags)); | ||
| 18 | |||
| 19 | where dst is 4K*4G and len is 4G, so (4K+1)*4G is always smaller than 4G*4G, | ||
| 20 | it can never match the following kernel condition on 32-bit architectures. | ||
| 21 | |||
| 22 | if (pos_in + count < pos_in || pos_out + count < pos_out) | ||
| 23 | return -EOVERFLOW; | ||
| 24 | |||
| 25 | And thus we would get error like | ||
| 26 | copy_file_range02.c:139: FAIL: copy_file_range failed unexpectedly; expected EOVERFLOW, but got: EFBIG (27) | ||
| 27 | |||
| 28 | Also correct a typo. | ||
| 29 | |||
| 30 | Upstream-Status: Backport [http://lists.linux.it/pipermail/ltp/2020-June/017716.html] | ||
| 31 | |||
| 32 | Signed-off-by: He Zhe <zhe.he@windriver.com> | ||
| 33 | Acked-by: Li Wang <liwang@redhat.com> | ||
| 34 | --- | ||
| 35 | .../kernel/syscalls/copy_file_range/copy_file_range02.c | 6 +++++- | ||
| 36 | 1 file changed, 5 insertions(+), 1 deletion(-) | ||
| 37 | |||
| 38 | diff --git a/testcases/kernel/syscalls/copy_file_range/copy_file_range02.c b/testcases/kernel/syscalls/copy_file_range/copy_file_range02.c | ||
| 39 | index fa679c4d3..bc27fbe57 100644 | ||
| 40 | --- a/testcases/kernel/syscalls/copy_file_range/copy_file_range02.c | ||
| 41 | +++ b/testcases/kernel/syscalls/copy_file_range/copy_file_range02.c | ||
| 42 | @@ -78,7 +78,11 @@ static struct tcase { | ||
| 43 | {&fd_chrdev, 0, EINVAL, CONTSIZE, "char device", 0}, | ||
| 44 | {&fd_fifo, 0, EINVAL, CONTSIZE, "fifo", 0}, | ||
| 45 | {&fd_pipe[0], 0, EINVAL, CONTSIZE, "pipe", 0}, | ||
| 46 | - {&fd_copy, 0, EOVERFLOW, ULLONG_MAX, "max length lenght", 1}, | ||
| 47 | +#ifdef TST_ABI64 | ||
| 48 | + {&fd_copy, 0, EOVERFLOW, ULLONG_MAX, "max length", 1}, | ||
| 49 | +#else | ||
| 50 | + {&fd_copy, 0, EFBIG, ULLONG_MAX, "max length", 1}, | ||
| 51 | +#endif | ||
| 52 | {&fd_copy, 0, EFBIG, MIN_OFF, "max file size", 1}, | ||
| 53 | }; | ||
| 54 | |||
| 55 | -- | ||
| 56 | 2.17.1 | ||
| 57 | |||
diff --git a/meta/recipes-extended/ltp/ltp_20200515.bb b/meta/recipes-extended/ltp/ltp_20200515.bb index f2510baa68..b283add12f 100644 --- a/meta/recipes-extended/ltp/ltp_20200515.bb +++ b/meta/recipes-extended/ltp/ltp_20200515.bb | |||
| @@ -36,6 +36,7 @@ SRC_URI = "git://github.com/linux-test-project/ltp.git \ | |||
| 36 | file://0001-Add-more-musl-exclusions.patch \ | 36 | file://0001-Add-more-musl-exclusions.patch \ |
| 37 | file://0001-ptrace01-Fix-missing-format-string.patch \ | 37 | file://0001-ptrace01-Fix-missing-format-string.patch \ |
| 38 | file://0001-sigwaitinfo-Do-not-run-invalid-undefined-test-cases.patch \ | 38 | file://0001-sigwaitinfo-Do-not-run-invalid-undefined-test-cases.patch \ |
| 39 | file://0001-syscalls-copy_file_range02-Expect-EFBIG-in-subcase-m.patch \ | ||
| 39 | " | 40 | " |
| 40 | 41 | ||
| 41 | S = "${WORKDIR}/git" | 42 | S = "${WORKDIR}/git" |
