* [LTP] [PATCH] syscalls/copy_file_range02: Expect EFBIG in subcase max length on 32-bit architectures
@ 2020-06-18 9:18 zhe.he
2020-06-19 8:33 ` Li Wang
0 siblings, 1 reply; 2+ messages in thread
From: zhe.he @ 2020-06-18 9:18 UTC (permalink / raw)
To: ltp
From: He Zhe <zhe.he@windriver.com>
For syscall
ssize_t copy_file_range(int fd_in, loff_t *off_in,
int fd_out, loff_t *off_out,
size_t len, unsigned int flags);
off_out is loff_t* that is long long, 64 bits on 32-bit architectures,
while len is size_t that unsigned int, 32 bits on 32-bit architectures.
In subcase "max length", simplified as below,
dst = tst_max_lfs_filesize();
TEST(sys_copy_file_range(fd_src, 0, *tc->copy_to_fd, &dst, tc->len, tc->flags));
where dst is 4K*4G and len is 4G, so (4K+1)*4G is always smaller than 4G*4G,
it can never match the following kernel condition on 32-bit architectures.
if (pos_in + count < pos_in || pos_out + count < pos_out)
return -EOVERFLOW;
And thus we would get error like
copy_file_range02.c:139: FAIL: copy_file_range failed unexpectedly; expected EOVERFLOW, but got: EFBIG (27)
Also correct a typo.
Signed-off-by: He Zhe <zhe.he@windriver.com>
---
.../kernel/syscalls/copy_file_range/copy_file_range02.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/testcases/kernel/syscalls/copy_file_range/copy_file_range02.c b/testcases/kernel/syscalls/copy_file_range/copy_file_range02.c
index fa679c4d3..bc27fbe57 100644
--- a/testcases/kernel/syscalls/copy_file_range/copy_file_range02.c
+++ b/testcases/kernel/syscalls/copy_file_range/copy_file_range02.c
@@ -78,7 +78,11 @@ static struct tcase {
{&fd_chrdev, 0, EINVAL, CONTSIZE, "char device", 0},
{&fd_fifo, 0, EINVAL, CONTSIZE, "fifo", 0},
{&fd_pipe[0], 0, EINVAL, CONTSIZE, "pipe", 0},
- {&fd_copy, 0, EOVERFLOW, ULLONG_MAX, "max length lenght", 1},
+#ifdef TST_ABI64
+ {&fd_copy, 0, EOVERFLOW, ULLONG_MAX, "max length", 1},
+#else
+ {&fd_copy, 0, EFBIG, ULLONG_MAX, "max length", 1},
+#endif
{&fd_copy, 0, EFBIG, MIN_OFF, "max file size", 1},
};
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [LTP] [PATCH] syscalls/copy_file_range02: Expect EFBIG in subcase max length on 32-bit architectures
2020-06-18 9:18 [LTP] [PATCH] syscalls/copy_file_range02: Expect EFBIG in subcase max length on 32-bit architectures zhe.he
@ 2020-06-19 8:33 ` Li Wang
0 siblings, 0 replies; 2+ messages in thread
From: Li Wang @ 2020-06-19 8:33 UTC (permalink / raw)
To: ltp
On Thu, Jun 18, 2020 at 5:21 PM <zhe.he@windriver.com> wrote:
> From: He Zhe <zhe.he@windriver.com>
>
> For syscall
> ssize_t copy_file_range(int fd_in, loff_t *off_in,
> int fd_out, loff_t *off_out,
> size_t len, unsigned int flags);
> off_out is loff_t* that is long long, 64 bits on 32-bit architectures,
> while len is size_t that unsigned int, 32 bits on 32-bit architectures.
>
> In subcase "max length", simplified as below,
>
> dst = tst_max_lfs_filesize();
> TEST(sys_copy_file_range(fd_src, 0, *tc->copy_to_fd, &dst, tc->len,
> tc->flags));
>
> where dst is 4K*4G and len is 4G, so (4K+1)*4G is always smaller than
> 4G*4G,
> it can never match the following kernel condition on 32-bit architectures.
>
Thanks for fixing this, pushed.
--
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20200619/11fd4ada/attachment.htm>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-06-19 8:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-18 9:18 [LTP] [PATCH] syscalls/copy_file_range02: Expect EFBIG in subcase max length on 32-bit architectures zhe.he
2020-06-19 8:33 ` Li Wang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.